postcss-safe-parser: Builds Don't Work with Node v17 Release

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:

(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 "./*".

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 23 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Try to update postcss. We fixed exports in postcss a few releases ago. Maybe the issue happened because of the old postcss.

@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).

Ugh, I’m in the same boat. npm ls output: https://gist.github.com/experimatt/56661550572ccfcfcf03ebc3c7dfc976

[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

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)