You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
(node:3713) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at /tmp/workspace/node_modules/postcss-safe-parser/node_modules/postcss/package.json.
Update this package.json to use a subpath pattern like "./*".
This version of postcss is a react-scripts dependency and not something we should manually update. I'm worried that other people will run into this issue unintentionally
@kanto2113 seems like you are using PostCSS 7, which is not supported anymore because PostCSS 8 was released around 2 years ago.
Create React App has system problem with maintaince. As I know, PostCSS 8 migration was still not release.
I do not really like to fixing my old releases because of CRA maintainers (it is not fair that I am working for them). But if somebody sends a well-tested PR to v7 branch, I can release it. Just start from reading the docs, it is easy to break system for other environments (for instance, * can’t be used, we need to manually listed all possible files as we did in main).
Reacted by Olivier Jolit, Evgen Bodunov and miguelSWE
I do not really like to fixing my old releases because of CRA maintainers (it is not fair that I am working for them). But if somebody sends a well-tested PR to v7 branch, I can release it.
Unfortunately there's no point to that. react-scripts@4.0.3 has postcss-safe-parser pinned to 5.0.2 exactly. So even if make a new patch release it won't be installed.
It looks like CRA has already updated PostCSS to v8 and also removed postcss-safe-parser as part of the WebPack 5 update. However of course they haven't released any of the work done on CRA since Feb so we're stuck with this issue.
[ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/tokenize' is not defined by "exports" in node_modules/postcss-safe-parser/node_modules/postcss/package.json
I do not really like to fixing my old releases because of CRA maintainers (it is not fair that I am working for them).
@ai: you have my sympathy. I really appreciate all the time, energy, and hard work you put into maintaining this and other packages. I'm donating to support your work now: https://opencollective.com/postcss/contribute
Unfortunately there's no point to that. react-scripts@4.0.3 has postcss-safe-parser pinned to 5.0.2 exactly. So even if make a new patch release it won't be installed.
The fix can be applied to postcss 7.x. Does CRA pinned postcss?
And postcss-preset-env does appear to use postcss: ^7.0.17 so fixing it there could work.
Though I will note that postcss-safe-parser@5.0.2 uses postcss: ^8.1.0. For a number of pre-existing projects this means our package-lock actually has a postcss before 8.2.11 (when the bug was fixed). And I don't know if any way of telling node to update a deep package list this, short of deleting the entire lockfile. Given node's resolution algorithm I suspect this may be the real issue. And even if the 7.x packages turn out also be an issue, for most of us the issue will remain even after a normal npm package install and update due to our lockfiles.
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/tokenize' is not defined by "exports" in /home/xyz/sample/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:429:9)
at packageExportsResolve (node:internal/modules/esm/resolve:705: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.<anonymous> (/home/xyz/sample/node_modules/postcss-safe-parser/lib/safe-parser.js:1:17) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/tokenize' is not defined by "exports" in /home/xyz/sample/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:429:9)
at packageExportsResolve (node:internal/modules/esm/resolve:705: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.<anonymous> (/home/xyz/sample/node_modules/postcss-safe-parser/lib/safe-parser.js:1:17) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
I had the same issue and as many of you say, it's a problem with react-scripts and postcss because of React version.
I fixed it in my React app by removing node_modules folder and yarn.lock file, then I updated my React version and also my react-dom dependency with:
yarn add react@latest react-dom@latest
Then I ran yarn so my node_modules get installed again, which fixed my issue.
I hope this helps some of you.
This worked for me because it's a small React App. You should probably verify if other dependencies are compatible with the latest React version (now 18.2.0)
Activity
ai commentedon Oct 20, 2021
Try to update
postcss. We fixedexportsinpostcssa few releases ago. Maybe the issue happened because of the oldpostcss.ralfisalhon commentedon Oct 20, 2021
This version of
postcssis areact-scriptsdependency and not something we should manually update. I'm worried that other people will run into this issue unintentionallyai commentedon Oct 20, 2021
Do you use
postcss7?Can you show PostCSS versions from
npm ls?RedHairring commentedon Oct 20, 2021
Bump, having the same issue and our website is down in production till there is a fix
kanto2113 commentedon Oct 20, 2021
Same issue here. Started about 2 hours ago when I tried to re-deploy my react website.
ai commentedon Oct 20, 2021
@RedHairring @kanto2113 what PostCSS version do you use? Check
npm ls.kanto2113 commentedon Oct 20, 2021
@ai
npm lsdoesn't list PostCSS. The react-scripts npm module has the following as dependencies.ai commentedon Oct 20, 2021
@kanto2113 call
npm lsin the terminal inside your project. Put the output to https://gist.github.com and post the result here.kanto2113 commentedon Oct 20, 2021
@ai https://gist.github.com/kanto2113/bb7bfc17d49e8c31c4395f8a54622ec6
ai commentedon Oct 20, 2021
@kanto2113 seems like you are using PostCSS 7, which is not supported anymore because PostCSS 8 was released around 2 years ago.
Create React App has system problem with maintaince. As I know, PostCSS 8 migration was still not release.
I do not really like to fixing my old releases because of CRA maintainers (it is not fair that I am working for them). But if somebody sends a well-tested PR to
v7branch, I can release it. Just start from reading the docs, it is easy to break system for other environments (for instance,*can’t be used, we need to manually listed all possible files as we did inmain).dantman commentedon Oct 23, 2021
Unfortunately there's no point to that.
react-scripts@4.0.3has postcss-safe-parser pinned to5.0.2exactly. So even if make a new patch release it won't be installed.It looks like CRA has already updated PostCSS to v8 and also removed
postcss-safe-parseras part of the WebPack 5 update. However of course they haven't released any of the work done on CRA since Feb so we're stuck with this issue.heymike777 commentedon Oct 23, 2021
Is there any fix for this?
ai commentedon Oct 23, 2021
@Timashov nope. Only eject the configs and avoid using CRA in the future.
experimatt commentedon Oct 24, 2021
Ugh, I'm in the same boat.
npm lsoutput: https://gist.github.com/experimatt/56661550572ccfcfcf03ebc3c7dfc976@ai: you have my sympathy. I really appreciate all the time, energy, and hard work you put into maintaining this and other packages. I'm donating to support your work now: https://opencollective.com/postcss/contribute
ai commentedon Oct 24, 2021
@dantman
The fix can be applied to
postcss 7.x. Does CRA pinnedpostcss?dantman commentedon Oct 24, 2021
Technically CRA does not pin PostCSS. They pin the following:
And PostCSS comes in indirectly:
And
postcss-preset-envdoes appear to usepostcss: ^7.0.17so fixing it there could work.Though I will note that
postcss-safe-parser@5.0.2usespostcss: ^8.1.0. For a number of pre-existing projects this means our package-lock actually has a postcss before 8.2.11 (when the bug was fixed). And I don't know if any way of telling node to update a deep package list this, short of deleting the entire lockfile. Given node's resolution algorithm I suspect this may be the real issue. And even if the 7.x packages turn out also be an issue, for most of us the issue will remain even after a normal npm package install and update due to our lockfiles.🐛 react-scripts に依存している postcss に既知のバグがあり動かなくなるので Node のバージョンを下げる
🐛 react-scripts に依存している postcss に既知のバグがあり動かなくなるので Node のバージョンを下げる
cojack commentedon Dec 13, 2021
yes, @Timashov downgrade your node version to 16
spykard commentedon Apr 4, 2022
Still occuring
artginzburg commentedon May 5, 2022
Same issue here. Currently bypassing it by downgrading to Node LTS (16).
The thing is, the project I'm talking about cannot even be safely updated to a newer version, because it was ejected from CRA.
New apps built with CRA work fine on Node 18 though.
byteshiva commentedon Jun 24, 2022
Failing for
Node v17.5.0byteshiva commentedon Jun 24, 2022
The below fix worked for me.
Update
postcsson v17.5.0cosmicknox commentedon Sep 12, 2022
this worked for me thanks
xanderjames1910 commentedon Nov 22, 2022
I had the same issue and as many of you say, it's a problem with react-scripts and postcss because of React version.
I fixed it in my React app by removing node_modules folder and yarn.lock file, then I updated my React version and also my react-dom dependency with:
yarn add react@latest react-dom@latestThen I ran
yarnso my node_modules get installed again, which fixed my issue.I hope this helps some of you.
This worked for me because it's a small React App. You should probably verify if other dependencies are compatible with the latest React version (now 18.2.0)