gpt4 book ai didi

node.js - 无法检查过时的全局 npm 包

转载 作者:搜寻专家 更新时间:2023-11-01 00:48:36 24 4
gpt4 key购买 nike

我正在阅读 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 ]

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

最佳答案

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

链接:npm outdated fix

关于node.js - 无法检查过时的全局 npm 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55388605/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com