I cloned a react project, after installing the packages and I run "npm start" it displays the error below.
It’s not my code, I am to continue with the project but with the error I can’t proceed.
Below is the error message
$ npm start
[email protected] start
react-scripts start
node:internal/modules/cjs/loader:544
throw e;
^
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath ‘./lib/tokenize’ is not defined by "exports" in C:UsersemmanDesktopzenstifyzenstify2node_modulespostcss-safe-parsernode_modulespostcsspackage.json
at new NodeError (node:internal/errors:400:5)
at exportsNotFound (node:internal/modules/esm/resolve:361:10)
at packageExportsResolve (node:internal/modules/esm/resolve:697:9)
at resolveExports (node:internal/modules/cjs/loader:538:36)
at Module._findPath (node:internal/modules/cjs/loader:607:31)
at Module._resolveFilename (node:internal/modules/cjs/loader:1025:27)
at Module._load (node:internal/modules/cjs/loader:885:27)
at Module.require (node:internal/modules/cjs/loader:1105:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object. (C:UsersemmanDesktopzenstifyzenstify2node_modulespostcss-safe-parserlibsafe-parser.js:1:17) {
code: ‘ERR_PACKAGE_PATH_NOT_EXPORTED’
}
Node.js v18.13.0
I have tried uninstalling postcss and reinstalling it again
3
Answers
I was able to resolve this issue by creating a .npmrc file and pasted the code below in it. Make sure the .npmrc file is in the root directory of your project.
try
1.)deleting your node_modules then reinstall everything
Or
2.) install that specific package using the –legacy-peer-deps or install all the packages at once with –legacy-peer-deps
I suggest running
npm update
. Runningnpm update
will update the installed modules that have issues with versioning. Once done, also runnpm audit fix --force
I have faced this issue before in my environments and running
npm update
has helped.Hope this helps.