Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm start failed (code: 'ERR_PACKAGE_PATH_NOT_EXPORTED') #11579

Closed
zzz6519003 opened this issue Oct 24, 2021 · 21 comments
Closed

npm start failed (code: 'ERR_PACKAGE_PATH_NOT_EXPORTED') #11579

zzz6519003 opened this issue Oct 24, 2021 · 21 comments

Comments

@zzz6519003
Copy link

➜ my-app git:(master) npm start

[email protected] start
react-scripts start

node:internal/modules/cjs/loader:488
throw e;
^

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/tokenize' is not defined by "exports" in /Users/zzz/Develop/my-app/node_modules/postcss-safe-parser/node_modules/postcss/package.json
at new NodeError (node:internal/errors:371:5)
at throwExportsNotFound (node:internal/modules/esm/resolve:416:9)
at packageExportsResolve (node:internal/modules/esm/resolve:669:3)
at resolveExports (node:internal/modules/cjs/loader:482:36)
at Function.Module._findPath (node:internal/modules/cjs/loader:522:31)
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:999:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object. (/Users/zzz/Develop/my-app/node_modules/postcss-safe-parser/lib/safe-parser.js:1:17) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}

Node.js v17.0.1

@Yochyo
Copy link

Yochyo commented Oct 29, 2021

Can be temporarely fixed by downgrading to 16.13.0

@zzz6519003 zzz6519003 changed the title npm start failed npm start failed (code: 'ERR_PACKAGE_PATH_NOT_EXPORTED') Oct 30, 2021
@AnthonyPoschen
Copy link

for anyone on mac needing the above temp fix which worked for me.
brew install node@16

@Ueland
Copy link

Ueland commented Nov 11, 2021

The "temp fix" is now two weeks old, any better fix out there yet?

@Lionprincipe
Copy link

Lionprincipe commented Nov 12, 2021

hello,
I 'am using Node.js v17.0.1 and upgrading my package helped me solved this issue without downgrading the node version.

"yarn upgrade"

hope this will help waiting for the fix.

@rainyEra
Copy link

cmd > npm i node@16. Now I can launch node@17. Looks like something missing in a clean node@17

@Ansub
Copy link

Ansub commented Dec 1, 2021

"yarn upgrade"

fixed the bug for me, and React App started working.

@aeskafi
Copy link

aeskafi commented Dec 1, 2021

"yarn upgrade"

fixed the bug for me, and everything works perfectly.

@kedbirhan
Copy link

kedbirhan commented Dec 4, 2021

why is this error being thrown though, is it because of dependencies incompatibility ??

@Ansub
Copy link

Ansub commented Dec 4, 2021

yeah, I think when we install react, it installs on the latest version, but the yarn was not updated to that version that supports the version of react. "yarn upgrade" fixed the bug because it upgrades packages to their latest version.

@nlintas
Copy link

nlintas commented Dec 5, 2021

If you got a message saying you will no longer receive security fixes if you do not upgrade when running yarn start or npm start then the solution is to run yarn upgrade, this will update the yarn packages and resolve this issue.

@Bazmundi
Copy link

Bazmundi commented Dec 5, 2021

Looking to learn react so, basically upgraded my nodejs and npm and went for an npx create-react-app following the destructions at: https://reactjs.org/docs/create-a-new-react-app.html

That is:

npx create-react-app my-app
cd my-app
npm start

Running on Windows 10, Node.js v17.2.0, npm/npx comes up as 8.2.0.

As I had not previously installed react, the npx command line above kindly pulled that in.

So, changed directory into my-app thence npm start left the insult at: https://pastebin.com/czGkpX1K

Lucked into this bug report. Ran yarn update thanks. Changes the insult to the following insult: https://pastebin.com/Zdchie2b

So, steps:

What fixed it for me was remover nodejs 17.2.0 and install 16.13.1 thanks.

@YousefAlsbaihi
Copy link

yarn upgrade

This worked for me on

"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "4.0.3",

@zzz6519003
Copy link
Author

but, need to yarn upgrade every time

@jhkcia
Copy link

jhkcia commented Dec 27, 2021

Fixed by running npm upgrade

@ananshe
Copy link

ananshe commented Jan 26, 2022

cmd > npm i node@16. Now I can launch node@17. Looks like something missing in a clean node@17

Awesome! That was easy fix, THANKS TO YOU!

@timothymureithi
Copy link

"start": "react-scripts --openssl-legacy-provider start",
"build": "react-scripts --openssl-legacy-provider build"

That worked for me

@xtRAVEN
Copy link

xtRAVEN commented Dec 2, 2022

"start": "react-scripts --openssl-legacy-provider start",
"build": "react-scripts --openssl-legacy-provider build"

that worked for me x2
thanks @timothymureithi

@HeyKalangi
Copy link

OpenSourceHelpCommunity/Questions#337
needed some help..

@Achal9099
Copy link

Achal9099 commented Jul 29, 2024

Error:
npm start

[email protected] start
npm run build:css && concurrently --kill-others 'npm:watch:css' 'react-scripts --openssl-legacy-provider start'

[email protected] build:css
postcss src/app/shared/styles/tailwind.css -o src/app/shared/styles/main.css

[1] ''react-scripts' is not recognized as an internal or external command,
[1] operable program or batch file.
[1] 'react-scripts exited with code 1
--> Sending SIGTERM to other processes..
[watch:css] npm run watch:css exited with code 1

package.json content
"scripts": {
"start": "npm run build:css && concurrently --kill-others 'npm:watch:css' 'react-scripts --openssl-legacy-provider start'",
"build": "npm run build:css && react-scripts --openssl-legacy-provider build",
"build:js": "react-scripts --openssl-legacy-provider build",

"test": "react-scripts test",
"test:all": "react-scripts test --watchAll=false",
"test:coverage": "react-scripts test --coverage --watchAll",
"test:debug": "react-scripts --inspect-brk test --runInBand --no-cache",
"eject": "react-scripts eject",
"prettier:base": "prettier 'src/**/*.{js,jsx,ts,tsx,json,css,scss,md}'",
"prettier:check": "yarn prettier:base --check",
"prettier:fix": "yarn prettier:base --write",
"l

Can someone help?

@zzz6519003
Copy link
Author

Install 'react-scripts

I always think it’s bad to have it

@Achal9099
Copy link

its install

npm ls -g react-scripts
C:\Program Files\nodejs -> .
`-- [email protected]

PS C:\Users\AchalBhangreNational\IdeaProjects\nbi-spport-ui> npm ls react-scripts
[email protected] C:\Users\AchalBhangreNational\IdeaProjects\nbi-spport-ui
+-- @storybook/[email protected]
| -- [email protected] deduped -- [email protected]

node -v
v18.20.4

npm -v
10.7.0
yarn -v
1.22.22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests