Reputation: 529
I am working on MERN web application and trying to run both client and server with npm run dev but getting this error.
Error occured when executing command: npm run clientError: spawn cmd.exe ENOENT at _errnoException (util.js:1022:11) at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19) at onErrorNT (internal/child_process.js:372:16) at _combinedTickCallback (internal/process/next_tick.js:138:11) at process._tickCallback (internal/process/next_tick.js:180:9) at Function.Module.runMain (module.js:695:11) at startup (bootstrap_node.js:188:16) at bootstrap_node.js:609:3Error occured when executing command: npm run clientError: spawn cmd.exe ENOENT
//package.json in server
{
"name": "mern-list",
"version": "1.0.0",
"description": "",
"main": "server.js",
"scripts": {
"client-install": "npm install --prefix client",
"start": "node server.js",
"server": "nodemon server.js",
"client": "npm start --prefix client",
"dev": "concurrently \"npm run server\" \"npm run client\""
},
"author": "",
"license": "ISC",
"dependencies": {
"body-parser": "^1.18.3",
"concurrently": "^3.6.0",
"express": "^4.16.3",
"mongoose": "^5.2.0"
},
"devDependencies": {
"nodemon": "^1.17.5"
}
}
package.json in client
{
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react-scripts": "1.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"proxy": "http://localhost:5000"
}
Upvotes: 1
Views: 1956
Reputation: 104
on your server package.json use this line instead of your current line
"dev": "concurrently \"npm run server\" \"cd client && npm start\""
things may be happened because of your dev command it was specified npm start for the client but it didn't know where to find that.
Upvotes: 0
Reputation: 39
Take a look at your client/package.json.
You have to have these scripts:
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
Upvotes: 0
Reputation: 31
I had a similar issue and what I did was to goto my system Environment variables
and set my system variables which may have been mistakenly deleted.
Variable name = PATH
Variable value = C:\Windows\System32\
Goto > Control Panel\System and Security\System\Advance system setting\Enviroment variable
and set system variables path C:\Windows\System32\
variable and restart your System.
Upvotes: 0