代码之家  ›  专栏  ›  技术社区  ›  tomerpacific

由于代码完整性,Heroku生成失败

  •  0
  • tomerpacific  · 技术社区  · 4 年前

    我不得不升级包锁中的一个依赖项。json/纱线。锁定文件,当尝试将其上载到Heroku时,我得到以下信息:

     Node.js app detected
     remote:
     remote: -----> Creating runtime environment
     remote:
     remote:        NPM_CONFIG_LOGLEVEL=error
     remote:        NODE_ENV=production
     remote:        NODE_MODULES_CACHE=true
     remote:        NODE_VERBOSE=false
     remote:
     remote: -----> Installing binaries
     remote:        engines.node (package.json):  10.15.x
     remote:        engines.npm (package.json):   6.14.x
     remote:
     remote:        Resolving node version 10.15.x...
     remote:        Downloading and installing node 10.15.3...
     remote:        Bootstrapping npm 6.14.x (replacing 6.4.1)...
     remote:        npm 6.14.x installed
     remote:
     remote: -----> Installing dependencies
     remote:        Installing node modules (package.json + package-lock)
     remote:        npm ERR! code EINTEGRITY
     remote:        npm ERR! sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= integrity checksum failed when using sha1: wanted sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= but got sha512-rIqbOrKb8GJmx/5bc2M0QchhUouMXSpd1RTclXsB41JdL+VtnojfaJR+h7F9k18/4kHUsBFgk80Uk+q569vjPA== sha1-sAoAIwoRCMSMFp5popGq/aOqzWM=. (7897 bytes)
     remote:
     remote:        npm ERR! A complete log of this run can be found in:
     remote:        npm ERR!     /tmp/npmcache.P3BnU/_logs/2020-03-18T06_17_36_985Z-debug.log
     remote:
     remote: -----> Build failed
     remote:
     remote:        We're sorry this build is failing! You can troubleshoot common issues here:
     remote:        https://devcenter.heroku.com/articles/troubleshooting-node-deploys
     remote:
     remote:        If you're stuck, please submit a ticket so we can help:
     remote:        https://help.heroku.com/
     remote:
     remote:        Love,
     remote:        Heroku
     remote:
     remote:  !     Push rejected, failed to compile Node.js app.
     remote:
     remote:  !     Push failed
    

    我意识到问题就在这一行:

    但我不知道为什么它现在发生,或者是什么触发了它(因为它以前没有发生过)。

    我试着在网上搜索 clearing the cache 阅读 Heroku's Node.js Troubleshooting ,将引擎密钥添加到我的包中。json文件来指定节点/npm版本,但什么都不起作用。

    我有 在我的开发环境中升级了Node/NPM,因此这些版本是相同的。

    0 回复  |  直到 4 年前
        1
  •  1
  •   tomerpacific    4 年前

    npm uninstall package_name

    然后:

    npm install package_name

    这似乎解决了这个问题。

        2
  •  1
  •   Stones    3 年前

    我只是删除了包锁。json和npm模块,然后运行npm安装。

        3
  •  0
  •   Ahmed Younes    3 年前

    可能你有npm漏洞,如果你不能全部修复 尝试升级包中的所有包。json

    npm install -g npm-check-updates

    然后

    ncu --upgrade

    然后

    npm install

        4
  •  0
  •   Estifanos Neway    2 年前

    简单:删除 package-lock.json npm install