react-hn icon indicating copy to clipboard operation
react-hn copied to clipboard

Error in app start-up

Open agnivade opened this issue 8 years ago • 4 comments

I did npm install, npm run build and then npm start

agniva-~/play/react-hn$npm start

> [email protected] start /home/agniva/play/react-hn
> node server.js

module.js:327
    throw err;
    ^

Error: Cannot find module 'babel/register'
    at Function.Module._resolveFilename (module.js:325:15)
    at Function.Module._load (module.js:276:25)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/home/agniva/play/react-hn/server.js:6:1)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Function.Module.runMain (module.js:441:10)

npm ERR! Linux 4.2.0-16-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v4.3.2
npm ERR! npm  v2.14.12
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `node server.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script 'node server.js'.
npm ERR! This is most likely a problem with the react-hn package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node server.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls react-hn
npm ERR! There is likely additional logging output above.

My node version is 4.3.2. Do I need to upgrade ?

agnivade avatar Jun 10 '16 07:06 agnivade

This is because there's no babel dependency in package.json - there should be and it should match the version nwb is using to avoid duplicating it.

This works by coincidence if you're using npm3 (which is the default version as of Node v5 and above) as it places all non-duplicated transitive dependencies in require() scope.

I'm seeing this popping up more and more since npm3 made it possible. I wonder how many apps built with npm3 are working by coincidence via transitive dependencies they have no version number control over.

insin avatar Jun 10 '16 09:06 insin

Well, I have tried with installing babel and re-running it. Still it gives the same error. Do you want me to install the same version of babel which nwb uses and retry ?

agnivade avatar Jun 10 '16 10:06 agnivade

Yes, babel-register is a separate package in Babel 6, so it'll need to be Babel 5 for now.

insin avatar Jun 10 '16 10:06 insin

Ah I see ! Got it to working now. Thanks.

agnivade avatar Jun 10 '16 10:06 agnivade