2017-08-02 76 views
0

我收到此錯誤,同時我上傳ng項目。當我在本地時,它會罰款。當我將它上傳到Heruku時,我得到這個錯誤。Heruku部署錯誤角度

-----> Node.js app detected 
-----> Creating runtime environment 

     NPM_CONFIG_LOGLEVEL=error 
     NPM_CONFIG_PRODUCTION=true 
     NODE_VERBOSE=false 
     NODE_ENV=production 
     NODE_MODULES_CACHE=true 
-----> Installing binaries 
     engines.node (package.json): 8.1.4 
     engines.npm (package.json): unspecified (use default) 

     Resolving node version 8.1.4... 
     Downloading and installing node 8.1.4... 
     Detected package-lock.json: defaulting npm to version 5.x.x 
     Bootstrapping npm 5.x.x (replacing 5.0.3)... 
     npm 5.3.0 installed 
-----> Restoring cache 
     Skipping cache restore (not-found) 
-----> Building dependencies 
     Installing node modules (package.json + package-lock) 

     > [email protected] preinstall /tmp/build_69fc13367426455c989d318ff32b98f2 
     > npm install -g http-server 

     /tmp/build_69fc13367426455c989d318ff32b98f2/.heroku/node/bin/http-server -> /tmp/build_69fc13367426455c989d318ff32b98f2/.heroku/node/lib/node_modules/http-server/bin/http-server 
     /tmp/build_69fc13367426455c989d318ff32b98f2/.heroku/node/bin/hs -> /tmp/build_69fc13367426455c989d318ff32b98f2/.heroku/node/lib/node_modules/http-server/bin/http-server 
     + [email protected] 
     added 23 packages in 2.902s 

     > [email protected] postinstall /tmp/build_69fc13367426455c989d318ff32b98f2 
     > ng build --aot -prod 

     sh: 1: ng: not found 
     npm ERR! file sh 
     npm ERR! code ELIFECYCLE 
     npm ERR! errno ENOENT 
     npm ERR! syscall spawn 
     npm ERR! [email protected] postinstall: `ng build --aot -prod` 
     npm ERR! spawn ENOENT 
     npm ERR! 
     npm ERR! Failed at the [email protected] postinstall script. 
     npm ERR! This is probably not a problem with npm. There is likely additional logging output above. 

     npm ERR! A complete log of this run can be found in: 
     npm ERR!  /app/.npm/_logs/2017-08-02T03_59_17_505Z-debug.log 
-----> Build failed 

     We're sorry this build is failing! You can troubleshoot common issues here: 
     https://devcenter.heroku.com/articles/troubleshooting-node-deploys 

     If you're stuck, please submit a ticket so we can help: 
     https://help.heroku.com/ 

     Love, 
     Heroku 

!  Push rejected, failed to compile Node.js app. 
!  Push failed 

可能是什麼問題?

這裏是我的package.json

{ 
    "name": "", 
    "version": "0.0.0", 
    "license": "MIT", 
    "engines": { 
    "node": "8.1.4" 
    }, 
    "angular-cli": {}, 
    "scripts": { 
    "ng": "ng", 
    "start": "http-server", 
    "lint": "tslint \"src/**/ *.ts\"", 
    "test": "ng test", 
    "pree2e": "webdriver-manager update", 
    "e2e": "protractor", 
    "preinstall": "npm install -g http-server", 
    "postinstall": "ng build --aot -prod", 
    "start-dev": "ng serve" 
    }, 
    "private": true, 
    "dependencies": { 
    "@angular/animations": "^4.3.2", 
    "@angular/common": "^4.3.2", 
    "@angular/compiler": "^4.3.2", 
    "@angular/compiler-cli": "^4.3.2", 
    "@angular/core": "^4.3.2", 
    "@angular/forms": "^4.3.2", 
    "@angular/http": "^4.3.2", 
    "@angular/material": "2.0.0-beta.2", 
    "@angular/platform-browser": "^4.3.2", 
    "@angular/platform-browser-dynamic": "^4.3.2", 
    "@angular/platform-server": "^4.3.2", 
    "@angular/router": "^4.3.2", 
    "@angular/tsc-wrapped": "^0.5.0", 
    "@ngrx/core": "^1.2.0", 
    "@ngrx/store": "^2.2.2", 
    "angular2-datatable": "0.6.0", 
    "angular2-google-maps": "0.17.0", 
    "core-js": "2.4.1", 
    "express": "^4.15.3", 
    "hammerjs": "^2.0.8", 
    "install": "^0.10.1", 
    "ng2-img-cropper": "0.8.0", 
    "npm": "^5.0.3", 
    "rxjs": "^5.4.2", 
    "typescript": "^2.4.2", 
    "zone.js": "0.7.6" 
    }, 
    "devDependencies": { 
    "@angular/cli": "^1.2.6", 
    "@types/hammerjs": "^2.0.34", 
    "@types/jasmine": "2.5.38", 
    "@types/node": "6.0.60", 
    "codelyzer": "2.0.0-beta.4", 
    "jasmine-core": "2.5.2", 
    "jasmine-spec-reporter": "3.2.0", 
    "karma": "1.4.1", 
    "karma-chrome-launcher": "2.0.0", 
    "karma-cli": "1.0.1", 
    "karma-coverage-istanbul-reporter": "0.2.0", 
    "karma-jasmine": "1.1.0", 
    "karma-jasmine-html-reporter": "0.2.2", 
    "ngrx-store-freeze": "^0.1.9", 
    "protractor": "5.1.0", 
    "ts-node": "2.0.0", 
    "tslint": "4.4.2" 
    } 
} 
+0

你能分享你的package.json嗎? – echonax

+0

你好,很抱歉,已經離線,我已經更新了package.json文件。 –

+0

你有沒有試過@ Alex的回答? – echonax

回答