Skip to content
This repository has been archived by the owner. It is now read-only.

when "npm install" is used with package.json, module gets installed under itself #3958

Closed
cowboy opened this issue Oct 1, 2013 · 5 comments
Closed

Comments

@cowboy
Copy link

@cowboy cowboy commented Oct 1, 2013

Yes, the error appears to be very specific, tested in node v0.10.19 and npm@1.3.11. Also note that I simplified my package.json file temporarily to help with troubleshooting.

My environment:

$ npm --version
1.3.11

$ pwd
/Users/cowboy/repos/gruntjs/grunt

$ cat package.json
{
  "name": "grunt",
  "version": "0.4.2-0",
  "repository": {
    "type": "git",
    "url": "git://github.com/gruntjs/grunt.git"
  },
  "devDependencies": {
    "grunt-contrib-copy": "*"
  }
}

In this example, both npm install behaviors work as expected.

$ rm -rf node_modules/

$ npm install grunt
npm WARN install Refusing to install grunt as a dependency of itself

$ npm install --silent grunt-contrib-copy
grunt-contrib-copy@0.4.1 node_modules/grunt-contrib-copy

$ tree -L 1 node_modules/
node_modules/
└── grunt-contrib-copy

1 directory, 0 files

Running npm install with a package.json file doesn't work as expected. In case it helps debug, note that grunt is both a devDependency and a peerDependency of grunt-contrib-copy. See that project's package.json.

$ rm -rf node_modules/

$ npm install --silent
grunt@0.4.1 node_modules/grunt
├── which@1.0.5
├── dateformat@1.0.2-1.2.3
├── eventemitter2@0.4.13
├── colors@0.6.2
├── hooker@0.2.3
├── async@0.1.22
├── coffee-script@1.3.3
├── underscore.string@2.2.1
├── iconv-lite@0.2.11
├── lodash@0.9.2
├── findup-sync@0.1.2 (lodash@1.0.1)
├── nopt@1.0.10 (abbrev@1.0.4)
├── rimraf@2.0.3 (graceful-fs@1.1.14)
├── minimatch@0.2.12 (sigmund@1.0.0, lru-cache@2.3.1)
├── glob@3.1.21 (inherits@1.0.0, graceful-fs@1.2.3)
└── js-yaml@2.0.5 (esprima@1.0.4, argparse@0.1.15)

grunt-contrib-copy@0.4.1 node_modules/grunt-contrib-copy

$ tree -L 1 node_modules/
node_modules/
├── grunt
└── grunt-contrib-copy

2 directories, 0 files
cowboy referenced this issue in gruntjs/grunt Dec 18, 2013
* This should allow the build to pass again.
cowboy referenced this issue in gruntjs/grunt Mar 6, 2014
* This doesn't work when "npm install" is run as root.
* When devving grunt, the user should follow "npm install" with "npm uninstall grunt" to work around the isaacs/npm#3958 issue. This will be reflected in the docs.
cowboy referenced this issue in gruntjs/grunt Mar 6, 2014
* This doesn't work when "npm install" is run as root.
* When devving grunt, the user should follow "npm install" with "npm uninstall grunt" to work around the isaacs/npm#3958 issue. This will be reflected in the docs.
jamesplease referenced this issue in jamesplease/grunt Mar 12, 2014
.

* This doesn't work when "npm install" is run as root.
* When devving grunt, the user should follow "npm install" with "npm uninstall grunt" to work around the isaacs/npm#3958 issue. This will be reflected in the docs.
jamesplease referenced this issue in jamesplease/grunt Mar 12, 2014
.

* This doesn't work when "npm install" is run as root.
* When devving grunt, the user should follow "npm install" with "npm uninstall grunt" to work around the isaacs/npm#3958 issue. This will be reflected in the docs.
@othiym23 othiym23 added the bug label Oct 10, 2014
@smikes
Copy link
Contributor

@smikes smikes commented Nov 19, 2014

I reproduced this behavior with 2.1.8, which is npm@latest. I suspect this one of the the issues that will magically go away when multi-stage install lands, so I will just tag @iarna as an FYI.

Loading

@othiym23
Copy link
Contributor

@othiym23 othiym23 commented Nov 25, 2014

Hey Ben, we've made a bunch of tweaks to peerDependencies over the last year, so if you could confirm whether this is still an issue, that would be awesome.

Loading

@cowboy
Copy link
Author

@cowboy cowboy commented May 5, 2015

This is still happening.

$ npm --version
2.7.6

$ npm install
npm WARN peerDependencies The peer dependency grunt@~0.4.0 included from grunt-contrib-nodeunit will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN peerDependencies The peer dependency grunt@~0.4.2 included from grunt-jscs will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN peerDependencies The peer dependency grunt@~0.4.0 included from grunt-contrib-jshint will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN peerDependencies The peer dependency grunt@~0.4.0 included from grunt-contrib-watch will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
dateformat@1.0.2-1.2.3 node_modules/dateformat

eventemitter2@0.4.14 node_modules/eventemitter2

rimraf@2.2.8 node_modules/rimraf

exit@0.1.2 node_modules/exit

semver@2.1.0 node_modules/semver

nopt@1.0.10 node_modules/nopt
└── abbrev@1.0.5

shelljs@0.2.6 node_modules/shelljs

temporary@0.0.8 node_modules/temporary
└── package@1.0.1

minimatch@0.2.14 node_modules/minimatch
├── sigmund@1.0.0
└── lru-cache@2.6.2

glob@3.1.21 node_modules/glob
├── inherits@1.0.0
└── graceful-fs@1.2.3

difflet@0.2.6 node_modules/difflet
├── deep-is@0.1.3
├── charm@0.1.2
└── traverse@0.6.6

coffee-script@1.3.3 node_modules/coffee-script

grunt-legacy-util@0.2.0 node_modules/grunt-legacy-util
├── which@1.0.9
├── getobject@0.1.0
├── async@0.1.22
├── hooker@0.2.3
├── lodash@0.9.2
└── underscore.string@2.2.1

iconv-lite@0.2.11 node_modules/iconv-lite

findup-sync@0.1.3 node_modules/findup-sync
├── glob@3.2.11 (inherits@2.0.1, minimatch@0.3.0)
└── lodash@2.4.2

grunt-legacy-log@0.1.1 node_modules/grunt-legacy-log
├── colors@0.6.2
├── hooker@0.2.3
├── underscore.string@2.3.3
└── lodash@2.4.2

js-yaml@2.0.5 node_modules/js-yaml
├── argparse@0.1.16 (underscore.string@2.4.0, underscore@1.7.0)
└── esprima@1.0.4

grunt-contrib-watch@0.5.3 node_modules/grunt-contrib-watch
├── tiny-lr@0.0.4 (debug@0.7.4, faye-websocket@0.4.4, noptify@0.0.3, qs@0.5.6)
└── gaze@0.4.3 (globule@0.1.0)

grunt@0.4.5 node_modules/grunt
├── which@1.0.9
├── getobject@0.1.0
├── colors@0.6.2
├── async@0.1.22
├── hooker@0.2.3
├── lodash@0.9.2
└── underscore.string@2.2.1

grunt-contrib-jshint@0.6.5 node_modules/grunt-contrib-jshint
└── jshint@2.1.11 (console-browserify@0.1.6, cli@0.4.5, underscore@1.4.4, shelljs@0.1.4)

grunt-jscs@1.5.0 node_modules/grunt-jscs
├── vow@0.4.9
├── hooker@0.2.3
├── lodash@2.4.2
└── jscs@1.11.3 (strip-json-comments@1.0.2, supports-color@1.2.1, cli-table@0.3.1, commander@2.6.0, estraverse@1.9.3, colors@1.0.3, vow-fs@0.3.4, glob@4.3.5, lodash.assign@3.0.0, minimatch@2.0.7, esprima-harmony-jscs@1.1.0-tolerate-import, prompt@0.2.14, esprima@1.2.5, xmlbuilder@2.5.2)

grunt-contrib-nodeunit@0.4.1 node_modules/grunt-contrib-nodeunit
├── hooker@0.2.3
└── nodeunit@0.9.1 (tap@0.7.1)

$ grunt --version
grunt-cli v0.1.13
grunt v0.4.5

$ rm -rf node_modules/grunt

$ grunt --version
grunt-cli v0.1.13
grunt v0.4.6-0

Loading

@npm-robot
Copy link

@npm-robot npm-robot commented Jun 19, 2017

We're closing this issue as it has gone thirty days without activity. In our experience if an issue has gone thirty days without any activity then it's unlikely to be addressed. In the case of bug reports, often the underlying issue will be addressed but finding related issues is quite difficult and often incomplete.

If this was a bug report and it is still relevant then we encourage you to open it again as a new issue. If this was a feature request then you should feel free to open it again, or even better open a PR.

For more information about our new issue aging policies and why we've instituted them please see our blog post.

Loading

@npm-robot npm-robot closed this Jun 19, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants