【发布时间】:2017-06-30 23:14:18
【问题描述】:
当我运行 npm start 时它可以工作,但在 heroku 中我无法做到,
2017-06-28T17:18:54.167693+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2017-06-28T17:18:54.167918+00:00 app[web.1]: npm ERR! errno ENOENT
2017-06-28T17:18:54.168018+00:00 app[web.1]: npm ERR! syscall spawn
2017-06-28T17:18:54.168132+00:00 app[web.1]: npm ERR! juego-cartas-reactjs@0.1.0 start: `react-scripts start`
2017-06-28T17:18:54.168203+00:00 app[web.1]: npm ERR! spawn ENOENT
2017-06-28T17:18:54.168300+00:00 app[web.1]: npm ERR!
2017-06-28T17:18:54.168387+00:00 app[web.1]: npm ERR! Failed at the juego-cartas-reactjs@0.1.0 start script.
2017-06-28T17:18:54.169487+00:00 app[web.1]:
2017-06-28T17:18:54.168480+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2017-06-28T17:18:54.169649+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2017-06-28T17:18:54.169703+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2017-06-28T17_18_54_163Z-debug.log
我的 package.json,我在网上看到这可能是问题所在
<!-- language: lang-js -->
{
"name": "juego-cartas-reactjs",
"version": "0.1.0",
"main":"src/index.js",
"dependencies": {
"font-awesome": "^4.7.0",
"lodash.shuffle": "^4.2.0",
"react": "^15.6.1",
"react-dom": "^15.6.1",
"react-flipcard": "^0.2.1"
},
"devDependencies": {
"react-scripts": "1.0.7"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
我不知道该怎么办,如果有人对此有所了解,请帮助
【问题讨论】:
-
您是否在服务器上运行了
npm install以确保react-scripts存在?看起来这就是它失败的地方。 -
你的意思是在我的 heroku 项目应用程序的控制台中?
-
没错!查看their docs 以获得更多帮助。
-
我认为这不是问题,因为我在我的应用程序中运行 npm start,它可以正常工作
-
是的,因为您已在本地安装了所有依赖项。执行此操作,进入您的应用程序并删除
node_modules文件夹。然后运行npm start,你应该得到同样的错误。然后,运行npm install,然后运行npm start,它应该会再次开始工作。无论应用在哪里运行,都需要下载并安装依赖项。
标签: javascript node.js reactjs heroku