盖茨比开发不工作后创建一个项目



我创建了一个Gatsby项目,每当我运行gatsby developnpm run develop时,我得到以下错误:


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:CodeGatsby test projectgatsby-test
npm ERR! command failed
npm ERR! command C:WINDOWSsystem32cmd.exe /d /s /c gatsby develop
npm ERR! A complete log of this run can be found in:
npm ERR!     C:UsersmartiAppDataLocalnpm-cache_logs2021-01-21T10_50_22_321Z-debug.log```

其他脚本,如gatsby buildgatsby clean工作时,我运行它们,但这不是npm run developnpm start的情况

首先,我试图卸载node_modules和删除package-lock.json和运行npm install,但我仍然得到了错误。我试图卸载gatsby-cli并创建npm init gatsby项目,但再次没有区别。最后,我完全卸载了Nodejs并安装了最新版本,但每次我尝试启动开发服务器时,我仍然得到Error: spawn node ENOENT

我有React的经验,但是我对Gatsby是新手。我最近有一个问题,我的节点运行npm start没有做任何事情,并返回到控制台。问题是我的Nodejs文件夹安装在D:而不是C:驱动器中,react-scripts版本也很旧,但简单的重新安装修复了这个问题。

我没有改变项目中的任何东西,但这里是package.json文件:

"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"
}
}
如果有人指出问题可能在哪里,我会很感激。感谢您的宝贵时间!

对于那些可能遇到同样麻烦的人:这个问题已经最终解决了:

npm run develop:cypress

最新更新