3

Deploying my Angular 2 Node-based application to Heroku triggered this error:

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! [email protected] postinstall: `ng build -prod`
remote:        npm ERR! Exit status 1

1 Answer 1

7

Add @types/node as an application dependency:

npm install @types/node --save

To compile the application without errors, Heroku needs the Node types dependency; it's not enough to have it as a development dependency.

See typescript getting error TS2304: cannot find name ' require' for related information.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.