【发布时间】:2021-09-03 17:16:50
【问题描述】:
package.json 中的脚本
"scripts": {
"start": "node back-end/server.js",
"server": "nodemon back-end/server.js",
"client": "npm start --prefix front-end",
"dev": "concurrently \"npm run server\" \"npm run client\"",
"test": "echo \"Error: no test specified\" && exit 1"
},
每当我同时运行代码时,它都会显示这样的错误
$ npm 运行开发
> concurrently "npm run server" "npm run client"
[0] Error occurred when executing command: npm run server
[0] Error: spawn cmd.exe ENOENT
[0] at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
[0] at onErrorNT (node:internal/child_process:480:16)
[0] at processTicksAndRejections (node:internal/process/task_queues:81:21)
[1] Error occurred when executing command: npm run client
[1] Error: spawn cmd.exe ENOENT
[1] at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
[1] at onErrorNT (node:internal/child_process:480:16)
[1] at processTicksAndRejections (node:internal/process/task_queues:81:21)
[1] npm run client exited with code -4058
[0] npm run server exited with code -4058 ```
【问题讨论】:
-
尝试使用 NPM 的完整路径
-
这些Q&A search results你读过并尝试过哪些?
标签: javascript node.js npm mern react-fullstack