Published on

[Solved] TypeError: js_cookie__WEBPACK_IMPORTED_MODULE_2__.default.getJSON is not a function

Problem:

Running into the following error when trying to build a Next.js app:

TypeError: js_cookie__WEBPACK_IMPORTED_MODULE_2__.default.getJSON is not a function

Solution:

This error has to do with using an incompatible version of the js-cookie npm package. Change the version of js-cookie to 2.2.1 in order to resolve this error like so:

npm uninstall js-cookie
npm install js-cookie@2.2.1
npm run dev // run the development server to ensure the error is solved

Conclusion:

Well that’s all for today, I hope you found this article helpful. Thanks so much for reading my article! Feel free to follow me on Twitter and GitHub, connect with me on LinkedIn and subscribe to my YouTube channel.