I created a Gatsby project and whenever I run gatsby develop
or npm run develop
I get the following error:
UNHANDLED REJECTION spawn node ENOENT
Error: spawn node ENOENT
- child_process:277 Process.ChildProcess._handle.onexit
node:internal/child_process:277:19
- child_process:477 onErrorNT
node:internal/child_process:477:16
- task_queues:81 processTicksAndRejections
node:internal/process/task_queues:81:21
npm ERR! code 1
npm ERR! path D:\Code\Gatsby test project\gatsby-test
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c gatsby develop
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\marti\AppData\Local\npm-cache\_logs\2021-01-21T10_50_22_321Z-debug.log```
Other scripts like gatsby build
and gatsby clean
work when I run them but that is not the case with npm run develop
or npm start
Firstly, I tried to uninstall node_modules
and delete package-lock.json
and run npm install
but I still got the error. I tried to uninstall gatsby-cli
and create a project with npm init gatsby
but the was no difference again. Finally, I uninstalled Nodejs completely and installed the latest version but I still get the Error: spawn node ENOENT
everytime I try to start the development server.
I have experience with React but I am new to Gatsby. I recently had a problem with my Node where running npm start
did nothing and returned me to the console. The issue was that my Nodejs folder was installed in D:\
and not in C:\
drive and also react-scripts
version was old but a simple reinstallation fixed the problem.
I haven't changed anything in the project but here is the package.json
file:
"name": "gatsby-starter-hello-world",
"private": true,
"description": "A simplified bare-bones starter for Gatsby",
"version": "0.1.0",
"license": "0BSD",
"scripts": {
"build": "gatsby build",
"develop": "gatsby develop",
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md}\"",
"start": "npm run develop",
"serve": "gatsby serve",
"clean": "gatsby clean",
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1"
},
"dependencies": {
"gatsby": "^2.26.1",
"react": "^16.12.0",
"react-dom": "^16.12.0"
},
"devDependencies": {
"prettier": "2.2.1"
},
"repository": {
"type": "git",
"url": "https://github.com/gatsbyjs/gatsby-starter-hello-world"
},
"bugs": {
"url": "https://github.com/gatsbyjs/gatsby/issues"
}
}
I would be grateful if somebody points me where the issue might be. Thank you for your time!
The issue has been finally solved using:
npm run develop:cypress
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.