2016-12-14 6 views
-1

JetBrain Webstrom을 사용하여 NodeJS 응용 프로그램을 만들었으므로 이제이를 heroku에 배포하고 싶습니다.Heroku에서 NodeJS 응용 프로그램을 배포 할 수 없습니다.

This image contains my app directory

나는 응용 프로그램을 배포 할 node_modules을 제거해야 하는가? 또는 package.json 아래에 "엔진"섹션을 추가해야합니까? heroku에서 내 앱이 제대로 배포되도록하려면 어떻게해야합니까? 앱을 추진하면서

{ 
    "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" 
    } 
} 

로그 :

내 애플의 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

를 추가해보십시오이 당신의 package.json에 :

"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. 
관련 문제