angular – Heroku部署错误:“找不到名称’require’.”

前端之家收集整理的这篇文章主要介绍了angular – Heroku部署错误:“找不到名称’require’.”前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
将基于Angular 2 Node的应用程序部署到Heroku会触发此错误

94% asset optimizationError in bail mode: [default] /tmp/build_47b0228d68fca7157f36b354e7868841/src/app/account/account-list.component.ts:13:12
remote:        Cannot find name 'require'.
remote:        
remote:        npm ERR! Linux 3.13.0-100-generic
remote:        npm ERR! argv "/tmp/build_47b0228d68fca7157f36b354e7868841/.heroku/node/bin/node" "/tmp/build_47b0228d68fca7157f36b354e7868841/.heroku/node/bin/npm" "install" "--unsafe-perm" "--userconfig" "/tmp/build_47b0228d68fca7157f36b354e7868841/.npmrc"
remote:        npm ERR! node v6.6.0
remote:        npm ERR! npm  v3.10.8
remote:        npm ERR! code ELIFECYCLE
remote:        npm ERR! fm-ui@2.0.0-alpha.6 postinstall: `ng build -prod`
remote:        npm ERR! Exit status 1

解决方法

将@ types / node添加为应用程序依赖项:

npm install @types/node --save

为了无错误地编译应用程序,Heroku需要Node类型依赖;将它作为开发依赖项是不够的.

有关相关信息,请参见typescript getting error TS2304: cannot find name ‘ require’.

猜你在找的Angularjs相关文章