質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Node.js

Node.jsとはGoogleのV8 JavaScriptエンジンを使用しているサーバーサイドのイベント駆動型プログラムです。

コマンドプロンプト

コマンドプロンプト(cmd.exe)はMicrosoftによって提供されているコマンドラインインタプリタです。OS/2・Windows CE・Windows NTで使用可能です。

Q&A

2回答

4042閲覧

herokuに作ったアプリがデプロイできない

Noz

総合スコア7

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Node.js

Node.jsとはGoogleのV8 JavaScriptエンジンを使用しているサーバーサイドのイベント駆動型プログラムです。

コマンドプロンプト

コマンドプロンプト(cmd.exe)はMicrosoftによって提供されているコマンドラインインタプリタです。OS/2・Windows CE・Windows NTで使用可能です。

0グッド

0クリップ

投稿2016/04/04 13:42

編集2022/01/12 10:55

Node.jsの勉強を始めたHeroku初心者のNozです。
Node.jsのコマンドプロンプトでherokuの開発環境を整えようと、以下の内容を入力しました。

cd Desktop/node.js-sample
node.js-sample>git init
Reinitialized existing Git repository in C:/User/○○/Desktop/node.js-sample/.git/

node.js-sample>heroku create voicechannel
heroku-cli: Adding dependencies... 2.57 MB/2.57 MB
heroku-cli: Updating plugins... done.Updated 8 packages.
Creating voicechannel... done, stack is ceder-14
https://voicechannel.herokuapp.com/ | https://git.heroku.com/voicechannel.git

node.js-sample>git add .

node.js-sample>git commit -m"comment"
Oh branch master
nothing to commit, working directory clean

node.js-sample>git push heroku master
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100%(3/3), done.
Writing objects: 100%(5/5), 623 bytes | 0 bytes/s, done.
Total 5 (delta 0), reused 0 (delta 0)

そしたら添付画像のようなエラー文が出てきてしまいました…
herokuのページを見るとアプリはつくれたようなのですが、ブラウザでそのアプリを見ると、sample.jsに記入した"hello world"が表示されません…
デプロイという作業が上手く出来ていないようなのですが、どうしたらいいのかが分かりません。
どなたか教えていただけると幸いです…。

追記:
画像が添付できなかったため、長文ですが、手入力で失礼致します。
エラー文は

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 sember.io...
remote: Downloading and installing node 5.10.0...
remote: Using default npm version: 3.8.3
remote:
remote: -----> Restoring cache
remote: Skipping cache restore (new runtime signature)
remote:
remote:-----> Building dependencies
remote: Pruning any extraneous modules
remote: npm ERR! Linux 3.13.0-79-generic
remote: npm ERR! argv "/tmp/build_2d60f87c237a688f98b4965fd1219aec/.heroku/node/bin/node" "/tmp/build_2d60f87c237a688f98b4965fd1219aec/.npmrc"
remote: npm ERR! node v5.10.0
remote: npm ERR! npm v3.8.3
remote:
remote: npm ERR! Invalid version: "0.01"
remote: npm ERR!
remote: npm ERR! If you need help, you may report this error at:
remote: npm ERR! https://github.com/npm/npm/issues
remote:
remote: npm ERR! Pleaseinclude the following file with any support recest:
remote: npm ERR! /tmp/build_2d60f87c237a688f98b4965fd1219aec/npm-debug.log
remote:
remote:-----> Build failed
remote:
remote: We're sorry this build is failing! You can troubleshoot common issues here:
remote:
remote: htpps://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:
remote: ! Push rejected, failed to compile Node.js app
remote:
remote: Verifying deploy...
remote:
remote: ! Push rejected to voicechannel .
remote:
To https://git.herou.com/voicechannel.git
![remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/voicechannel.git'

です。

また、
node.js-sample>var http = require('http');
と入力すると、
'var' は内部コマンドまたは外部コマンド、
操作可能なプログラムまたはバッチ ファイルとして認識されていません。
と返ってきます…

ご回答よろしくお願い致します。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

CHERRY

2016/04/09 14:10 編集

質問のメッセージだけであれば、エラーは出ていないように思います。 添付画像がないので、どのようなエラーメッセージが表示されているのか 書いていただけないでしょうか。
Noz

2016/04/10 01:54 編集

ありがとうございます。 質問本文に追加させていただきました。 ご回答お願い致します。
guest

回答2

0

herokuにnodeのアプリをアップする際の注意点として、幾つか挙げられます。

  • package.jsonにモジュールを追加する記述があるか。
  • package.jsonのmainはきちんと指定ファイル名が記述されているか
  • node_modulesは削除した状態でherokuにデプロイしているか
  • portはapp.set('port', process.env.PORT || 3000);のように環境変数のPORTを使えるようにしているか

nodeのアプリの時はこの辺りを確認しています。
これでそのまま解答につながるかはわかりませんが、参考ほどに。

投稿2016/05/23 01:06

konojunya

総合スコア34

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

Noz

2016/05/23 03:49

ありがとうございます! 確認してみます!
guest

0

質問文に追加していただいたエラー文の中に、以下のようなものがあります。

remote: npm ERR! Invalid version: "0.01"

どこかに、バージョンが "0.01" と書かれていて、これが問題になっているのかもしれません。もしそういうところがあったら、"0.0.1" に書き換えてみてください。

投稿2016/05/23 04:00

tatsuya6502

総合スコア2035

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問