Heroku + Node: Cannot find module error

后端 未结 6 575
没有蜡笔的小新
没有蜡笔的小新 2020-12-13 09:10

My Node app is running fine locally, but has run into an error when deploying to Heroku. The app uses Sequelize in a /models folder, which contains index.

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-13 09:36

    I've been through an error like this one and the cause was that I renamed a module module.js to Module.js and the Heroku cache was conflicting the names. You must disable module caching to avoid this kind of error:

    $ heroku config:set NODE_MODULES_CACHE=false
    

    Source: https://help.heroku.com/TO64O3OG/cannot-find-module-in-node-js-at-runtime

提交回复
热议问题