acdlite / redux-router

Redux bindings for React Router – keep your router state inside your Redux store
MIT License
2.3k stars 200 forks source link

npm-shrinkwrap 'invalid' #126

Closed sylnp0201 closed 8 years ago

sylnp0201 commented 9 years ago

https://docs.npmjs.com/cli/shrinkwrap

Getting this error when I ran npm shrinkwrap:

npm ERR! invalid: react-router@1.0.0-rc3 /path-to-project/node_modules/react-router

Project environment:

edvinerikson commented 9 years ago

This should be opened in the react-router repo instead. However, I could not reproduce this.

edvin@rocket-raccoon  ~/code  mkdir test-shrinkwrap
edvin@rocket-raccoon  ~/code  cd test-shrinkwrap
edvin@rocket-raccoon  ~/code/test-shrinkwrap  npm init
....
edvin@rocket-raccoon  ~/code/test-shrinkwrap  nvm use 0.12
Now using node v0.12.7 (npm v2.11.3)
edvin@rocket-raccoon  ~/code/test-shrinkwrap  npm -v
2.11.3
edvin@rocket-raccoon  ~/code/test-shrinkwrap  npm i --save react-router@1.0.0-rc3 
react-router@1.0.0-rc3 node_modules/react-router
├── history@1.12.3 (deep-equal@1.0.1, qs@4.0.0)
├── warning@2.1.0 (loose-envify@1.1.0)
└── invariant@2.1.1 (loose-envify@1.1.0)
edvin@rocket-raccoon ~/code/test-shrinkwrap npm shrinkwrap
wrote npm-shrinkwrap.json
sylnp0201 commented 9 years ago

@edvinerikson You're right. I'm sorry that I didn't check the error message carefully. The reason I post it here was partially because I ran into another issue with npm shrinkwrap after I included the redux-router in my project. The problem was the extraneous history. It can be reproduced like this:

$ mkdir test-shrinkwrap
$ cd test-shrinkwrap
$ npm init
...
$ npm i --save redux-router@1.0.0-beta3 --save
$ npm shrinkwrap
npm ERR! Darwin 15.0.0
npm ERR! argv "~/.nvm/versions/node/v0.12.7/bin/node" "~/.nvm/versions/node/v0.12.7/bin/npm" "shrinkwrap"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3

npm ERR! Problems were encountered
npm ERR! Please correct and try again.
npm ERR! extraneous: history@1.9.0 ~/Workspace/test-shrinkwrap/node_modules/redux-router/node_modules/history
...
edvinerikson commented 9 years ago

I managed to reproduce this with your additional information. However I also managed to solve the problem by running npm prune. I'm not sure what causes npm to install the history package, @acdlite do you know what may be causing this?

apapirovski commented 9 years ago

This seems as expected from npm shrinkwrap and npm prune. The former will build based on whatever you have installed locally, including nested devDependencies. That's why you need to run the latter first.

jaroslawr commented 9 years ago

+1, I have the same problem. Isn't the issue here that almost all dependencies of redux-router are specified in devDependencies in its package.json? react, react-router, redux, etc. are certainly ordinary runtime dependencies, e.g. you can't run the app without them, they aren't there just for running the build or running the tests, so shouldn't they be under the ordinary "dependencies" key in package.json? react-router itself has history in its peerDependencies.

igl commented 9 years ago

See: https://github.com/rackt/redux-router/issues/54#issuecomment-140866571

jaroslawr commented 9 years ago

But why then in devDependencies, why not at least in the ordinary dependencies?

taion commented 8 years ago

It's a bug with npm packaging. The PR to fix it just got merged last week; not really a problem with this project and short of annoying workarounds in packaging there's no real way to address it here.

Wait for the next release after the next npm release.

timaschew commented 8 years ago

Why this issue is closed? As I understand you in https://github.com/npm/fstream-npm/pull/15#issuecomment-155112062 redux-router needs to be published with a fixed npm version to solve it. I still get the error with 1.0.0-beta4