Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
338 views
in Technique[技术] by (71.8m points)

gruntjs - npm windows install globally results in npm ERR! extraneous

I am new to grunt and npm. So I am trying some "cookbook-example" on the site 'http://tech.pro/tutorial/1190/package-managers-an-introductory-guide-for-the-uninitiated-front-end-developer#front_end_developers'. You should not have to look there now, but I thought it could be good to share the site. So far so good, til it comes to the global installing. (Ok, some errors I had to figure out, but now I have working npm).

When it comes to the point trying to install something globally I get stuck.

What I did so far for testing globally installing some package:

  1. Created test-directory grunttest

  2. Inside that directory:

    npm install -g jshint

Output I can see:

 npm http GET https://registry.npmjs.org/jshint
 npm http 304 https://registry.npmjs.org/jshint
 ...
 npm http 304 https://registry.npmjs.org/string_decoder
 C:Program Files
odejs
ode_modules
pmjshint -> C:Program Files
odejs
ode_modules
pm
ode_modulesjshinnt
 jshint@2.4.4 C:Program Files
odejs
ode_modules
pm
ode_modulesjshint
 ├── console-browserify@0.1.6
 ├── exit@0.1.2
 ├── underscore@1.4.4
 ├── shelljs@0.1.4
 ├── minimatch@0.2.14 (sigmund@1.0.0, lru-cache@2.5.0)
 ├── cli@0.4.5 (glob@3.2.9)
 └── htmlparser2@3.3.0 (domelementtype@1.1.1, domutils@1.1.6, domhandler@2.1.0, readable-stream@1.0.26-2)

I just realize the 304, which should be ok, due to just says the resource was not modified since last installation (few minutes before).

Checking if the jshint exists with:

`npm -global list`

Output:

npm@1.4.3 C:Program Files
odejs
ode_modules
pm
├── abbrev@1.0.4
├── ansi@0.2.1
├─...
├──
├── graceful-fs@2.0.2
├── inherits@2.0.1
├── ini@1.1.0
├─┬ init-package-json@0.0.14
│ └── promzard@0.2.1
├─┬ jshint@2.4.4 extraneous
│ ├─┬ cli@0.4.5
│ │ └─┬ glob@3.2.9
│ │   └── inherits@2.0.1
│ ├── console-browserify@0.1.6
│ ├── exit@0.1.2
│ ├─┬ htmlparser2@3.3.0
│ │ ├── domelementtype@1.1.1
│ │ ├── domhandler@2.1.0
│ │ ├── domutils@1.1.6
│ │ └─┬ readable-stream@1.0.26-2
│ │   └─... ├── text-table@0.2.0
├── uid-number@0.0.3
└── which@1.0.5

**npm ERR! extraneous: jshint@2.4.4 C:Program Files
odejs
ode_modules
pm
ode_modulesjshint npm**

Questions:

  1. Why do I get npm ERR! extraneous ...?
  2. What does it mean?
  3. How can I resolve this issue?

Information:

I am on a windows-machine Windows 7, using cygwin as shell. trying to just the jshint (jshint someTestfile.js) of course does not work.

Thanks in advance, Meru

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

npm ERR! extraneous means a package is installed but is not listed in your project's package.json.

Since you're listing packages that have been installed globally, it's going to give you a lot of extraneous errors that can be simply ignored because most things installed globally will not be in your project's package.json.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...