将Angular App(NodeJS)部署到Heroku时出错

时间:2018-03-06 05:17:43

标签: node.js angular twitter-bootstrap heroku bootstrap-4

我目前正在开发angular5应用,需要将其部署到Heroku。 此应用使用NodeJS投放。

登录Heroku后,我创建了新的应用:

heroku create angular-vbnmc

成功,现在我可以毫无问题地打开https://angular-vbnmc.herokuapp.com/但仍然内容为空白,请参见下图: enter image description here

然后我使用以下命令部署我的应用

git push heroku newFeatureBranch:master

注意:我没有推送master分支,而是将newFeatureBranch推送到远程heroku的{​​{1}}分支

我收到了以下错误

master

有关其他信息,请参阅我的Counting objects: 219, done. Delta compression using up to 4 threads. Compressing objects: 100% (208/208), done. Writing objects: 100% (219/219), 122.63 KiB | 3.50 MiB/s, done. Total 219 (delta 111), reused 0 (delta 0) remote: Compressing source files... done. remote: Building source: remote: remote: -----> Node.js app detected remote: remote: -----> Creating runtime environment remote: remote: NPM_CONFIG_LOGLEVEL=error remote: NODE_VERBOSE=false remote: NODE_ENV=production remote: NODE_MODULES_CACHE=true remote: remote: -----> Installing binaries remote: engines.node (package.json): 8.9.4 remote: engines.npm (package.json): 5.6.0 remote: remote: Resolving node version 8.9.4... remote: Downloading and installing node 8.9.4... remote: npm 5.6.0 already installed with node remote: remote: -----> Restoring cache remote: Skipping cache restore (not-found) remote: remote: -----> Building dependencies remote: Prebuild detected (node_modules already exists) remote: Rebuilding any native modules remote: bootstrap@4.0.0 /tmp/build_61c2abaea4d9525f4aeb3f08e81769a2/node_modules/bootstrap remote: Installing any new modules (package.json) remote: remote: > uws@0.14.5 install /tmp/build_61c2abaea4d9525f4aeb3f08e81769a2/node_modules/uws remote: > node-gyp rebuild > build_log.txt 2>&1 || exit 0 remote: remote: remote: > node-sass@4.7.2 install /tmp/build_61c2abaea4d9525f4aeb3f08e81769a2/node_modules/node-sass remote: > node scripts/install.js remote: remote: Downloading binary from https://github.com/sass/node-sass/releases/download/v4.7.2/linux-x64-57_binding.node remote: Download complete remote: Binary saved to /tmp/build_61c2abaea4d9525f4aeb3f08e81769a2/node_modules/node-sass/vendor/linux-x64-57/binding.node remote: Caching binary to /tmp/npmcache.ShxWb/node-sass/4.7.2/linux-x64-57_binding.node remote: remote: > uglifyjs-webpack-plugin@0.4.6 postinstall /tmp/build_61c2abaea4d9525f4aeb3f08e81769a2/node_modules/webpack/node_modules/uglifyjs-webpack-plugin remote: > node lib/post_install.js remote: remote: remote: > node-sass@4.7.2 postinstall /tmp/build_61c2abaea4d9525f4aeb3f08e81769a2/node_modules/node-sass remote: > node scripts/build.js remote: remote: Binary found at /tmp/build_61c2abaea4d9525f4aeb3f08e81769a2/node_modules/node-sass/vendor/linux-x64-57/binding.node remote: Testing binary remote: Binary is fine remote: remote: > angular-vbnmc@0.0.0 postinstall /tmp/build_61c2abaea4d9525f4aeb3f08e81769a2 remote: > ng build --prod remote: remote: remote: An error occured during the build: remote: Error: ENOENT: no such file or directory, open '/tmp/build_61c2abaea4d9525f4aeb3f08e81769a2/node_modules/bootstrap/dist/js/bootstrap.min.js' remote: ENOENT: no such file or directory, open '/tmp/build_61c2abaea4d9525f4aeb3f08e81769a2/node_modules/bootstrap/dist/js/bootstrap.min.js' remote: Error: ENOENT: no such file or directory, open '/tmp/build_61c2abaea4d9525f4aeb3f08e81769a2/node_modules/bootstrap/dist/js/bootstrap.min.js' remote: npm ERR! code ELIFECYCLE remote: npm ERR! errno 1 remote: npm ERR! angular-vbnmc@0.0.0 postinstall: `ng build --prod` remote: npm ERR! Exit status 1 remote: npm ERR! remote: npm ERR! Failed at the angular-vbnmc@0.0.0 postinstall script. remote: npm ERR! This is probably not a problem with npm. There is likely additional logging output above. remote: remote: npm ERR! A complete log of this run can be found in: remote: npm ERR! /tmp/npmcache.ShxWb/_logs/2018-03-06T04_54_08_334Z-debug.log remote: remote: -----> Build failed remote: remote: We're sorry this build is failing! You can troubleshoot common issues here: remote: https://devcenter.heroku.com/articles/troubleshooting-node-deploys remote: remote: Some possible problems: remote: remote: - node_modules checked into source control remote: https://blog.heroku.com/node-habits-2016#9-only-git-the-important-bits remote: remote: Love, remote: Heroku remote: remote: ! Push rejected, failed to compile Node.js app. remote: remote: ! Push failed remote: Verifying deploy... remote: remote: ! Push rejected to angular-vbnmc. remote: To https://git.heroku.com/angular-vbnmc.git ! [remote rejected] 12-Deployment -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/angular-vbnmc.git'

package.json

为什么会发生这种情况?和如何来修复此错误?

0 个答案:

没有答案