JGa*_*rdo 4 heroku ejs node.js express
我的应用程序在本地工作但是当我部署到Heroku时,出现了问题.这是我的错误,似乎错误是由我添加EJS后未能做的事情引起的.
2014-01-06T16:53:39.285571+00:00 app[web.1]: module.js:340
2014-01-06T16:53:39.285956+00:00 app[web.1]: throw err;
2014-01-06T16:53:39.286233+00:00 app[web.1]: ^
2014-01-06T16:53:39.288439+00:00 app[web.1]: Error: Cannot find module 'ejs'
2014-01-06T16:53:39.288439+00:00 app[web.1]: at Function.Module._resolveFilename (module.js:338:15)
2014-01-06T16:53:39.288439+00:00 app[web.1]: at Function.Module._load (module.js:280:25)
2014-01-06T16:53:39.288439+00:00 app[web.1]: at require (module.js:380:17)
2014-01-06T16:53:39.288439+00:00 app[web.1]: at Object.<anonymous> (/app/app.js:28:20)
2014-01-06T16:53:39.288439+00:00 app[web.1]: at Module._compile (module.js:456:26)
2014-01-06T16:53:39.288439+00:00 app[web.1]: at Module.require (module.js:364:17)
2014-01-06T16:53:39.288439+00:00 app[web.1]: at Object.Module._extensions..js (module.js:474:10)
2014-01-06T16:53:39.288439+00:00 app[web.1]: at Module.load (module.js:356:32)
2014-01-06T16:53:39.288439+00:00 app[web.1]: at Function.Module._load (module.js:312:12)
2014-01-06T16:53:39.288617+00:00 app[web.1]: at Function.Module.runMain (module.js:497:10)
2014-01-06T16:53:40.650512+00:00 heroku[web.1]: State changed from starting to crashed
2014-01-06T16:53:40.637888+00:00 heroku[web.1]: Process exited with status 8
2014-01-06T16:53:40.651134+00:00 heroku[web.1]: State changed from crashed to starting
2014-01-06T16:53:42.536106+00:00 heroku[web.1]: Starting process with command `node app.js`
2014-01-06T16:53:43.447621+00:00 app[web.1]:
2014-01-06T16:53:43.449816+00:00 app[web.1]: Error: Cannot find module 'ejs'
2014-01-06T16:53:43.447621+00:00 app[web.1]: module.js:340
2014-01-06T16:53:43.447926+00:00 app[web.1]: throw err;
2014-01-06T16:53:43.447926+00:00 app[web.1]: ^
2014-01-06T16:53:43.449816+00:00 app[web.1]: at Function.Module._resolveFilename (module.js:338:15)
2014-01-06T16:53:43.449816+00:00 app[web.1]: at Function.Module._load (module.js:280:25)
2014-01-06T16:53:43.449816+00:00 app[web.1]: at Module.require (module.js:364:17)
2014-01-06T16:53:43.449816+00:00 app[web.1]: at Module._compile (module.js:456:26)
2014-01-06T16:53:43.449816+00:00 app[web.1]: at Object.Module._extensions..js (module.js:474:10)
2014-01-06T16:53:43.449816+00:00 app[web.1]: at Module.load (module.js:356:32)
2014-01-06T16:53:43.449816+00:00 app[web.1]: at Function.Module._load (module.js:312:12)
2014-01-06T16:53:43.449990+00:00 app[web.1]: at Function.Module.runMain (module.js:497:10)
2014-01-06T16:53:43.449816+00:00 app[web.1]: at require (module.js:380:17)
2014-01-06T16:53:43.449816+00:00 app[web.1]: at Object.<anonymous> (/app/app.js:28:20)
2014-01-06T16:53:44.712427+00:00 heroku[web.1]: State changed from starting to crashed
2014-01-06T16:53:44.700963+00:00 heroku[web.1]: Process exited with status 8
2014-01-06T16:54:13.976150+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=bruxzir-express.herokuapp.com fwd="98.173.1.66" dyno= connect= service= status=503 bytes=
2014-01-06T16:54:29.109297+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=bruxzir-express.herokuapp.com fwd="98.173.1.66" dyno= connect= service= status=503 bytes=
2014-01-06T16:54:29.243506+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=bruxzir-express.herokuapp.com fwd="98.173.1.66" dyno= connect= service= status=503 bytes=
Run Code Online (Sandbox Code Playgroud)
在SO上阅读这个问题后,我需要在中添加该依赖项package.json.对于我运行的ejs版本npm list并得到了这个,看起来可能会有更多错误要解决.
application-name@0.0.1 /Users/juan.gallardo/Desktop/myfiles/test-projects/bruxzir-express-test
??? ejs@0.8.5 extraneous
??? express@3.4.4
? ??? buffer-crc32@0.2.1
? ??? commander@1.3.2
? ? ??? keypress@0.1.0
? ??? connect@2.11.0
? ? ??? bytes@0.2.1
? ? ??? methods@0.0.1
? ? ??? multiparty@2.2.0
? ? ? ??? readable-stream@1.1.9
? ? ? ? ??? core-util-is@1.0.0
? ? ? ? ??? debuglog@0.0.2
? ? ? ??? stream-counter@0.2.0
? ? ??? negotiator@0.3.0
? ? ??? pause@0.0.1
? ? ??? qs@0.6.5
? ? ??? raw-body@0.0.3
? ? ??? uid2@0.0.3
? ??? cookie@0.1.0
? ??? cookie-signature@1.0.1
? ??? debug@0.7.4
? ??? fresh@0.2.0
? ??? methods@0.1.0
? ??? mkdirp@0.3.5
? ??? range-parser@0.0.4
? ??? send@0.1.4
? ??? mime@1.2.11
??? jade@1.0.0
? ??? character-parser@1.2.0
? ??? commander@2.0.0
? ??? constantinople@1.0.2
? ? ??? uglify-js@2.4.8
? ? ??? async@0.2.9
? ? ??? optimist@0.3.7
? ? ? ??? wordwrap@0.0.2
? ? ??? source-map@0.1.31
? ? ? ??? amdefine@0.1.0
? ? ??? uglify-to-browserify@1.0.1
? ??? mkdirp@0.3.5
? ??? monocle@1.1.50
? ? ??? readdirp@0.2.5
? ? ??? minimatch@0.2.14
? ? ??? lru-cache@2.5.0
? ? ??? sigmund@1.0.0
? ??? transformers@2.1.0
? ? ??? css@1.0.8
? ? ? ??? css-parse@1.0.4
? ? ? ??? css-stringify@1.0.5
? ? ??? promise@2.0.0
? ? ? ??? is-promise@1.0.0
? ? ??? uglify-js@2.2.5
? ? ??? optimist@0.3.7
? ? ? ??? wordwrap@0.0.2
? ? ??? source-map@0.1.31
? ? ??? amdefine@0.1.0
? ??? with@2.0.0
? ??? uglify-js@2.4.0
? ??? async@0.2.9
? ??? optimist@0.3.7
? ? ??? wordwrap@0.0.2
? ??? source-map@0.1.31
? ? ??? amdefine@0.1.0
? ??? uglify-to-browserify@1.0.1
??? simple-recaptcha@0.0.3 extraneous
??? stylus@0.41.3
??? cssom@0.2.5
??? debug@0.7.4
??? mkdirp@0.3.5
??? sax@0.5.8
npm ERR! extraneous: ejs@0.8.5 /Users/juan.gallardo/Desktop/myfiles/test-projects/bruxzir-express-test/node_modules/ejs
npm ERR! extraneous: simple-recaptcha@0.0.3 /Users/juan.gallardo/Desktop/myfiles/test-projects/bruxzir-express-test/node_modules/simple-recaptcha
npm ERR! not ok code 0
Run Code Online (Sandbox Code Playgroud)
我只是通过将EJS及其版本列入我的版本来解决这个问题package.json.
"ejs": "0.8.5"
Run Code Online (Sandbox Code Playgroud)
如果您不知道您拥有的EJS版本,我发现我的方式就是运行npm list.
这是我当前的整个文件,如果你很好奇它是如何在一起部署在heroku上的.
{
"name": "application-name",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node app.js"
},
"dependencies": {
"express": "3.4.4",
"jade": "*",
"stylus": "*",
"ejs": "0.8.5"
},
"engines": {
"node": "0.10.1",
"npm": "1.3.14"
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4748 次 |
| 最近记录: |