npm windows安装全局结果为npm ERR!外来 [英] npm windows install globally results in npm ERR! extraneous

查看:528
本文介绍了npm windows安装全局结果为npm ERR!外来的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对grunt和npm是新手。所以我正在尝试一些cookbook-example在网站上 http://tech.pro/tutorial/1190/package-managers-an-introductory-guide-for-the-uninitiated-front-end-developer#front_end_developers
您现在不必去那里看,但我认为分享这个网站可能会很好。
到目前为止,这很好,直到全球安装。 (好吧,我必须弄清楚一些错误,但现在我已经在使用npm了)。

当谈到在全球安装某些东西时,我会陷入困境。 / p>

我到目前为止测试了全局安装某些软件包:


  1. 创建测试目录 grunttest


  2. p>

    npm install -g jshint


输出我可以看到:

  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:\程序文件\ nodejs \ node_modules \ npm \ jshint - > C:\程序文件\\\
odejs\\\
ode_modules\\\
pm\\\
ode_modules\jshinnt
jshint@2.4.4 C:\程序文件\\\
odejs\\\
ode_modules\\\
pm\\\
ode_modules\ jshint
├──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)

我刚刚意识到304,这应该是好的,因为刚才说安装后资源没有被修改(几分钟前)。



检查jshint是否存在:

 `npm -global list` 

输出:

  npm@1.4.3 C:\程序文件\\\
odejs\\\
ode_modules\\\
pm
├──abbrev@1.0.4
├──ansi@0.2.1
├─...
├──
├──优雅-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无关
│├─┬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错误! extraneous:jshint@2.4.4 C:\ Program Files \\\
odejs\\\
ode_modules\\\
pm\\\
ode_modules\jshint npm **

问题:
$ b


  1. 为什么我得到npm ERR!无关......?

  2. 这是什么意思?


  3. $ b

    信息:

  4. / em>



    我在一台Windows机器的Windows 7上,使用cygwin作为shell。
    试图只是jshint( jshint someTestfile.js )当然不起作用。



    谢谢提前,梅鲁

    解决方案

    npm ERR!多余的表示安装了一个软件包,但未在您的项目的 package.json 中列出。



    由于您列出了已在全球范围内安装的软件包,因此它会给您带来很多无关的错误,因为大多数全局安装的东西不会包含在您的项目的 package.json


    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\nodejs\node_modules\npm\jshint -> C:\Program Files\nodejs\node_modules\npm\node_modules\jshinnt
     jshint@2.4.4 C:\Program Files\nodejs\node_modules\npm\node_modules\jshint
     ├── 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\nodejs\node_modules\npm
    ├── 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\nodejs\node_modules\npm\node_modules\jshint 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

    解决方案

    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.

    这篇关于npm windows安装全局结果为npm ERR!外来的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆