我使用ng new project
命令生成了我的angualr2应用程序,现在我正在尝试将我的项目放在heroku上,不幸的是,当我用git push heroku master
推送代码时遇到错误:
Counting objects: 65, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (62/62), done.
Writing objects: 100% (65/65), 363.09 KiB | 0 bytes/s, done.
Total 65 (delta 5), 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: NPM_CONFIG_PRODUCTION=true
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): unspecified
remote: engines.npm (package.json): unspecified (use default)
remote:
remote: Resolving node version (latest stable) via semver.io...
remote: Downloading and installing node 5.11.1...
remote: Using default npm version: 3.8.6
remote:
remote: -----> Restoring cache
remote: Skipping cache restore (new runtime signature)
remote:
remote: -----> Building dependencies
remote: Installing node modules (package.json)
remote:
remote: > qminder@0.0.0 postinstall /tmp/build_a0673d10d05036142a147f64099bd6fb
remote: > typings install
remote:
remote: sh: 1: typings: not found
remote:
remote: npm ERR! Linux 3.13.0-91-generic
remote: npm ERR! argv "/tmp/build_a0673d10d05036142a147f64099bd6fb/.heroku/node/bin/node" "/tmp/build_a0673d10d05036142a147f64099bd6fb/.heroku/node/bin/npm" "install" "--unsafe-perm" "--userconfig" "/tmp/build_a0673d10d05036142a147f64099bd6fb/.npmrc"
remote: npm ERR! node v5.11.1
remote: npm ERR! npm v3.8.6
remote: npm ERR! file sh
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno ENOENT
remote: npm ERR! syscall spawn
remote: npm ERR! qminder@0.0.0 postinstall: `typings install`
remote: npm ERR! spawn ENOENT
remote: npm ERR!
remote: npm ERR! Failed at the qminder@0.0.0 postinstall script 'typings install'.
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 qminder package,
remote: npm ERR! not with npm itself.
remote: npm ERR! Tell the author that this fails on your system:
remote: npm ERR! typings install
remote: npm ERR! You can get information on how to open an issue for this project with:
remote: npm ERR! npm bugs qminder
remote: npm ERR! Or if that isn't available, you can get their info via:
remote: npm ERR! npm owner ls qminder
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_a0673d10d05036142a147f64099bd6fb/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: Some possible problems:
remote:
remote: - Node version not specified in package.json
remote: https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
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 easy-instagram.
remote:
To https://git.heroku.com/easy-instagram.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/easy-instagram.git'
那么,我可以添加到项目中以解决此问题吗?
我已经将节点版本手动添加到我的config.json文件中,但它仍然抱怨同样的错误:
"devDependencies": {
"angular-cli": "1.0.0-beta.10",
"codelyzer": "0.0.20",
"ember-cli-inject-live-reload": "1.4.0",
"jasmine-core": "2.4.1",
"jasmine-spec-reporter": "2.5.0",
"karma": "0.13.22",
"karma-chrome-launcher": "0.2.3",
"karma-jasmine": "0.3.8",
"protractor": "3.3.0",
"ts-node": "0.5.5",
"tslint": "3.11.0",
"typescript": "1.8.10",
"typings": "1.3.1",
"node":"4.4.0"
}
答案 0 :(得分:0)
看起来像 Heroku 没有安装devDependencies
如何解决它有两种可能的变体:
typings
内移动dependencies
: "dependencies": {
...
"typings": "^2.1.0",
...
OR
NPM_CONFIG_PRODUCTION
需要设置为false
Heroku 才能安装devDependencies