问题描述
对于客户项目,我们需要使用其他节点版本,因此我安装了NVM。每当我现在要将此应用程序部署到heroku(git push heroku master
)时,都会出现一个错误,即找不到要全局安装的shelljs模块。
remote: Error: Cannot find module 'shelljs/global'
remote: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
remote: at Function.Module._load (internal/modules/cjs/loader.js:562:25)
remote: at Module.require (internal/modules/cjs/loader.js:692:17)
remote: at require (internal/modules/cjs/helpers.js:25:18)
remote: at Object.<anonymous> (/tmp/build_5b7dbe9d/build/build.js:3:1)
remote: at Module._compile (internal/modules/cjs/loader.js:778:30)
remote: at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
remote: at Module.load (internal/modules/cjs/loader.js:653:32)
remote: at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
remote: at Function.Module._load (internal/modules/cjs/loader.js:585:3)
我已经重新安装了模块,但是还没有运气。我检查了一下,我的$ NODE_PATH为空,但是我在〜/ .bash_rc中添加了正确的行并重新加载了它,现在它确实可以正确显示了。
npm root -g
/Users/jan/.nvm/versions/node/v10.22.0/lib/node_modules
echo $NODE_PATH
/Users/jan/.nvm/versions/node/v10.22.0/lib/node_modules
nvm which current
/Users/jan/.nvm/versions/node/v10.22.0/bin/node
npm -v
6.14.6
node -v
v10.22.0
有人知道如何解决此问题吗?
编辑: 我设法通过将NPM CONfig PRODUCTION设置为false来临时修复它
heroku config:set NPM_CONfig_PRODUCTION=false
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)