I’m following along in section 4: Building Images with the react-app
I did npm install and the packages got downloaded.
I run npm start and the app fails with the following info.

Did I miss something? Or is something out of date?

react-app@0.1.0 start
react-scripts start

throw e;

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath ‘./lib/tokenize’ is not defined by “exports” in C:\dockerlearn\mosh\section4-react-app\node_modules\postcss-safe-parser\node_modules\postcss\package.json
at new NodeError (node:internal/errors:372:5)
at throwExportsNotFound (node:internal/modules/esm/resolve:440:9)
at packageExportsResolve (node:internal/modules/esm/resolve:719:3)
at resolveExports (node:internal/modules/cjs/loader:483:36)
at Module._findPath (node:internal/modules/cjs/loader:523:31)
at Module._resolveFilename (node:internal/modules/cjs/loader:925:27)
at Module._load (node:internal/modules/cjs/loader:780:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object. (C:\dockerlearn\mosh\section4-react-app\node_modules\postcss-safe-parser\lib\safe-parser.js:1:17) {

Node.js v18.0.0

1 Like

I think my node.js is newer than the application requires. I’m at v18. When I load the app into a docker container and run it, it pulls an older version of node in and the application starts properly.

I’m having the same problem. Did you find a solution for your local machine?

As mentioned by SeanB, it is the problem with the node version. You may check the node version using node -v. You may be using a higher version. Just use the specific version. For ex: in my case, I was having an error in the build process in my bitbucket-pipelines. The fix was to add the specific version of node (one that was working in my local) like this image: node:12.22.9.

it worked when I followed the command that was shown by npm. In my case it was showing vulnerabilities and mentioned to run npm audit fix --force.

So I used that command and ran some updates. Then I ran npm start and the react web server showed up

1 Like