【问题标题】:Heroku build fails at npm install stage because of a deleted local package由于删除了本地包,Heroku 构建在 npm install 阶段失败
【发布时间】:2019-09-26 15:15:27
【问题描述】:

我可以在本地运行应用程序,但是 Heroku 构建日志给出了

-----> Installing dependencies
       Installing node modules (package.json + package-lock)
       npm ERR! path /tmp/build_f006003c37b56af35aede303d1931e45/node_modules/@domain/endpoints
       npm ERR! code ENOENT
       npm ERR! errno -2
       npm ERR! syscall access
       npm ERR! enoent ENOENT: no such file or directory, access '/tmp/build_f006003c37b56af35aede303d1931e45/node_modules/@domain/endpoints'
       npm ERR! enoent This is related to npm not being able to find a file.
       npm ERR! enoent 

       npm ERR! A complete log of this run can be found in:
       npm ERR!     /tmp/npmcache.iEXJN/_logs/2019-09-25T14_25_49_996Z-debug.log
-----> Build failed

如您所见,它抱怨“@domain/endpoints”不存在。但我删除了对“@domain/endpoints”的所有引用。那么为什么会这样呢?

部署通过从我们的 BitBucket 存储库上的开发分支到 Heroku 的管道进行。我检查了开发分支不包含对“@domain/endpoints”的引用。

“@domain”模块包含我们自己创建的包。

我的 package.json 文件可以在这里找到:https://pastebin.com/mB7LcvBH 我在顶部更改了名称,希望不会在其他地方造成任何不一致。

【问题讨论】:

  • 你能显示 package.json 文件吗?
  • @karthikdivi 完成 :)

标签: git heroku npm


【解决方案1】:

原来解决方案是清除构建缓存。

https://help.heroku.com/18PI5RSY/how-do-i-clear-the-build-cache

$ heroku plugins:install heroku-repo
$ heroku repo:purge_cache -a appname
$ git commit --allow-empty -m "Purge cache"
$ git push heroku master

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-08-11
    • 1970-01-01
    • 2021-05-08
    • 2016-03-27
    • 2012-12-01
    • 2015-02-24
    • 2023-03-05
    • 2022-11-01
    相关资源
    最近更新 更多