我正在关注本教程https://edgecoders.com/graphql-learn-by-doing-part-1-of-3-9b04cadeacfa来学习 GraphQL 的基础知识。在我尝试运行此命令时遵循整个过程后,npm start
它在 Windows 上失败,但相同的命令正在我的 linux 机器上运行。谁能指出我在这里缺少的东西?错误是
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules
\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v6.11.1
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! github-graphql-server@1.0.0 start: `babel-node --presets es2015 ./server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the github-graphql-server@1.0.0 start script 'babel-node --presets es2015 ./server.js
'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the github-graphql-server package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! babel-node --presets es2015 ./server.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs github-graphql-server
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls github-graphql-server
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! F:\my\github-graphql-server\npm-debug.log
我认为这两个可以解决我的问题,并且博客评论建议 清理智能引号并使用连字符而不是破折号。
npm 错误!告诉作者这在您的系统上失败:
npm 错误!babel-node --presets es2015 ./server.js
我的package.json上的启动文件
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "./node_modules/.bin/babel-node --presets es2015 ./server.js"
},
package.json的其他依赖
"dependencies": {
"babel-cli": "^6.24.1",
"babel-core": "^6.25.0",
"babel-loader": "^7.1.1",
"babel-preset-es2015": "^6.24.1",
"babel-preset-es2015-node": "^6.1.1",
"express": "^4.15.4",
"express-graphql": "^0.6.7",
"graphql": "^0.10.5"
}