【问题标题】:Webpack error when deploying to heroku (npm Exit Status 2)部署到 Heroku 时出现 Webpack 错误(npm 退出状态 2)
【发布时间】:2018-06-07 03:08:20
【问题描述】:

我和我的队友正在尝试部署到 Heroku,但我们已经多次遇到这种令人困惑的错误/构建失败。

我们已经解决的问题包括:

  1. 确保 devDependencies 在 Dependencies 中
  2. 已删除并重新安装 Wepback
  3. 已删除锁定文件
  4. 清除了 npm 缓存
  5. 创建了一个新的 heroku 应用程序并尝试从新开始在那里部署

这些都不起作用,我们非常感谢您的帮助。谢谢!

    remote: -----> Building dependencies
    remote:        Installing node modules (package.json + package-lock)
    remote:
    remote:        > sensation-mapping@0.0.1 postinstall /tmp/build_165cca2bcbc98089b28e7f67a5aa96ab
    remote:        > webpack
    remote:
    remote:        Hash: be40b95d0b5157875598
    remote:        Version: webpack 3.12.0
    remote:        Time: 1767ms
    remote:        Asset    Size  Chunks                    Chunk Names
    remote:        bundle.js  801 kB       0  [emitted]  [big]  main
    remote:        bundle.js.map  943 kB       0  [emitted]         main
    remote:        [12] ./client/index.js 543 bytes {0} [built]
    remote:        + 24 hidden modules
    remote:
    remote:        ERROR in ./client/index.js
    remote:        Module not found: Error: Can't resolve './components/App' in '/tmp/build_165cca2bcbc98089b28e7f67a5aa96ab/client'
    remote:        @ ./client/index.js 11:11-38
    remote:        npm ERR! code ELIFECYCLE
    remote:        npm ERR! errno 2
    remote:        npm ERR! sensation-mapping@0.0.1 postinstall: `webpack`
    remote:        npm ERR! Exit status 2
    remote:        npm ERR!
    remote:        npm ERR! Failed at the sensation-mapping@0.0.1 postinstall script.
    remote:        npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
    remote:
    remote:        npm ERR! A complete log of this run can be found in:
    remote:        npm ERR!     /tmp/npmcache.6UwNM/_logs/2018-06-07T02_48_08_002Z-debug.log
    remote:
    remote: -----> Build failed

【问题讨论】:

    标签: heroku


    【解决方案1】:

    您可以尝试解决问题的方法:

    1. 检查日志是否有任何问题。
    2. 检查代码中是否存在对可能被调用但不存在的模块的任何缺失引用。
    3. 完成上述步骤后,再次尝试构建,看看会发生什么。

    【讨论】:

      猜你喜欢
      • 2018-03-11
      • 1970-01-01
      • 2013-03-02
      • 2017-12-18
      • 2014-11-09
      • 1970-01-01
      • 2020-11-27
      • 1970-01-01
      • 2021-09-10
      相关资源
      最近更新 更多