在本地安装包会出错

时间:2017-02-27 10:47:59

标签: npm npm-install

当我尝试安装软件包时,我收到此错误。此外,所有其他软件包的安装都没有任何问题。我怎么能解决这个问题。如果我将标志更改为-g(全局)它可以工作,但我需要它在我的项目中

 npm install --save express-validator
    npm http GET https://registry.npmjs.org/express-validator
    npm http 304 https://registry.npmjs.org/express-validator
    npm http GET https://registry.npmjs.org/lodash
    npm http GET https://registry.npmjs.org/validator
    npm http 304 https://registry.npmjs.org/lodash
    npm http 304 https://registry.npmjs.org/validator
    npm http GET https://registry.npmjs.org/types/bluebird
    npm http GET https://registry.npmjs.org/types/express
    npm http 404 https://registry.npmjs.org/types/bluebird
    npm ERR! TypeError: Cannot read property 'latest' of undefined
    npm ERR!     at next (/usr/share/npm/lib/cache.js:687:35)
    npm ERR!     at /usr/share/npm/lib/cache.js:675:5
    npm ERR!     at saved (/usr/share/npm/node_modules/npm-registry-client/lib/get.js:142:7)
    npm ERR!     at /usr/lib/nodejs/graceful-fs/polyfills.js:133:7
    npm ERR!     at Object.oncomplete (fs.js:107:15)
    npm ERR! If you need help, you may report this log at:
    npm ERR!     <http://github.com/isaacs/npm/issues>
    npm ERR! or email it to:
    npm ERR!     <npm-@googlegroups.com>

    npm ERR! System Linux 3.19.0-30-generic
    npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "--save" "express-validator"
    npm ERR! cwd /home/prog/work/appJS
    npm ERR! node -v v0.10.25
    npm ERR! npm -v 1.3.10
    npm ERR! type non_object_property_load
    npm http 404 https://registry.npmjs.org/types/express
    npm ERR! TypeError: Cannot read property 'latest' of undefined
    npm ERR!     at next (/usr/share/npm/lib/cache.js:687:35)
    npm ERR!     at /usr/share/npm/lib/cache.js:675:5
    npm ERR!     at saved (/usr/share/npm/node_modules/npm-registry-client/lib/get.js:142:7)
    npm ERR!     at /usr/lib/nodejs/graceful-fs/polyfills.js:133:7
    npm ERR!     at Object.oncomplete (fs.js:107:15)
    npm ERR! If you need help, you may report this log at:
    npm ERR!     <http://github.com/isaacs/npm/issues>
    npm ERR! or email it to:
    npm ERR!     <npm-@googlegroups.com>

    npm ERR! System Linux 3.19.0-30-generic
    npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "--save" "express-validator"
    npm ERR! cwd /home/prog/work/appJS
    npm ERR! node -v v0.10.25
    npm ERR! npm -v 1.3.10
    npm ERR! type non_object_property_load
    npm ERR! 
    npm ERR! Additional logging details can be found in:
    npm ERR!     /home/prog/work/appJS/npm-debug.log
    npm ERR! not ok code 0

1 个答案:

答案 0 :(得分:1)

当你的npm版本关闭或库被删除时会发生这种情况。

你需要更新你的npm版本...... !!

npm update npm@latest