首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >尝试将react.js应用程序部署到heruko时出错

尝试将react.js应用程序部署到heruko时出错
EN

Stack Overflow用户
提问于 2019-07-08 11:53:21
回答 1查看 764关注 0票数 0

好的,所以我需要将我的react.js应用程序部署到heroku,但是它总是给我一个错误。

该应用采用纱线代替npm。应用程序构建在fuse反应模板之上。我已经将package.json中的引擎指定为纱线和节点,但它始终给我一个错误。请参阅下面的代码以获得更深层次的理解。

这是我的package.json文件

代码语言:javascript
复制
{
"name": "fuse-react-app",
"version": "3.1.0",
"private": true,
"engines": {
    "yarn": "1.15.2",
    "node": "10.16.0"
},
"dependencies": {
    "@date-io/date-fns": "1.3.7",
    "@material-ui/core": "4.1.3",
    "@material-ui/icons": "4.2.1",
    "@material-ui/pickers": "3.1.2",
    "@material-ui/styles": "4.1.2",
    "auth0-lock": "11.16.3",
    "autosuggest-highlight": "3.1.1",
    "axios": "0.19.0",
    "axios-mock-adapter": "1.16.0",
    "chart.js": "2.8.0",
    "date-fns": "2.0.0-beta.1",
    "downshift": "3.2.10",
    "firebase": "6.2.3",
    "formsy-react": "1.1.5",
    "google-map-react": "1.1.4",
    "jsonwebtoken": "8.5.1",
    "jss": "10.0.0-alpha.21",
    "jss-extend": "6.2.0",
    "jwt-decode": "2.2.0",
    "keycode": "2.2.0",
    "lodash": "4.17.11",
    "material-table": "1.40.0",
    "material-ui-popup-state": "1.4.0",
    "mobile-detect": "1.4.3",
    "moment": "2.24.0",
    "notistack": "0.8.7",
    "path-to-regexp": "3.0.0",
    "perfect-scrollbar": "1.4.0",
    "prismjs": "1.16.0",
    "qs": "6.7.0",
    "raw-loader": "1.0.0",
    "react": "16.8.6",
    "react-autosuggest": "9.4.3",
    "react-beautiful-dnd": "11.0.4",
    "react-big-calendar": "0.22.0",
    "react-chartjs-2": "2.7.6",
    "react-dom": "16.8.6",
    "react-draggable": "3.3.0",
    "react-frame-component": "4.1.0",
    "react-masonry-css": "1.0.12",
    "react-number-format": "4.0.8",
    "react-popper": "1.3.3",
    "react-redux": "7.1.0",
    "react-router-config": "5.0.1",
    "react-router-dom": "5.0.1",
    "react-scripts": "3.0.1",
    "react-select": "2.4.4",
    "react-swipeable-views": "0.13.3",
    "react-table": "6.10.0",
    "react-text-mask": "5.4.3",
    "react-virtualized": "9.21.1",
    "react-window": "1.8.3",
    "redux": "4.0.1",
    "redux-thunk": "2.3.0",
    "typeface-muli": "0.0.71",
    "velocity-react": "1.4.3"
},
"resolutions": {
    "react": "16.8.6",
    "react-dom": "16.8.6"
},
"devDependencies": {
    "@babel/core": "7.4.5",
    "@babel/node": "7.4.5",
    "@babel/preset-env": "7.4.5",
    "cross-env": "5.2.0",
    "globby": "9.2.0",
    "js-beautify": "1.10.0",
    "marked": "0.6.2",
    "purgecss": "1.3.0",
    "tailwindcss": "1.0.4",
    "webpack-bundle-analyzer": "3.3.2"
},
"scripts": {
    "start": "yarn run tailwind && react-scripts start",
    "build": "yarn run tailwind && node ./purge-tailwindcss.js && cross-env GENERATE_SOURCEMAP=false react-scripts build",
    "tailwind": "./node_modules/.bin/tailwind build ./src/styles/tailwind.base.css -c ./tailwind.js -o ./src/styles/tailwind.css",
    "test": "react-scripts test --env=node",
    "eject": "react-scripts eject",
    "build-docs": "find ./src/app/main/documentation/material-ui-components \\( -name '*.ts' -o -name '*.tsx' \\) -type f -delete && babel-node src/app/main/documentation/material-ui-components/build.js",
    "build-stats": "yarn run build --stats",
    "bundle-report": "yarn run build-stats && webpack-bundle-analyzer build/bundle-stats.json -m static -r build/bundle-stats.html -O"
},
"eslintConfig": {
    "extends": "react-app"
},
"browserslist": {
    "production": [
        ">0.2%",
        "not dead",
        "not op_mini all"
    ],
    "development": [
        "last 1 chrome version",
        "last 1 firefox version",
        "last 1 safari version",
        "ie 11"
    ]
 }
}

这就是我在heroku上遇到的错误:

2019-07-08T11:25:56.852293+00:00appweb.1: npm错误!产卵ENOENT 2019-07-08T11:25:56.852517+00:00应用程序1: npm错误!2019-07-08T11:25:56.852647+00:00应用程序1: npm错误!在fuse-react app@3.1.0启动脚本中失败。2019-07-08T11:25:56.852779+00:00appweb.1: npm错误!这可能不是npm的问题。上面可能还有额外的日志输出。2019-07-08T11:25:56.860485+00:00appweb.1:2019-07-08T11:25:56.860724+00:00appweb.1: npm错误!此运行的完整日志可在: 2019-07-08T11:25:56.860877+00:00 appweb.1: npm ERR!/app/.npm/_logs/2019-07-08T11_25_56_854Z-debug.log 2019-07-08T11:25:56.921581+00:00 herokuweb.1:状态1退出的进程中找到。

它说它正在尝试运行国家预防机制。但是应用程序不使用npm。希望你们能帮我..。

EN

回答 1

Stack Overflow用户

发布于 2019-07-08 14:20:39

为了将fuse反应模板部署到heroku,您需要完成几个额外的步骤,以确保正确安装了您的开发人员依赖项。

以下是直接从他们提供的Readme.txt文件中获得的必要步骤:

HEROKU笔记

如果您想对heroku部署fuse- encounter,您可能会遇到一些问题,以下是解决方案:

  1. 禁用生产模式以安装devDependencies: heroku config:set NPM_CONFIG_PRODUCTION=false
  2. 将您的分支推到Heroku的主分支: git push heroku <branch>:master

希望这能帮上忙!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56934355

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档