运行 `npm -g outdated` 时跳过一个包

问题描述

我手动更新了一个软件包,以便运行同一工具的多个版本(如 here 所述)。

现在,当我执行 npm -g outdated 时,我得到以下输出

$ npm -g outdate                         
npm notice 
npm notice New minor version of npm available! 7.18.1 -> 7.20.1
npm notice Changelog: https://github.com/npm/cli/releases/tag/v7.20.1
npm notice Run npm install -g npm@7.20.1 to update!
npm notice 
npm ERR! code ENOVERSIONS
npm ERR! No versions available for ask-cli-1

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/b/.npm/_logs/2021-07-24T13_02_50_529Z-debug.log

以下是日志内容,为简洁起见进行了编辑:

0 verbose cli [ '/usr/local/bin/node','/usr/local/bin/npm','-g','update' ]
1 info using npm@7.18.1
2 info using node@v16.4.1
...
9 timing config:load:file:/usr/local/lib/node_modules/ask-cli-1/.npmrc Completed in 0ms
...
33 silly fetch manifest ask-cli-1@*
34 http fetch GET 200 https://registry.npmjs.org/ask-cli-1 38ms (cache hit)
...
40 silly placeDep ROOT ask-cli-1@ OK for:  want: *
...
316 timing idealTree:node_modules/ask-cli-1 Completed in 0ms
...
1338 verbose stack ask-cli-1: No versions available for ask-cli-1
1338 verbose stack     at pickManifest (/usr/local/lib/node_modules/npm/node_modules/npm-pick-manifest/index.js:140:25)
1338 verbose stack     at module.exports (/usr/local/lib/node_modules/npm/node_modules/npm-pick-manifest/index.js:187:16)
1338 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/pacote/lib/registry.js:118:26
1338 verbose stack     at async Arborist.[nodeFromEdge] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:936:19)
1338 verbose stack     at async Arborist.[buildDepStep] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:882:11)
1338 verbose stack     at async Arborist.buildIdealTree (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:218:7)
1338 verbose stack     at async Arborist.reify (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:134:5)
1338 verbose stack     at async Update.update (/usr/local/lib/node_modules/npm/lib/update.js:72:5)
1339 verbose cwd /usr/local/lib/node_modules/ask-cli-1
1340 verbose Darwin 20.5.0
1341 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "-g" "update"
1342 verbose node v16.4.1
1343 verbose npm  v7.18.1
1344 error code ENOVERSIONS
1345 error No versions available for ask-cli-1
1346 verbose exit 1

有没有办法避免npm寻找ask-cli-1的版本?

解决方法

你不能排除 npm 过期的包。

但我推荐这个包:check-outdated

就你而言npm i -g check-outdated 然后: check-outdated --ignore-packages ask-cli-1 --columns name,type,current,latest,changes