Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js Heroku无法构建Angular2应用程序_Node.js_Heroku_Angular - Fatal编程技术网

Node.js Heroku无法构建Angular2应用程序

Node.js Heroku无法构建Angular2应用程序,node.js,heroku,angular,Node.js,Heroku,Angular,我使用angular2 cli创建了angular2应用程序。 接下来我要构建它并部署到heroku,所以我更新了package.json文件中的脚本部分: "scripts": { "heroku-prebuild": "npm install angular-cli@1.0.0-beta.17", "postinstall": "./node_modules/.bin/ng build --dev" } 当我在本地计算机上运行npm install时,应用程序生成没有错误。当我使用

我使用angular2 cli创建了angular2应用程序。 接下来我要构建它并部署到heroku,所以我更新了
package.json
文件中的脚本部分:

"scripts": {
  "heroku-prebuild": "npm install angular-cli@1.0.0-beta.17",
  "postinstall": "./node_modules/.bin/ng build --dev"
}
当我在本地计算机上运行
npm install
时,应用程序生成没有错误。当我使用bitbucket管道运行它时也是如此,但当我尝试将它部署到heroku构建时失败

这是信息的一部分:

  0ms additional asset processing
  1922ms chunk asset optimization
   94% asset optimizationError in bail mode: [default] /tmp/build_c10a47380f869e4f82169d259a47dab7/src/app/app.component.ts:5:12
  remote:        Cannot find name 'require'.
  remote:        
  remote:        npm ERR! Linux 3.13.0-95-generic
  remote:        npm ERR! argv "/tmp/build_c10a47380f869e4f82169d259a47dab7/.heroku/node/bin/node" "/tmp/build_c10a47380f869e4f82169d259a47dab7/.heroku/node/bin/npm" "install" "--unsafe-perm" "--userconfig" "/tmp/build_c10a47380f869e4f82169d259a47dab7/.npmrc"
  remote:        npm ERR! node v6.1.0
  remote:        npm ERR! npm  v3.8.9
  remote:        npm ERR! code ELIFECYCLE
  remote:        npm ERR! xxxxxx@0.0.0 postinstall: `ng build --dev`
  remote:        npm ERR! Exit status 1
  remote:        npm ERR!
  remote:        npm ERR! Failed at the xxxxxx@0.0.0 postinstall script 'ng build --dev'.
  remote:        npm ERR! Make sure you have the latest version of node.js and npm installed.
  remote:        npm ERR! If you do, this is most likely a problem with the xxxxxx package,
  remote:        npm ERR! not with npm itself.
  remote:        npm ERR! Tell the author that this fails on your system:
  remote:        npm ERR!     ng build --dev
  remote:        npm ERR! You can get information on how to open an issue for this project with:
  remote:        npm ERR!     npm bugs xxxxxx
  remote:        npm ERR! Or if that isn't available, you can get their info via:
  remote:        npm ERR!     npm owner ls xxxxxx
  remote:        npm ERR! There is likely additional logging output above.
  remote:        
  remote:        npm ERR! Please include the following file with any support request:
  remote:        npm ERR!     /tmp/build_c10a47380f869e4f82169d259a47dab7/npm-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:        If you're stuck, please submit a ticket so we can help:
  remote:        https://help.heroku.com/
  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 xxxxxx.
  remote: 
你知道为什么heroku不能构建angular2应用程序吗? 如何解决这个问题