描述bug
在用create-react-app
创建了一个新的应用后,它无法启动:
yarn run v1.22.17
$ 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 /home/pawel/dev/baz/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:683: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/pawel/dev/baz/node_modules/postcss-safe-parser/lib/safe-parser.js:1:17) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
Node.js v17.1.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
似乎create-react-app
使用的postcss-safe-parser
版本与node 17不兼容: postcss/postcss-safe-parser#29
重现步骤
- 安装node 17
- 用
create-react-app foo
创建一个新的应用 cd foo
yarn start
或npm start
- 应用无法启动,上述错误是原因
3条答案
按热度按时间3pvhb19x1#
这不是修复此错误的方法,但在问题修复之前,如果有人需要解决方法 - https://stackoverflow.com/a/69698758/1946418
bzzcjhmw2#
同样的问题
wlzqhblo3#
同样的问题