javascript - 我无法在 Heroku 中运行我的 ReactJS 应用程序

标签 javascript node.js reactjs heroku

当我运行 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 start 用于本地开发。你不应该在 Heroku 上使用它。

将 Create React App 项目部署到 Heroku follow Heroku's official guide to it

cd my-app
git init
heroku create -b https://github.com/mars/create-react-app-buildpack.git
git add .
git commit -m "react-create-app on Heroku"
git push heroku master
heroku open

本文链接自Deployment section of the User Guide随您创建的应用程序一起提供。我建议在那里寻找可能的答案。

关于javascript - 我无法在 Heroku 中运行我的 ReactJS 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44808972/

相关文章:

javascript - 当我需要传递参数时,JSX Props 中没有 .bind() 或箭头函数对我来说毫无意义

javascript - 异步操作未运行 Async React Redux Thunk

javascript - CSS 裁剪图像以适应屏幕宽度,同时保持图像的原始高度

javascript - 意外的 NodeJS 和 NPM 行为

Javascript: style.display ="none"不工作而 style.display ="visible"工作

node.js - 我如何在 Node.JS 中执行多个查询(构建数据库)?

mysql - Knex NodeJS 并插入数据库

reactjs - 针对未经授权的页面使用react路由器配置

javascript - 将 Angular Promise 与 ng-show 一起使用

javascript - 通过更好的排序加速 MongoDB find()? (使用 Mongoose orm)