Node.js npx如何决定要安装的软件包(原始:安装coc python时找不到模块';…/clean';)

Node.js npx如何决定要安装的软件包(原始:安装coc python时找不到模块';…/clean';),node.js,npm,npx,Node.js,Npm,Npx,(我从很多背景开始,这些背景与问题没有直接关系(但请说明我来自何方),但这可能对其他有类似问题的人非常有帮助(实际认识到他们有这个问题)) 在我的新M1 macbook上安装neovim和coc-*插件(,但其他人也有同样的问题)的过程中,我遇到了以下问题(我后来尝试并成功地在我的intel Big Sur macbook上复制了它,因此它似乎与M1无关) 我通过安装所有coc插件(因此使用PlugInstall而不是CocInstall)。因此,我的init.vim文件包含以下行(有关更多信息

(我从很多背景开始,这些背景与问题没有直接关系(但请说明我来自何方),但这可能对其他有类似问题的人非常有帮助(实际认识到他们有这个问题))

在我的新M1 macbook上安装neovim和
coc-*
插件(,但其他人也有同样的问题)的过程中,我遇到了以下问题(我后来尝试并成功地在我的intel Big Sur macbook上复制了它,因此它似乎与M1无关)

我通过安装所有coc插件(因此使用
PlugInstall
而不是
CocInstall
)。因此,我的
init.vim
文件包含以下行(有关更多信息,请参阅):

PlugInstall
在coc软件包上执行
warn install--freezed lockfile
命令,导致以下错误:

yarn install v1.22.10en-lockfile
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsis
tencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/5] Validating package.json...
warning coc-python@1.2.13: The engine "coc" appears to be invalid.
[2/5] Resolving packages...
[3/5] Fetching packages...
[4/5] Linking dependencies...
[5/5] Building fresh packages...
$ npx npm-run-all clean build
Watching /Users/XXXX/.vim/plugged/coc-python and all sub-directories not excluded by your .gitignore. Will not monitor dotfiles.
Found & ignored ./node_modules ; is listed in .gitignore

Starting: clean
node:internal/modules/cjs/loader:922
  throw err;
  ^

Error: Cannot find module '/Users/XXXXX/.vim/plugged/coc-python/clean'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:15)
    at Function.Module._load (node:internal/modules/cjs/loader:763:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
(在此之后,neovim在继续之前需要一个ctrl-c,以防其他人卡在这里……)

这花费了相当多的时间,但以下是我发现的(所有这些都是直接在命令行上发现的,没有vim的干扰):

  • warn install——冻结锁文件
    在某个点调用
    npx npm运行所有干净构建
    。第二个命令意味着(相当多)
    npm run clean和&npm run build
  • npx-npm-run-all-clean-build
    但是它并没有直接调用
    npm-run-clean
    ,而是调用
    npm-exec--run-clean
    (与
    npx-run-clean
    相同)
  • npm exec
    没有安装
    run
    模块,因此它将下载并安装该模块。这就是问题所在。它应该安装,但它会安装,这是一个完全不相关的软件包
  • 安装了
    run
    程序包后,将执行该程序包并生成错误消息(实际上,
    Watching/Users/XXXX/.vim/plucked/coc python和未被.gitignore.排除的所有子目录将不会监视点文件。
    line)
据我所知,无论是
run
软件包还是
npx-run
软件包还是
npm-run-all
软件包最近都没有任何更新(我在两个月前安装了几乎相同的软件,然后一切都很好)。不同之处在于,我现在使用的是节点15.3.0,而之前使用的是14.12.0。在我的旧intel macbook上,在
brew节点升级到最新版本后,它显示了相同的行为

解决方案似乎是执行
npm安装-g npx运行
;本地安装的软件包似乎覆盖了
npx
喜欢在后台下载的软件包

以上信息主要是为了防止其他人遇到同样的问题,或者试图了解发生了什么


问题: 所以我的实际问题(这将帮助我进一步调试):

  • 当我们调用
    npx run…
    时,
    npx
    如何决定下载哪个包?据我所知,它试图找到一个可执行
    run
    的包,但它如何在选项之间进行选择

  • 似乎
    npx run…
    现在已经坏了(至少有一个人是这样),而且可能是使用错误的(看起来你实际上可以给
    npx
    一个显式的包名)。我应该为此向上游提交一个bug(还不确定确切的位置),还是其他什么

yarn install v1.22.10en-lockfile
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsis
tencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/5] Validating package.json...
warning coc-python@1.2.13: The engine "coc" appears to be invalid.
[2/5] Resolving packages...
[3/5] Fetching packages...
[4/5] Linking dependencies...
[5/5] Building fresh packages...
$ npx npm-run-all clean build
Watching /Users/XXXX/.vim/plugged/coc-python and all sub-directories not excluded by your .gitignore. Will not monitor dotfiles.
Found & ignored ./node_modules ; is listed in .gitignore

Starting: clean
node:internal/modules/cjs/loader:922
  throw err;
  ^

Error: Cannot find module '/Users/XXXXX/.vim/plugged/coc-python/clean'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:15)
    at Function.Module._load (node:internal/modules/cjs/loader:763:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}