簡體   English   中英

Heroku節點/ Angular:部署應用程序和服務器

[英]Heroku node / angular: deploy app and server

我有一個簡單的項目。 鏈接: https//github.com/Tyvain/BTCash

我在本地啟動它是這樣的:

npm install
cd BTCash/server/
node app.js
cd BTCash/
npm start

我在heroku中嘗試“ github部署”,但得到了:

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

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

   Resolving node version (latest stable) via semver.io...
   Downloading and installing node 6.9.1...
   Using default npm version: 3.10.8
-----> Restoring cache
   Skipping cache restore (new runtime signature)
-----> Building dependencies
   Installing node modules (package.json)

   > angular@1.0.0 postinstall /tmp/build_7594b95a41ba0663394176646f6e85f5/Tyvain-BTCash-9a16ec3
   > npm run typings install


   > angular@1.0.0 typings /tmp/build_7594b95a41ba0663394176646f6e85f5/Tyvain-BTCash-9a16ec3
   > typings "install"

   sh: 1: typings: not found

   npm ERR! Linux 3.13.0-100-generic
   npm ERR! argv "/tmp/build_7594b95a41ba0663394176646f6e85f5/Tyvain-BTCash-9a16ec3/.heroku/node/bin/node" "/tmp/build_7594b95a41ba0663394176646f6e85f5/Tyvain-BTCash-9a16ec3/.heroku/node/bin/npm" "run" "typings" "install"
   npm ERR! node v6.9.1
   npm ERR! npm  v3.10.8
   npm ERR! file sh
   npm ERR! code ELIFECYCLE
   npm ERR! errno ENOENT
   npm ERR! syscall spawn
   npm ERR! angular@1.0.0 typings: `typings "install"`
   npm ERR! spawn ENOENT
   npm ERR!
   npm ERR! Failed at the angular@1.0.0 typings script 'typings "install"'.
   npm ERR! Make sure you have the latest version of node.js and npm installed.
   npm ERR! If you do, this is most likely a problem with the angular package,
   npm ERR! not with npm itself.
   npm ERR! Tell the author that this fails on your system:
   npm ERR!     typings "install"
   npm ERR! You can get information on how to open an issue for this project with:
   npm ERR!     npm bugs angular
   npm ERR! Or if that isn't available, you can get their info via:
   npm ERR!     npm owner ls angular
   npm ERR! There is likely additional logging output above.

   npm ERR! Please include the following file with any support request:
   npm ERR!     /tmp/build_7594b95a41ba0663394176646f6e85f5/Tyvain-BTCash-9a16ec3/npm-debug.log

   npm ERR! Linux 3.13.0-100-generic
   npm ERR! argv "/tmp/build_7594b95a41ba0663394176646f6e85f5/Tyvain-BTCash-9a16ec3/.heroku/node/bin/node" "/tmp/build_7594b95a41ba0663394176646f6e85f5/Tyvain-BTCash-9a16ec3/.heroku/node/bin/npm" "install" "--unsafe-perm" "--userconfig" "/tmp/build_7594b95a41ba0663394176646f6e85f5/Tyvain-BTCash-9a16ec3/.npmrc"
   npm ERR! node v6.9.1
   npm ERR! npm  v3.10.8
   npm ERR! code ELIFECYCLE
   npm ERR! angular@1.0.0 postinstall: `npm run typings install`
   npm ERR! Exit status 1
   npm ERR!
   npm ERR! Failed at the angular@1.0.0 postinstall script 'npm run typings install'.
   npm ERR! Make sure you have the latest version of node.js and npm installed.
   npm ERR! If you do, this is most likely a problem with the angular package,
   npm ERR! not with npm itself.
   npm ERR! Tell the author that this fails on your system:
   npm ERR!     npm run typings install
   npm ERR! You can get information on how to open an issue for this project with:
   npm ERR!     npm bugs angular
   npm ERR! Or if that isn't available, you can get their info via:
   npm ERR!     npm owner ls angular
   npm ERR! There is likely additional logging output above.

   npm ERR! Please include the following file with any support request:
   npm ERR!     /tmp/build_7594b95a41ba0663394176646f6e85f5/Tyvain-BTCash-9a16ec3/npm-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

   Some possible problems:

   - Node version not specified in package.json
   https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version

   Love,
   Heroku

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

我應該如何在heroku上部署和啟動它? 我應該為此使用travis CI嗎?

NPM試圖運行npm run typings install后腳本,但typings包是你的devDependencies在版塊package.json

由於Heroku上的NODE_ENV設置為“生產”,因此將不會安裝這些軟件包,因此npm postinstall腳本將無法在Heroku上完成。

嘗試移動typingsdependencies中部分package.json

另外,請閱讀Heroku NodeJS開發文檔以獲取更多有用的信息。 例如,您實際上應該在package.json指定一個NodeJS和NPM版本。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM