node.js - Heroku cannot find `babel-core/register` -


i building small url-shortener app using nodejs. writing code in es6, using index file imports babel , server:

require('babel-core/register'); require('./server.js'); 

this works absolutely fine on localhost , es6 code works correctly.

however, when deploy heroku, receive application error following showing in heroku logs --tail -a shortenthisurl:

2016-02-06t12:31:14.074071+00:00 heroku[slug-compiler]: slug compilation started 2016-02-06t12:31:14.074080+00:00 heroku[slug-compiler]: slug compilation finished 2016-02-06t12:31:13.936954+00:00 heroku[api]: deploy f576f69 rory88@gmail.com 2016-02-06t12:31:13.936991+00:00 heroku[api]: release v17 created rory88@gmail.com 2016-02-06t12:31:14.230327+00:00 heroku[web.1]: state changed crashed starting 2016-02-06t12:31:15.215417+00:00 heroku[web.1]: starting process command `node index.js` 2016-02-06t12:31:16.816525+00:00 app[web.1]: module.js:341 2016-02-06t12:31:16.816534+00:00 app[web.1]:     throw err; 2016-02-06t12:31:16.816535+00:00 app[web.1]:     ^ 2016-02-06t12:31:16.816536+00:00 app[web.1]: 2016-02-06t12:31:16.816541+00:00 app[web.1]: error: cannot find module 'babel-core/register' 2016-02-06t12:31:16.816541+00:00 app[web.1]:     @ function.module._resolvefilename (module.js:339:15) 2016-02-06t12:31:16.816542+00:00 app[web.1]:     @ function.module._load (module.js:290:25) 2016-02-06t12:31:16.816543+00:00 app[web.1]:     @ module.require (module.js:367:17) 2016-02-06t12:31:16.816544+00:00 app[web.1]:     @ require (internal/module.js:16:19) 2016-02-06t12:31:16.816544+00:00 app[web.1]:     @ object.<anonymous> (/app/index.js:1:63) 2016-02-06t12:31:16.816545+00:00 app[web.1]:     @ module._compile (module.js:413:34) 2016-02-06t12:31:16.816546+00:00 app[web.1]:     @ object.module._extensions..js (module.js:422:10) 2016-02-06t12:31:16.816546+00:00 app[web.1]:     @ module.load (module.js:357:32) 2016-02-06t12:31:16.816547+00:00 app[web.1]:     @ function.module._load (module.js:314:12) 2016-02-06t12:31:16.816547+00:00 app[web.1]:     @ function.module.runmain (module.js:447:10) 2016-02-06t12:31:17.669897+00:00 heroku[web.1]: state changed starting crashed 2016-02-06t12:31:17.655186+00:00 heroku[web.1]: process exited status 1 2016-02-06t12:31:40.693975+00:00 heroku[router]: at=error code=h10 desc="app crashed" method=get path="/" host=shortenthisurl.herokuapp.com request_id=c2bffaba-4de6-4310-b535-4ff37ec637ad fwd="86.1.35.144" dyno= connect= service= status=503 bytes= 

here package.json:

{   "name": "shortenthisurl",   "version": "1.0.0",   "description": "",   "main": "server.js",   "scripts": {     "test": "mocha --compilers js:babel-register -w",     "start": "node server.js",     "babel-node": "babel-node --stage 0 --ignore='foo|bar|baz'",     "build": "babel -d lib"   },   "author": "",   "license": "isc",   "dependencies": {     "babel": "^6.3.26",     "chai": "^3.5.0",     "express": "^4.13.4",     "lodash": "^4.2.1",     "mocha": "^2.4.5",     "mongoose": "^4.4.1",     "request": "^2.69.0"   },   "devdependencies": {     "babel-core": "^6.4.5",     "babel-preset-es2015": "^6.3.13",     "babel-register": "^6.4.3"   } } 

perhaps not correctly importing babel. have advice how might going getting work?

here link full repo on github: https://github.com/alanbuchanan/shortenthisurl

the module unavailable because wasn't installed. heroku installs packages in dependencies these required application work.

from heroku documentation:

npm reads configuration environment variables beginning npm_config. set production=true default install dependencies only.

you can solve problem moving babel-core module devdependencies dependencies list since require module compile es6 scripts es5.


Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

post - imageshack API cURL -