`npm start` 给出生命周期错误并以状态 9 退出

key*_*e33 2 linux ubuntu node.js npm reactjs

到目前为止,我已经看过类似的问题,例如this issuesthis one。解决方案似乎是:

rm package-lock.json
npm cache clean --force
npm install
npm start
Run Code Online (Sandbox Code Playgroud)

我已经尝试过这些步骤,但不断收到相同的错误:

rm package-lock.json
npm cache clean --force
npm install
npm start
Run Code Online (Sandbox Code Playgroud)

的输出/home/ubuntu/.npm/_logs/2021-12-20T09_28_07_369Z-debug.log是:

> client@0.1.0 start /home/ubuntu/react/client
> react-scripts --openssl-legacy-provider start

/usr/bin/node: bad option: --openssl-legacy-provider
npm ERR! code ELIFECYCLE
npm ERR! errno 9
npm ERR! client@0.1.0 start: `react-scripts --openssl-legacy-provider start`
npm ERR! Exit status 9
npm ERR!
npm ERR! Failed at the client@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ubuntu/.npm/_logs/2021-12-20T09_28_07_369Z-debug.log
Run Code Online (Sandbox Code Playgroud)

我看到的所有帖子的退出状态似乎都是 1,而我的退出状态是 9。可能是什么问题?根据我所读到的内容,退出状态 9 意味着该进程正在被系统终止,但我不知道为什么或如何找出答案。

Mat*_*yde 8

如果由于某种原因(例如没有管理员权限或其他原因)在用户的计算机上无法进行节点升级,那么我发现这可以修复它:更改参数在命令中出现的位置,因此在 package.json 中而不是这样:

"start": "react-scripts --openssl-legacy-provider start"

做这个:

"start": "react-scripts start --openssl-legacy-provider"

来源:https://github.com/coreui/coreui-free-react-admin-template/issues/336