Skip to content
This repository has been archived by the owner on Oct 26, 2021. It is now read-only.

npm install fails #47

Closed
phaneendra opened this issue Jan 16, 2016 · 6 comments
Closed

npm install fails #47

phaneendra opened this issue Jan 16, 2016 · 6 comments

Comments

@phaneendra
Copy link

npm install universal-redux fails with no babel command found

Is it required to install babel-core beforehand

$ npm install universal-redux
npm WARN deprecated lodash@1.2.1: lodash@<2.0.0 is no longer maintained. Upgrade to lodash@^3.0.0

> async-props@0.2.2 postinstall /work/node_modules/universal-redux/node_modules/async-props
> node ./npm-scripts/postinstall.js

-
> async-props@0.2.2 build /work/node_modules/universal-redux/node_modules/async-props
> babel ./modules --presets es2015,stage-0,react --out-dir lib --ignore '__tests__'

sh: babel: command not found

npm ERR! Darwin 15.2.0
@bdefore
Copy link
Owner

bdefore commented Jan 16, 2016

@phaneendra that's unfortunate. babel-cli should be enough to get you through for you now, but i'll make a fix later today that brings async-props module into the project source until they do another npm publish. that way babel postinstalls aren't necessary.

@bdefore
Copy link
Owner

bdefore commented Jan 16, 2016

@phaneendra This should no longer be necessary as of 3.0.0-rc7. Could you please verify without babel dependencies?

@phaneendra
Copy link
Author

Yes rc7 works with npm install - resolving the async-props issue

Now npm run dev fails with errors - I just cloned the universal-redux-starter upgraded to rc7 and ran the command, though i see the plugin babel-plugin-transform-runtime available in package.json of universal-redux.
Seems its a plugin path lookup issue - not sure how to fix this.

[1] /work/node_modules/universal-redux/node_modules/babel-core/lib/transformation/file/options/option-manager.js:193
[1]           throw new ReferenceError(messages.get("pluginUnknown", plugin, loc, i, dirname));
[1]           ^
[1]
[1] ReferenceError: Unknown plugin "transform-runtime" specified in "base" at 0, attempted to resolve relative to "/work/src/redux/modules"
[1]     at /work/node_modules/universal-redux/node_modules/babel-core/lib/transformation/file/options/option-manager.js:193:17
[1]     at Array.map (native)
[1]     at Function.normalisePlugins (/work/node_modules/universal-redux/node_modules/babel-core/lib/transformation/file/options/option-manager.js:173:20)
[1]     at OptionManager.mergeOptions (/work/node_modules/universal-redux/node_modules/babel-core/lib/transformation/file/options/option-manager.js:271:36)
[1]     at compile (/work/node_modules/universal-redux/node_modules/babel-core/node_modules/babel-register/lib/node.js:85:15)
[1]     at loader (/work/node_modules/universal-redux/node_modules/babel-core/node_modules/babel-register/lib/node.js:130:14)
[1]     at Object.require.extensions.(anonymous function) [as .js] (/work/node_modules/universal-redux/node_modules/babel-core/node_modules/babel-register/lib/node.js:140:7)
[1]     at Module.load (module.js:356:32)
[1]     at Function.Module._load (module.js:311:12)
[1]     at Module.require (module.js:366:17)
[1]     at require (module.js:385:17)
[1]
[1] npm
[1]  ERR!
[1]  Darwin 15.2.0
[1] npm
[1]  ERR!
[1] argv "/.nvm/v4.2.2/bin/node" "/.nvm/v4.2.2/bin/npm" "run" "dev-server"
[1] npm
[1]  ERR!
[1] node v4.2.2
[1] npm ERR! npm  v2.14.7
[1] npm ERR! code ELIFECYCLE
[1] npm
[1]  ERR!
.....
[1] npm run dev-server exited with code 1
--> Sending SIGTERM to other processes..

@bdefore
Copy link
Owner

bdefore commented Jan 17, 2016

@phaneendra that's an npm issue. quick solution is to either update your npm to 3 (npm install -g npm@3) or use Node 5 which ships with it.

Because you're using Node 4.2.2's shipped version of npm (npm v2.14.7), it's not able to inspect the full dependency tree. If you want to stay with npm@2 and use universal-redux you'll need to include many of UR's dependencies as dependencies of your own project. It's too unwieldy to track what those are since I've moved on from npm 2, but it looks like in this case you'd need to at least bring all the babel stuff over.

I strongly recommend going with npm3. It can be a bit slower, but you'll probably run into this issue with other libraries as well. With the --cache-min=1000000 flag it's about the same speed as npm2 with only edge case risks.

@phaneendra
Copy link
Author

upgrading to npm 3 and it flat module resolution did the trick, I feel explicitly depending on universal redux dependencies defeats the purpose of why this module was converted to npm module.

@bdefore
Copy link
Owner

bdefore commented Jan 18, 2016

@phaneendra agreed. i've decided to make npm3 a requirement now. it will provide a warning on npm install otherwise.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants