无法检查过时的全局npm软件包

时间:2019-03-28 00:51:19

标签: node.js npm

我正在阅读npm教程,我们正在学习的一个命令是npm outdated -g,以检查是否有任何全局软件包已过期。

每当我运行该命令时,都会出现错误:

npm ERR! Cannot read property 'length' of undefined

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/samlegros/.npm/_logs/2019-03-28T00_46_47_834Z-debug.log

我正在运行npm 6.9.0node 10.15.2

以下是与之相关的错误日志:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'outdated', '-g' ]
2 info using npm@6.9.0
3 info using node@v10.15.2
4 verbose npm-session bc4abe7eb4488494
5 http fetch GET 304 https://registry.npmjs.org/express-generator 273ms (from cache)
6 silly pacote registry packument for express-generator@^4.16.0 fetched in 284ms
7 http fetch GET 304 https://registry.npmjs.org/http-server 278ms (from cache)
8 http fetch GET 304 https://registry.npmjs.org/text-table 274ms (from cache)
9 silly pacote registry packument for http-server@^0.11.1 fetched in 291ms
10 silly pacote registry packument for text-table@^0.2.0 fetched in 290ms
11 http fetch GET 304 https://registry.npmjs.org/jshint 278ms (from cache)
12 silly pacote registry packument for jshint@^2.10.1 fetched in 292ms
13 http fetch GET 304 https://registry.npmjs.org/node-dev 280ms (from cache)
14 http fetch GET 304 https://registry.npmjs.org/grunt-cli 285ms (from cache)
15 silly pacote registry packument for node-dev@^3.1.3 fetched in 294ms
16 silly pacote registry packument for grunt-cli@^1.3.2 fetched in 295ms
17 http fetch GET 304 https://registry.npmjs.org/create-react-app 289ms (from cache)
18 http fetch GET 304 https://registry.npmjs.org/sequelize-cli 283ms (from cache)
19 silly pacote registry packument for create-react-app@^2.1.8 fetched in 301ms
20-31...
32 silly pacote registry packument for ionic@^3.20.0 fetched in 344ms
33 http fetch GET 304 https://registry.npmjs.org/cordova 350ms (from cache)
34 silly pacote registry packument for cordova@^8.0.0 fetched in 370ms
35 http fetch GET 304 https://registry.npmjs.org/npm 364ms (from cache)
36 silly pacote registry packument for npm@^6.9.0 fetched in 391ms
37 verbose stack TypeError: Cannot read property 'length' of undefined
37 verbose stack     at dotindex (/usr/local/lib/node_modules/npm/node_modules/text-table/index.js:59:32)
37 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/text-table/index.js:11:21
37 verbose stack     at Array.forEach (<anonymous>)
37 verbose stack     at forEach (/usr/local/lib/node_modules/npm/node_modules/text-table/index.js:73:31)
37 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/text-table/index.js:10:9
37 verbose stack     at Array.reduce (<anonymous>)
37 verbose stack     at reduce (/usr/local/lib/node_modules/npm/node_modules/text-table/index.js:63:30)
37 verbose stack     at module.exports (/usr/local/lib/node_modules/npm/node_modules/text-table/index.js:9:20)
37 verbose stack     at /usr/local/lib/node_modules/npm/lib/outdated.js:130:16
37 verbose stack     at cb (/usr/local/lib/node_modules/npm/node_modules/slide/lib/async-map.js:47:24)
37 verbose stack     at outdated_ (/usr/local/lib/node_modules/npm/lib/outdated.js:221:12)
37 verbose stack     at skip (/usr/local/lib/node_modules/npm/lib/outdated.js:343:5)
37 verbose stack     at updateDeps (/usr/local/lib/node_modules/npm/lib/outdated.js:446:7)
37 verbose stack     at tryCatcher (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
37 verbose stack     at Promise.successAdapter [as _fulfillmentHandler0] (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/nodeify.js:23:30)
37 verbose stack     at Promise._settlePromise (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:566:21)
38 verbose cwd /Users/samlegros/Documents/Development/Tutorials/lynda-become-a-mern-stack-javascript-developer/learning-npm-the-node-package-manager/exercise-files/CH2/02_01/start
39 verbose Darwin 18.2.0
40 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "outdated" "-g"
41 verbose node v10.15.2
42 verbose npm  v6.9.0
43 error Cannot read property 'length' of undefined
44 verbose exit [ 1, true ]

任何帮助将不胜感激。谢谢。

1 个答案:

答案 0 :(得分:1)

根据github上的npm-cli,存在npm过时的问题。该问题已在几周前修复,因此您可能必须等到npm的下一个更新发布后才能发布此修复程序。

链接:npm outdated fix