【问题标题】:Error in adding concurrently in package.json在 package.json 中同时添加时出错
【发布时间】: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 ```

【问题讨论】:

标签: javascript node.js npm mern react-fullstack


【解决方案1】:

尝试将"dev": "concurrently \"npm run server\" \"npm run client\"",替换为

"dev": "npm run server && npm run client",

【讨论】:

  • 这不会同时运行它们
猜你喜欢
  • 1970-01-01
  • 2015-09-02
  • 2016-04-13
  • 2015-05-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-01-14
相关资源
最近更新 更多