简体   繁体   中英

Why are `npm update -g` & `npm outdated` not working after upgrading npm from 2.10.1 to 3.5.2?

I get two similar errors now after updating npm from 2.10.1 to 3.5.2.

npm was updated by running npm update -g

I'm running node v0.12.4 on OSX 10.10.5, installed via homebrew

Two error messages

1 Here is the error I now get from running npm outdated -g --depth=0 :

npm ERR! Darwin 14.5.0
npm ERR! argv "node" "/usr/local/bin/npm" "outdated" "-g" "--depth=0"
npm ERR! node v0.12.4
npm ERR! npm  v3.5.2
npm ERR! code EMISSINGARG

npm ERR! typeerror Error: Missing required argument #1
npm ERR! typeerror     at module.exports (/usr/local/lib/node_modules/npm/lib/install/mutate-into-logical-tree.js:12:3)
npm ERR! typeerror     at /usr/local/lib/node_modules/npm/lib/outdated.js:78:5
npm ERR! typeerror     at /usr/local/lib/node_modules/npm/lib/outdated.js:62:20
npm ERR! typeerror     at /usr/local/lib/node_modules/npm/node_modules/read-package-tree/rpt.js:186:9
npm ERR! typeerror     at f (/usr/local/lib/node_modules/npm/node_modules/once/once.js:17:25)
npm ERR! typeerror     at /usr/local/lib/node_modules/npm/node_modules/read-package-tree/rpt.js:152:20
npm ERR! typeerror     at f (/usr/local/lib/node_modules/npm/node_modules/once/once.js:17:25)
npm ERR! typeerror     at then (/usr/local/lib/node_modules/npm/node_modules/read-package-tree/rpt.js:121:22)
npm ERR! typeerror     at /usr/local/lib/node_modules/npm/node_modules/read-package-tree/rpt.js:81:20
npm ERR! typeerror     at fs.js:1518:23
npm ERR! typeerror This is an error with npm itself. Please report this error at:
npm ERR! typeerror     <http://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/brianzelip/npm-debug.log

2 Here's the error message I now get from running npm update -g :

npm ERR! Darwin 14.5.0
npm ERR! argv "node" "/usr/local/bin/npm" "update" "-g"
npm ERR! node v0.12.4
npm ERR! npm  v3.5.2
npm ERR! code EMISSINGARG

npm ERR! typeerror Error: Missing required argument #1
npm ERR! typeerror     at module.exports (/usr/local/lib/node_modules/npm/lib/install/mutate-into-logical-tree.js:12:3)
npm ERR! typeerror     at /usr/local/lib/node_modules/npm/lib/outdated.js:78:5
npm ERR! typeerror     at /usr/local/lib/node_modules/npm/lib/outdated.js:62:20
npm ERR! typeerror     at /usr/local/lib/node_modules/npm/node_modules/read-package-tree/rpt.js:186:9
npm ERR! typeerror     at f (/usr/local/lib/node_modules/npm/node_modules/once/once.js:17:25)
npm ERR! typeerror     at /usr/local/lib/node_modules/npm/node_modules/read-package-tree/rpt.js:152:20
npm ERR! typeerror     at f (/usr/local/lib/node_modules/npm/node_modules/once/once.js:17:25)
npm ERR! typeerror     at then (/usr/local/lib/node_modules/npm/node_modules/read-package-tree/rpt.js:121:22)
npm ERR! typeerror     at /usr/local/lib/node_modules/npm/node_modules/read-package-tree/rpt.js:81:20
npm ERR! typeerror     at fs.js:1518:23
npm ERR! typeerror This is an error with npm itself. Please report this error at:
npm ERR! typeerror     <http://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/brianzelip/npm-debug.log

在我的情况下,这是因为有一个全局软件包符号链接,其目标已被删除。

The EMISSINGARG error is thrown when npm finds a linked package without a package.json file. But also to any subpackage in those linked packages.

Steps I did to fix it:

1) find out where global packages are installed. In my case:

$ npm config get prefix
C:\Program Files\nodejs

2) Look for missing npm linked packages with any empty package folders.

cd 'C:\Program Files\nodejs'
ls -l node_modules

3) Delete all broken links.

rm node_modules/brocken-package

FIXED! You can install global packages again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM