Angular 测试错误:错误 [ERR_PACKAGE_PATH_NOT_EXPORTED]:包子路径 './package.json' 未由 "exports" 定义

Angular test errors: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './package.json' is not defined by "exports"

当前在我 运行 npx ng test

时出现此错误
Error: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './package.json' is not defined by "exports" in /home/ecarroll/cp/js/angular-ui/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.<anonymous> (/home/ecarroll/cp/js/angular-ui/node_modules/postcss-loader/dist/index.js:16:39)
    at Module._compile (node:internal/modules/cjs/loader:1095:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1147:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at require (node:internal/modules/cjs/helpers:102:18)

我该如何解决?

这是 PostCSS that was fixed here. I discovered this fix by opening up the package.json in GitHub and then using web interface to git blame to figure out when the line was added for the export

中的错误

修复已推出这些版本

8.3.11  8.3.10 8.3.9 8.3.8 8.3.7 8.3.6 8.3.5 8.3.4 8.3.3 8.3.2 8.3.1 8.3.0 8.2.15 8.2.14 8.2.13 8.2.12

打开你的package.json

/home/ecarroll/cp/js/angular-ui/node_modules/postcss/package.json

获取版本号并手动升级到最接近修复的版本,因此尝试解决它

npm install postcss@8.2.15