【发布时间】:2023-04-05 02:01:01
【问题描述】:
我想将 angular2/nodejs 应用程序部署到 heroku。
版本: “节点”:“8.x”,“npm”:“3.10.9”
配置完成后出现此错误:
> "/tmp/build_a3ccb3e805890c0441cf2241d8620683/.heroku/node/bin/npm"
> "run" "heroku-postbuild" "--if-present"
> remote: npm ERR! node v8.5.0
> remote: npm ERR! npm v3.10.9
> remote: npm ERR! code ELIFECYCLE
> remote: npm ERR! lists-book@0.0.1 heroku-postbuild: `ng build`
> remote: npm ERR! Exit status 1
> remote: npm ERR!
> remote: npm ERR! Failed at the lists-book@0.0.1 heroku-postbuild script 'ng build'.
> 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 lists-book 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
> remote: npm ERR! You can get information on how to open an issue for this project with:
> remote: npm ERR! npm bugs lists-book
> remote: npm ERR! Or if that isn't available, you can get their info via:
> remote: npm ERR! npm owner ls lists-book
> remote: npm ERR! There is likely additional logging output above.
我多次更改此行但仍然出现相同的错误,并且它不起作用:
“heroku-postbuild”:“ng build”,或“heroku-postbuild”:“ng build --env=prod --aot=false”,或“heroku-postbuild”:“ng build --aot -产品”
我的 package.json 的一部分
"angular-cli": {},
"scripts": {
"ng": "ng",
"start": "node server.js",
"test": "ng test",
"pree2e": "webdriver-manager update --standalone false --gecko false",
"e2e": "protractor",
"heroku-postbuild": "ng build",
"build_prod": "npm run build && browserify -s main dist/main.js > dist/bundle.js && npm run minify",
"minify": "uglifyjs dist/inline.bundle.js --screw-ie8 --compress --mangle --output dist/inline.bundle.js; uglifyjs dist/main.bundle.js --screw-ie8 --compress --mangle --output dist/main.bundle.js; uglifyjs dist/styles.bundle.js --screw-ie8 --compress --mangle --output dist/styles.bundle.js; uglifyjs dist/polyfills.bundle.js --screw-ie8 --compress --mangle --output dist/polyfills.bundle.js; uglifyjs dist/vendor.bundle.js --screw-ie8 --compress --mangle --output dist/vendor.bundle.js; json-minify src/assets/translations/pl.json > dist/assets/translations/pl.json; json-minify src/assets/translations/en.json > dist/assets/translations/en.json; json-minify src/assets/translations/es.json > dist/assets/translations/es.json"
}
【问题讨论】:
标签: javascript angularjs node.js ubuntu heroku