【发布时间】:2020-12-09 18:44:24
【问题描述】:
我正在使用带有 create-react-app 的 react.js。我的问题是在 bash shell 中执行 npm start 时一切正常,但在 PowerShell 中执行 npm start 时,屏幕上显示以下错误
.../client-webapp/node_modules/.bin/react-scripts: node: not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file bash
npm ERR! errno ENOENT
npm ERR! client-webapp@0.1.0 start: `react-scripts start`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the client-webapp@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! C:\Users\r-rajaee\AppData\Roaming\npm-cache\_logs\2020-08-20T12_13_45_841Z-debug.log
【问题讨论】:
-
告诉我你能在你的 PowerShell 控制台中调用命令 node 吗?我假设您不能并且您正在使用 Windows,因此您只需卸载节点,然后再次安装,但在安装期间启用 PATH 选项以自动将节点添加到您的 PATH 集合中。之后重新启动控制台并重试。它应该使用全局安装的节点,但 Powershell 的路径不存在,因此它在 node_modules 中查找节点..
-
是的。我可以在我的 PowerShell 中调用 node 命令。我卸载了 node.js 并重新安装了它。但不起作用。
标签: node.js reactjs create-react-app