在Heroku中部署NodeJS App后出现错误

时间:2017-09-03 08:38:08

标签: node.js mongodb angular heroku

我使用Angular和Mongodb创建了一个NodeJS应用程序,现在我想将它部署到heroku。我尝试了几次,但是我收到以下错误:

应用程序错误 应用程序中发生错误,无法提供您的页面。如果您是应用程序所有者,请检查日志以获取详细信息

https://drive.google.com/file/d/0BzQJQcY_Z3E8ckdmYlJQN1REVEU/view?usp=sharing

我的应用程序的package.json:

PS C:\Users\Aurora\desktop\reviews-hotel> git push heroku master
Counting objects: 105, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (91/91), done.
Writing objects: 100% (105/105), 3.80 MiB | 51.00 KiB/s, done.
Total 105 (delta 13), 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_VERBOSE=false
remote:        NODE_ENV=production
remote:        NODE_MODULES_CACHE=true
remote:
remote: -----> Installing binaries
remote:        engines.node (package.json):  8.2.1
remote:        engines.npm (package.json):   5.3.0
remote:
remote:        Resolving node version 8.2.1...
remote:        Downloading and installing node 8.2.1...
remote:        npm 5.3.0 already installed with node
remote:
remote: -----> Restoring cache
remote:        Skipping cache restore (not-found)
remote:
remote: -----> Building dependencies
remote:        Installing node modules (package.json + package-lock)
remote:        up to date in 0.237s
remote:
remote: -----> Caching build
remote:        Clearing previous node cache
remote:        Saving 2 cacheDirectories (default):
remote:        - node_modules (nothing to cache)
remote:        - bower_components (nothing to cache)
remote:
remote: -----> Build succeeded!
remote: -----> Discovering process types
remote:        Procfile declares types -> web
remote:
remote: -----> Compressing...
remote:        Done: 20.4M
remote: -----> Launching...
remote:        Released v3
remote:        https://reviews-hotel.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/reviews-hotel.git
 * [new branch]      master -> master
PS C:\Users\Aurora\desktop\reviews-hotel> heroku open

推送应用程序时记录:

 desktop\reviews-hotel> heroku logs
    .134604+00:00 app[api]: Release v1 created by user aurora.ruggieri@gmail.com
    .134604+00:00 app[api]: Initial release by user aurora.ruggieri@gmail.com
    .228634+00:00 app[api]: Release v2 created by user aurora.ruggieri@gmail.com
    .228634+00:00 app[api]: Enable Logplex by user aurora.ruggieri@gmail.com
    .000000+00:00 app[api]: Build started by user aurora.ruggieri@gmail.com
    .659883+00:00 app[api]: Scaled to web@1:Free by user aurora.ruggieri@gmail.com
    .647869+00:00 app[api]: Deploy ec057b8f by user aurora.ruggieri@gmail.com
    .647869+00:00 app[api]: Release v3 created by user aurora.ruggieri@gmail.com
    .000000+00:00 app[api]: Build succeeded
    .225583+00:00 heroku[web.1]: Starting process with command `node app.js`
    .207682+00:00 app[web.1]: /app/app.js:10
    .207698+00:00 app[web.1]: app.set('port', (process.env.PORT || 8080);
    .207699+00:00 app[web.1]:                                          ^
    .207700+00:00 app[web.1]:
    .207700+00:00 app[web.1]: SyntaxError: missing ) after argument list
    .207701+00:00 app[web.1]:     at createScript (vm.js:74:10)
    .207702+00:00 app[web.1]:     at Object.runInThisContext (vm.js:116:10)
    .207702+00:00 app[web.1]:     at Module._compile (module.js:533:28)
    .207703+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:580:10)
    .207703+00:00 app[web.1]:     at Module.load (module.js:503:32)
    .207704+00:00 app[web.1]:     at tryModuleLoad (module.js:466:12)
    .207705+00:00 app[web.1]:     at Function.Module._load (module.js:458:3)
    .207706+00:00 app[web.1]:     at startup (bootstrap_node.js:158:16)
    .207705+00:00 app[web.1]:     at Function.Module.runMain (module.js:605:10)
    .207706+00:00 app[web.1]:     at bootstrap_node.js:575:3
    .279395+00:00 heroku[web.1]: Process exited with status 1
    .294570+00:00 heroku[web.1]: State changed from starting to crashed
    .296871+00:00 heroku[web.1]: State changed from crashed to starting
    .853411+00:00 heroku[web.1]: Starting process with command `node app.js`
    .013098+00:00 app[web.1]: /app/app.js:10
    .013116+00:00 app[web.1]: app.set('port', (process.env.PORT || 8080);
    .013117+00:00 app[web.1]:                                          ^
    .013118+00:00 app[web.1]:
    .013119+00:00 app[web.1]:     at createScript (vm.js:74:10)
    .013118+00:00 app[web.1]: SyntaxError: missing ) after argument list
    .013120+00:00 app[web.1]:     at Object.runInThisContext (vm.js:116:10)
    .013120+00:00 app[web.1]:     at Module._compile (module.js:533:28)
    .013121+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:580:10)
    .013122+00:00 app[web.1]:     at Module.load (module.js:503:32)
    .013122+00:00 app[web.1]:     at tryModuleLoad (module.js:466:12)
    .013123+00:00 app[web.1]:     at Function.Module._load (module.js:458:3)
    .013124+00:00 app[web.1]:     at Function.Module.runMain (module.js:605:10)
    .013124+00:00 app[web.1]:     at startup (bootstrap_node.js:158:16)
    .013125+00:00 app[web.1]:     at bootstrap_node.js:575:3
    .101161+00:00 heroku[web.1]: State changed from starting to crashed
    .086036+00:00 heroku[web.1]: Process exited with status 1
    .121648+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=reviews-hotel.herokuapp.com request_id=11865904-56b3-452a-af1f-6fbf85696973 fwd="
    = connect= service= status=503 bytes= protocol=https
    .137979+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=reviews-hotel.herokuapp.com request_id=e848f589-8f1f-4b65-971f-5fb19a9
    24.38" dyno= connect= service= status=503 bytes= protocol=https
    .120626+00:00 heroku[web.1]: State changed from crashed to starting
    .405397+00:00 heroku[web.1]: Starting process with command `node app.js`
    .140238+00:00 app[web.1]: /app/app.js:10
    .140257+00:00 app[web.1]: app.set('port', (process.env.PORT || 8080);
    .140258+00:00 app[web.1]:                                          ^
    .140259+00:00 app[web.1]:
    .140259+00:00 app[web.1]: SyntaxError: missing ) after argument list
    .140260+00:00 app[web.1]:     at createScript (vm.js:74:10)
    .140260+00:00 app[web.1]:     at Object.runInThisContext (vm.js:116:10)
    .140261+00:00 app[web.1]:     at Module._compile (module.js:533:28)
    .140262+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:580:10)
    .140262+00:00 app[web.1]:     at Module.load (module.js:503:32)
    .140263+00:00 app[web.1]:     at tryModuleLoad (module.js:466:12)
    .140263+00:00 app[web.1]:     at Function.Module._load (module.js:458:3)
    .140264+00:00 app[web.1]:     at Function.Module.runMain (module.js:605:10)
    .140265+00:00 app[web.1]:     at startup (bootstrap_node.js:158:16)
    .140265+00:00 app[web.1]:     at bootstrap_node.js:575:3
    .238107+00:00 heroku[web.1]: State changed from starting to crashed
    .228469+00:00 heroku[web.1]: Process exited with status 1
    .452253+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=reviews-hotel.herokuapp.com request_id=b46afc8a-155f-437b-af65-cbeee901be46 fwd="
    = connect= service= status=503 bytes= protocol=https
    .023226+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=reviews-hotel.herokuapp.com request_id=dbf9fc62-9a09-4fe5-b4f5-8dbdb6c
    24.38" dyno= connect= service= status=503 bytes= protocol=https
    .942085+00:00 heroku[web.1]: State changed from crashed to starting
    .236872+00:00 heroku[web.1]: Starting process with command `node app.js`
    .819323+00:00 app[web.1]: /app/app.js:10
    .819342+00:00 app[web.1]: app.set('port', (process.env.PORT || 8080);
    .819344+00:00 app[web.1]:
    .819343+00:00 app[web.1]:                                          ^
    .819344+00:00 app[web.1]: SyntaxError: missing ) after argument list
    .819345+00:00 app[web.1]:     at createScript (vm.js:74:10)
    .819345+00:00 app[web.1]:     at Object.runInThisContext (vm.js:116:10)
    .819346+00:00 app[web.1]:     at Module._compile (module.js:533:28)
    .819347+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:580:10)
    .819348+00:00 app[web.1]:     at Module.load (module.js:503:32)
    .819348+00:00 app[web.1]:     at tryModuleLoad (module.js:466:12)
    .819349+00:00 app[web.1]:     at Function.Module._load (module.js:458:3)
    .819350+00:00 app[web.1]:     at Function.Module.runMain (module.js:605:10)
    .819351+00:00 app[web.1]:     at startup (bootstrap_node.js:158:16)
    .819351+00:00 app[web.1]:     at bootstrap_node.js:575:3
    .930122+00:00 heroku[web.1]: State changed from starting to crashed
    .912507+00:00 heroku[web.1]: Process exited with status 1
    desktop\reviews-hotel>


  [1]: https://drive.google.com/file/d/0BzQJQcY_Z3E8ckdmYlJQN1REVEU/view?usp=sharing

Thanks for the reply.


<!-- language: lang-html -->

    desktop\reviews-hotel> heroku logs
    .134604+00:00 app[api]: Release v1 created by user aurora.ruggieri@gmail.com
    .134604+00:00 app[api]: Initial release by user aurora.ruggieri@gmail.com
    .228634+00:00 app[api]: Release v2 created by user aurora.ruggieri@gmail.com
    .228634+00:00 app[api]: Enable Logplex by user aurora.ruggieri@gmail.com
    .000000+00:00 app[api]: Build started by user aurora.ruggieri@gmail.com
    .659883+00:00 app[api]: Scaled to web@1:Free by user aurora.ruggieri@gmail.com
    .647869+00:00 app[api]: Deploy ec057b8f by user aurora.ruggieri@gmail.com
    .647869+00:00 app[api]: Release v3 created by user aurora.ruggieri@gmail.com
    .000000+00:00 app[api]: Build succeeded
    .225583+00:00 heroku[web.1]: Starting process with command `node app.js`
    .207682+00:00 app[web.1]: /app/app.js:10
    .207698+00:00 app[web.1]: app.set('port', (process.env.PORT || 8080);
    .207699+00:00 app[web.1]:                                          ^
    .207700+00:00 app[web.1]:
    .207700+00:00 app[web.1]: SyntaxError: missing ) after argument list
    .207701+00:00 app[web.1]:     at createScript (vm.js:74:10)
    .207702+00:00 app[web.1]:     at Object.runInThisContext (vm.js:116:10)
    .207702+00:00 app[web.1]:     at Module._compile (module.js:533:28)
    .207703+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:580:10)
    .207703+00:00 app[web.1]:     at Module.load (module.js:503:32)
    .207704+00:00 app[web.1]:     at tryModuleLoad (module.js:466:12)
    .207705+00:00 app[web.1]:     at Function.Module._load (module.js:458:3)
    .207706+00:00 app[web.1]:     at startup (bootstrap_node.js:158:16)
    .207705+00:00 app[web.1]:     at Function.Module.runMain (module.js:605:10)
    .207706+00:00 app[web.1]:     at bootstrap_node.js:575:3
    .279395+00:00 heroku[web.1]: Process exited with status 1
    .294570+00:00 heroku[web.1]: State changed from starting to crashed
    .296871+00:00 heroku[web.1]: State changed from crashed to starting
    .853411+00:00 heroku[web.1]: Starting process with command `node app.js`
    .013098+00:00 app[web.1]: /app/app.js:10
    .013116+00:00 app[web.1]: app.set('port', (process.env.PORT || 8080);
    .013117+00:00 app[web.1]:                                          ^
    .013118+00:00 app[web.1]:
    .013119+00:00 app[web.1]:     at createScript (vm.js:74:10)
    .013118+00:00 app[web.1]: SyntaxError: missing ) after argument list
    .013120+00:00 app[web.1]:     at Object.runInThisContext (vm.js:116:10)
    .013120+00:00 app[web.1]:     at Module._compile (module.js:533:28)
    .013121+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:580:10)
    .013122+00:00 app[web.1]:     at Module.load (module.js:503:32)
    .013122+00:00 app[web.1]:     at tryModuleLoad (module.js:466:12)
    .013123+00:00 app[web.1]:     at Function.Module._load (module.js:458:3)
    .013124+00:00 app[web.1]:     at Function.Module.runMain (module.js:605:10)
    .013124+00:00 app[web.1]:     at startup (bootstrap_node.js:158:16)
    .013125+00:00 app[web.1]:     at bootstrap_node.js:575:3
    .101161+00:00 heroku[web.1]: State changed from starting to crashed
    .086036+00:00 heroku[web.1]: Process exited with status 1
    .121648+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=reviews-hotel.herokuapp.com request_id=11865904-56b3-452a-af1f-6fbf85696973 fwd="
    = connect= service= status=503 bytes= protocol=https
    .137979+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=reviews-hotel.herokuapp.com request_id=e848f589-8f1f-4b65-971f-5fb19a9
    24.38" dyno= connect= service= status=503 bytes= protocol=https
    .120626+00:00 heroku[web.1]: State changed from crashed to starting
    .405397+00:00 heroku[web.1]: Starting process with command `node app.js`
    .140238+00:00 app[web.1]: /app/app.js:10
    .140257+00:00 app[web.1]: app.set('port', (process.env.PORT || 8080);
    .140258+00:00 app[web.1]:                                          ^
    .140259+00:00 app[web.1]:
    .140259+00:00 app[web.1]: SyntaxError: missing ) after argument list
    .140260+00:00 app[web.1]:     at createScript (vm.js:74:10)
    .140260+00:00 app[web.1]:     at Object.runInThisContext (vm.js:116:10)
    .140261+00:00 app[web.1]:     at Module._compile (module.js:533:28)
    .140262+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:580:10)
    .140262+00:00 app[web.1]:     at Module.load (module.js:503:32)
    .140263+00:00 app[web.1]:     at tryModuleLoad (module.js:466:12)
    .140263+00:00 app[web.1]:     at Function.Module._load (module.js:458:3)
    .140264+00:00 app[web.1]:     at Function.Module.runMain (module.js:605:10)
    .140265+00:00 app[web.1]:     at startup (bootstrap_node.js:158:16)
    .140265+00:00 app[web.1]:     at bootstrap_node.js:575:3
    .238107+00:00 heroku[web.1]: State changed from starting to crashed
    .228469+00:00 heroku[web.1]: Process exited with status 1
    .452253+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=reviews-hotel.herokuapp.com request_id=b46afc8a-155f-437b-af65-cbeee901be46 fwd="
    = connect= service= status=503 bytes= protocol=https
    .023226+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=reviews-hotel.herokuapp.com request_id=dbf9fc62-9a09-4fe5-b4f5-8dbdb6c
    24.38" dyno= connect= service= status=503 bytes= protocol=https
    .942085+00:00 heroku[web.1]: State changed from crashed to starting
    .236872+00:00 heroku[web.1]: Starting process with command `node app.js`
    .819323+00:00 app[web.1]: /app/app.js:10
    .819342+00:00 app[web.1]: app.set('port', (process.env.PORT || 8080);
    .819344+00:00 app[web.1]:
    .819343+00:00 app[web.1]:                                          ^
    .819344+00:00 app[web.1]: SyntaxError: missing ) after argument list
    .819345+00:00 app[web.1]:     at createScript (vm.js:74:10)
    .819345+00:00 app[web.1]:     at Object.runInThisContext (vm.js:116:10)
    .819346+00:00 app[web.1]:     at Module._compile (module.js:533:28)
    .819347+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:580:10)
    .819348+00:00 app[web.1]:     at Module.load (module.js:503:32)
    .819348+00:00 app[web.1]:     at tryModuleLoad (module.js:466:12)
    .819349+00:00 app[web.1]:     at Function.Module._load (module.js:458:3)
    .819350+00:00 app[web.1]:     at Function.Module.runMain (module.js:605:10)
    .819351+00:00 app[web.1]:     at startup (bootstrap_node.js:158:16)
    .819351+00:00 app[web.1]:     at bootstrap_node.js:575:3
    .930122+00:00 heroku[web.1]: State changed from starting to crashed
    .912507+00:00 heroku[web.1]: Process exited with status 1
    desktop\reviews-hotel>

日志输出:

PS C:\Users\Aurora\desktop\reviews-hotel> heroku logs
2017-09-03T12:50:26.651697+00:00 app[api]: Release v1 created by user aurora.ruggieri@gmail.com
2017-09-03T12:50:26.651697+00:00 app[api]: Initial release by user aurora.ruggieri@gmail.com
2017-09-03T12:50:27.091784+00:00 app[api]: Enable Logplex by user aurora.ruggieri@gmail.com
2017-09-03T12:50:27.091784+00:00 app[api]: Release v2 created by user aurora.ruggieri@gmail.com
2017-09-03T12:52:05.000000+00:00 app[api]: Build started by user aurora.ruggieri@gmail.com
2017-09-03T12:52:17.136786+00:00 app[api]: Release v3 created by user aurora.ruggieri@gmail.com
2017-09-03T12:52:17.136786+00:00 app[api]: Deploy 2339ca5d by user aurora.ruggieri@gmail.com
2017-09-03T12:52:17.157221+00:00 app[api]: Scaled to web@1:Free by user aurora.ruggieri@gmail.com
2017-09-03T12:52:05.000000+00:00 app[api]: Build succeeded
2017-09-03T12:52:20.201147+00:00 heroku[web.1]: Starting process with command `node app.js`
2017-09-03T12:52:23.479696+00:00 app[web.1]: module.js:487
2017-09-03T12:52:23.479715+00:00 app[web.1]:     throw err;
2017-09-03T12:52:23.479716+00:00 app[web.1]:     ^
2017-09-03T12:52:23.479717+00:00 app[web.1]: Error: Cannot find module 'mongoose'
2017-09-03T12:52:23.479717+00:00 app[web.1]:
2017-09-03T12:52:23.479721+00:00 app[web.1]:     at Function.Module._load (module.js:437:25)
2017-09-03T12:52:23.479718+00:00 app[web.1]:     at Function.Module._resolveFilename (module.js:485:15)
2017-09-03T12:52:23.479722+00:00 app[web.1]:     at Module.require (module.js:513:17)
2017-09-03T12:52:23.479723+00:00 app[web.1]:     at require (internal/module.js:11:18)
2017-09-03T12:52:23.479723+00:00 app[web.1]:     at Object.<anonymous> (/app/api/data/db.js:1:78)
2017-09-03T12:52:23.479724+00:00 app[web.1]:     at Module._compile (module.js:569:30)
2017-09-03T12:52:23.479724+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:580:10)
2017-09-03T12:52:23.479725+00:00 app[web.1]:     at tryModuleLoad (module.js:466:12)
2017-09-03T12:52:23.479725+00:00 app[web.1]:     at Module.load (module.js:503:32)
2017-09-03T12:52:23.479726+00:00 app[web.1]:     at Function.Module._load (module.js:458:3)
2017-09-03T12:52:23.569704+00:00 heroku[web.1]: Process exited with status 1
2017-09-03T12:52:23.583588+00:00 heroku[web.1]: State changed from starting to crashed
2017-09-03T12:52:23.586510+00:00 heroku[web.1]: State changed from crashed to starting
2017-09-03T12:52:26.352460+00:00 heroku[web.1]: Starting process with command `node app.js`
2017-09-03T12:52:30.564057+00:00 app[web.1]: module.js:487
2017-09-03T12:52:30.564075+00:00 app[web.1]:     throw err;
2017-09-03T12:52:30.564075+00:00 app[web.1]:     ^
2017-09-03T12:52:30.564076+00:00 app[web.1]:
2017-09-03T12:52:30.564076+00:00 app[web.1]: Error: Cannot find module 'mongoose'
2017-09-03T12:52:30.564077+00:00 app[web.1]:     at Function.Module._resolveFilename (module.js:485:15)
2017-09-03T12:52:30.564077+00:00 app[web.1]:     at Function.Module._load (module.js:437:25)
2017-09-03T12:52:30.564078+00:00 app[web.1]:     at Module.require (module.js:513:17)
2017-09-03T12:52:30.564078+00:00 app[web.1]:     at require (internal/module.js:11:18)
2017-09-03T12:52:30.564079+00:00 app[web.1]:     at Object.<anonymous> (/app/api/data/db.js:1:78)
2017-09-03T12:52:30.564079+00:00 app[web.1]:     at Module._compile (module.js:569:30)
2017-09-03T12:52:30.564080+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:580:10)
2017-09-03T12:52:30.564080+00:00 app[web.1]:     at Module.load (module.js:503:32)
2017-09-03T12:52:30.564080+00:00 app[web.1]:     at tryModuleLoad (module.js:466:12)
2017-09-03T12:52:30.564081+00:00 app[web.1]:     at Function.Module._load (module.js:458:3)
2017-09-03T12:52:30.645393+00:00 heroku[web.1]: State changed from starting to crashed
2017-09-03T12:52:30.635356+00:00 heroku[web.1]: Process exited with status 1
2017-09-03T12:52:34.684553+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=reviews-hotel.herokuapp.com request_id=26f428ee-69fc-4baf-90ea-cf49da91e386 fwd="
79.17.75.16" dyno= connect= service= status=503 bytes= protocol=https
2017-09-03T12:52:36.000579+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=reviews-hotel.herokuapp.com request_id=d95cc652-6b57-4b0d-9aee-d53be70
7c406 fwd="79.17.75.16" dyno= connect= service= status=503 bytes= protocol=https
PS C:\Users\Aurora\desktop\reviews-hotel>

我coorect代码,应用程序有这个错误:

contrl

如果需要,您可以在我的githhub个人资料中查看我的peroject:auroraruggieri

0 个答案:

没有答案