简体   繁体   中英

Error in adding concurrently in package.json

scripts in 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"
  },

whenever I run the code using concurrently it shows me error like this

$ npm run dev

> 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 ```

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM