2016-12-14 12 views
-1

JetBrain Webstromを使用してNodeJSアプリケーションを作成しました。これをherokuにデプロイしたいと思います。HerokuにNodeJS Appをデプロイできない

This image contains my app directory

私はアプリを展開するnode_modulesを削除すべきか? 、またはpackage.jsonの下に「engine」セクションを追加する必要がありますか? 私のアプリが英雄で正しく展開されるためにはどうすればよいですか?

マイアプリのpackage.json:

{ 
    "name": "form", 
    "version": "0.0.0", 
    "private": true, 
    "scripts": { 
    "start": "node ./bin/www" 
    }, 
    "dependencies": { 
    "body-parser": "~1.15.2", 
    "cookie-parser": "~1.4.3", 
    "debug": "~2.2.0", 
    "ejs": "~2.5.2", 
    "express": "~4.14.0", 
    "morgan": "~1.7.0", 
    "serve-favicon": "~2.3.0" 
    } 
} 

ログのApp押しながら:あなたのpackage.jsonにこれを追加すること

C:\Users\Adhik\formgp>git push heroku master 
Counting objects: 3, done. 
Delta compression using up to 8 threads. 
Compressing objects: 100% (2/2), done. 
Writing objects: 100% (3/3), 585 bytes | 0 bytes/s, done. 
Total 3 (delta 0), reused 3 (delta 0) 
remote: Compressing source files... done. 
remote: Building source: 
remote: 
remote: !  No default language could be detected for this app. 
remote:       HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically. 
remote:       See https://devcenter.heroku.com/articles/buildpacks 
remote: 
remote: !  Push failed 
remote: Verifying deploy... 
remote: 
remote: !  Push rejected to serene-bayou-91098. 
remote: 
To https://git.heroku.com/serene-bayou-91098.git 
! [remote rejected] master -> master (pre-receive hook declined) 
error: failed to push some refs to 'https://git.heroku.com/serene-bayou-91098.git' 
+0

エラーメッセージに記載されているURLに行ったことがありますか? 「アプリケーションにビルドパックを設定する」というセクションがあるものは? – ceejayoz

+0

うんうん。 このコマンドを使用してherokuアプリを変更しました heroku buildpacks:heroku/nodejsを設定 まだ展開できませんでした。 – Adhik

+0

ビルドパックの設定後にメッセージが変更されますか? – ceejayoz

答えて

2

試してみてください。

"engines": { 
    "node": "whatever_version_you_want" 
    } 

をあなたはいけませんnode_modulesをインストール/削除する必要があり、Herokuがそれを行う必要があります。

+0

'node_modules'はおそらく' .gitignore'にあるはずです。 – ceejayoz

2

エンジンがあなたのpackage.jsonに欠けているように思える:

"engines": { 
    "node": "6.7.0", 
    "npm": "3.10.3" 
    } 

もProcfileを展開することは役に立ちます。

web: node ./bin/www 

あなたはフォルダ全体を展開していますか?ログを確認してください:

Counting objects: 3, done. 
関連する問題