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

Builds Don't Work with PostCSS After Update #11565

Closed
kanto2113 opened this issue Oct 20, 2021 · 45 comments
Closed

Builds Don't Work with PostCSS After Update #11565

kanto2113 opened this issue Oct 20, 2021 · 45 comments

Comments

@kanto2113
Copy link

In Node v17:

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/tokenize' is not defined by "exports" in /tmp/workspace/node_modules/postcss-safe-parser/node_modules/postcss/package.json

In earlier versions of Node, this was just a deprecation warning:

Update this package.json to use a subpath pattern like "./*".

@shallow-alchemy
Copy link

I'm experiencing the same issue

@dantman
Copy link

dantman commented Oct 23, 2021

This is related to postcss/postcss-safe-parser#29. Which is actually entirely CRA's fault because react-scripts@4.0.3 is using PostCSS 7 (obsolete) and an old version of postcss-safe-parser.

It looks like the work fixing this issue was already merged in July (PostCSS was updated to version without this Node 17 issue in #11121, and postcss-safe-parser was removed in #11201). However none of that has been released yet. All of that is being pushed to CRA v5, however I don't see anything in the 5.0 milestone that should in any way block a CRA 5.0 release.

@heymike-sol
Copy link

Is there any fix for this?

@vnva
Copy link

vnva commented Oct 24, 2021

@timashov, rolling back to Node 16.8.0 helped me.

@experimatt
Copy link

@kanto2113 @dantman thank you for documenting this issue. I'm in the exact same boat, and am eagerly awaiting a possible solution.

@shallow-alchemy
Copy link

shallow-alchemy commented Oct 25, 2021

Nuked my node modules and yarn.lock and ran yarn install and it worked. Using cra typescript template.

@ValeriMladenov
Copy link

Just remove yarn.lock & node_modules & run yarn

@FelicitusNeko
Copy link

The solution of removing yarn.lock and node_modules does not work for me. I get a large number of these errors, and Yarn fails:

➤ YN0001: │ Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
    at new NodeError (node:internal/errors:371:5)
    at PassThrough.onclose (node:internal/streams/end-of-stream:122:30)
    at PassThrough.emit (node:events:390:28)
    at emitCloseNT (node:internal/streams/destroy:145:10)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)

@shallow-alchemy
Copy link

@FelicitusNeko what version of node are you on?

@FelicitusNeko
Copy link

@MatthewPardini I switched to Node 17.0.1 using NVM and gave it a try. No good. Also, this is using Yarn 3.0.2.

@komali2
Copy link

komali2 commented Oct 27, 2021

Having this issue, wiping out node_modules didn't work, the only solution that's worked for me is nvm use 16.8.0.

@shivamdave22
Copy link

Package subpath './lib/parser' is not defined by "exports" in /home/node/app/node_modules/postcss/package.json I am getting an error like this today suddenly.

@Senbonzakura1234
Copy link

Package subpath './lib/parser' is not defined by "exports" in /home/node/app/node_modules/postcss/package.json I am getting an error like this today suddenly.

i also got this issue either

@shivamdave22
Copy link

Package subpath './lib/parser' is not defined by "exports" in /home/node/app/node_modules/postcss/package.json I am getting an error like this today suddenly.

i also got this issue either

Were you able to find resolution?

@Senbonzakura1234
Copy link

Senbonzakura1234 commented Nov 1, 2021

Package subpath './lib/parser' is not defined by "exports" in /home/node/app/node_modules/postcss/package.json I am getting an error like this today suddenly.

i also got this issue either

Were you able to find resolution?

I did the same as people above, migrate back to node 16.8.0

@kylerchin
Copy link

Please fix this :)

@rosman21
Copy link

rosman21 commented Nov 7, 2021

on node v17.0.1. deleted yarn.lock and node_modules then did yarn install and worked for me

@Senbonzakura1234
Copy link

Senbonzakura1234 commented Nov 7, 2021

on node v17.0.1. deleted yarn.lock and node_modules then did yarn install and worked for me

High chance it will break the application, i recommend you never do that to your project

@shallow-alchemy
Copy link

@Senbonzakura1234 The application is already broken. I don't understand why one would hesitate to do this on a fresh cra app ??

@shallow-alchemy
Copy link

@MatthewPardini I switched to Node 17.0.1 using NVM and gave it a try. No good. Also, this is using Yarn 3.0.2.

@FelicitusNeko interesting. My yarn was two major versions back, 1.22.10. Same node version though. Older yarn is probably the difference

@zitrosolrac
Copy link

has anyone found a fix for this?

@zekiblue
Copy link

zekiblue commented Dec 9, 2021

yarn upgrade worked for me.

@Producdevity
Copy link

Why is this closed? I don't see a fix... Only some pretty risky workarounds

@jdgomezb
Copy link

Package subpath './lib/parser' is not defined by "exports" in /home/node/app/node_modules/postcss/package.json I am getting an error like this today suddenly.

i also got this issue either

Were you able to find resolution?

I did the same as people above, migrate back to node 16.8.0

This actually worked for me. I can run the npm run dev command

@kendjr
Copy link

kendjr commented Jan 19, 2022

I was receiving
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/parser' is not defined by "exports" in ...node_modules\next\node_modules\postcss\package.json

I have resolved it on node version 17.4.0 after I upgraded react, and nextjs using:
npm install react@latest react-dom@latest
npm install next@12

(https://nextjs.org/docs/upgrading)

@wedgemartin
Copy link

I was receiving Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/parser' is not defined by "exports" in ...node_modules\next\node_modules\postcss\package.json

I have resolved it on node version 17.4.0 after I upgraded react, and nextjs using: npm install react@latest react-dom@latest npm install next@12

(https://nextjs.org/docs/upgrading)

this worked for me.

@melleveapp
Copy link

i downgraded version node, and worked

@rjcallahan
Copy link

npm audit fix --force also fixed this issue for me

@zeelz
Copy link

zeelz commented Apr 25, 2022

My node was 17.0. Had to get LTS nvm install lts

If you don't have nvm:

curl -o- https://github.com/raw/nvm-sh/nvm/v0.35.3/install.sh | bash
source ~/.nvm/nvm.sh

@Konglomneshued
Copy link

Konglomneshued commented Jan 14, 2023

Can we get a real fix and not downgrading Node version? Current LTS is now 18.13.0.

@atwellpub
Copy link

I was receiving Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/parser' is not defined by "exports" in ...node_modules\next\node_modules\postcss\package.json

I have resolved it on node version 17.4.0 after I upgraded react, and nextjs using: npm install react@latest react-dom@latest npm install next@12

(https://nextjs.org/docs/upgrading)

This worked for me

@ayansome1
Copy link

Upgrading should solve your issue:
https://nextjs.org/docs/upgrading

npm i next@latest react@latest react-dom@latest eslint-config-next@latest
# or
yarn add next@latest react@latest react-dom@latest eslint-config-next@latest
# or
pnpm up next react react-dom eslint-config-next --latest

@appfliiq-x
Copy link

I used these commands to deploy to production on Vercel. Simply insert it in the "Install Command" field.
Rename your yarn.lock or package.lock files ending with -backup from github repo just incase of anything.

npm install next@12 && npm install react@latest react-dom@latest && npm i --package-lock-only && yarn install && npm audit fix --force

@moomoo-dev
Copy link

Was this ever fixed?

@moomoo-dev
Copy link

Ok so I actually got pass this issue but updating to postcss": "8.2.12"

@foverokavindz
Copy link

npm audit fix --force

this works for me

@sahumanika
Copy link

Yes, it works for me too.

@rphcompany
Copy link

I was receiving Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/parser' is not defined by "exports" in ...node_modules\next\node_modules\postcss\package.json

I have resolved it on node version 17.4.0 after I upgraded react, and nextjs using: npm install react@latest react-dom@latest npm install next@12

(https://nextjs.org/docs/upgrading)

Worked for me as well.

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