【问题标题】:ERROR WHILE DEPLOYING MERN APP ON HEROKU, node and npm version is fine在 HEROKU、node 和 npm 版本上部署 MERN 应用程序时出错
【发布时间】:2021-09-02 13:50:12
【问题描述】:

这是使用 mongodb 数据库的日志文件 前端位于根文件夹中,而后端位于后端文件夹中。 请帮我解决这个错误


sh: 1: run: not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! login@0.1.0 heroku-postbuild: `NPM_CONFIG_PRODUCTION=false npm install npm && run build`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the login@0.1.0 heroku-postbuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /tmp/npmcache.rKjZV/_logs/2021-06-17T18_12_28_684Z-debug.log
-----> Build failed
       
       We're sorry this build is failing! You can troubleshoot common issues here:
       https://devcenter.heroku.com/articles/troubleshooting-node-deploys
       
       If you're stuck, please submit a ticket so we can help:
       https://help.heroku.com/
       
       Love,
       Heroku
       
 !     Push rejected, failed to compile Node.js app.
 !     Push failed

```

【问题讨论】:

    标签: node.js reactjs heroku mern


    【解决方案1】:

    shell脚本NPM_CONFIG_PRODUCTION=false npm install npm && run build相当于:

    • NPM_CONFIG_PRODUCTION=false
    • npm install npm
    • run build

    我假设您打算运行npm run build,为此您需要将heroku-postbuild 设置为:NPM_CONFIG_PRODUCTION=false npm install npm && npm run build。注意&&之后添加的npm

    【讨论】:

      猜你喜欢
      • 2020-04-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-17
      • 1970-01-01
      • 2020-05-30
      • 2020-10-22
      • 2018-02-09
      相关资源
      最近更新 更多