3
我使用这里描述如何在Heroku中使用npm链接?
http://npmjs.org/doc/link.html
当地一切完美NPM链接。当我部署到Heroku时,我收到错误消息
Error: Cannot find module '...'
如何才能使用Heroku进行这项工作?
我使用这里描述如何在Heroku中使用npm链接?
http://npmjs.org/doc/link.html
当地一切完美NPM链接。当我部署到Heroku时,我收到错误消息
Error: Cannot find module '...'
如何才能使用Heroku进行这项工作?
我希望有一个优雅的解决方案(这会让我的生活变得更容易)。您的自定义软件包通过npm link
链接到node_modules
,但是git doesn't follow symbolic links nowadays。所以当你到Heroku的git push
,没有办法让你的自定义软件包顺风顺水。
但是,请注意,从我的实验中,Heroku会兑现您推入的任何node_modules,而不是尝试从网络安装它们。它基本上只运行npm install --production
。也许直接与你的软件包的开发源相关的硬链接可能会诀窍,但我不确定Git是否能够很好地与之搭配。使用需要您自担风险!
编辑:如果你想知道究竟是什么是Heroku做的,it's all open source。
理想的情况是将软件包(如果它们是开源的)打包到NPM本身。这是非常无痛和自动的。
这可能有助于http://stackoverflow.com/questions/5919629/express-module-not-found-when-installed-with-npm – Dhiraj