Can't install any packages in Node.js using “npm install”

前端 未结 6 1968
忘了有多久
忘了有多久 2020-12-01 11:36

I\'m new to Node.js, and I\'m going through a few tutorials. For some reason, I can\'t install any new node modules.

I am using: Mac OSX 10.7.4,

6条回答
  •  醉酒成梦
    2020-12-01 12:13

    The repository is not down, it looks like they've changed how they host files (I guess they have restored some old code):

    Now you have to add the /package-name/ before the -

    Eg:

    http://registry.npmjs.org/-/npm-1.1.48.tgz
    http://registry.npmjs.org/npm/-/npm-1.1.48.tgz
    

    There are 3 ways to solve it:

    • Use a complete mirror:
    • Use a public proxy:

      --registry http://165.225.128.50:8000

    • Host a local proxy:

      https://github.com/hughsk/npm-quickfix

    git clone https://github.com/hughsk/npm-quickfix.git
    cd npm-quickfix
    npm set registry http://localhost:8080/
    node index.js
    

    I'd personally go with number 3 and revert to npm set registry http://registry.npmjs.org/ as soon as this get resolved.

    Stay tuned here for more info: https://github.com/isaacs/npm/issues/2694

提交回复
热议问题