且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

npm 错误!cb() 从未调用过!尝试运行 npm install 命令时出错

更新时间:2021-06-30 22:50:33

就我而言,我有一个自己的自定义 node_module,它在我的 package.json 中,如下所示:

In my case, I had an own custom node_module which is in my package.json like that:

// ...
"dependencies": {
    // ...
    "my-module": "file:../../my-module",
},
// ...

此包仅在特定环境中可用(通过 npm install ../../my-module 动态添加到 package.json),这是有意为之,但我忘记了,当我在另一个环境中运行 npm install 时(我的模块可用)发生了 mysterios cb() never called 错误.

This package is only available in a specific environment (dynamically added to package.json via npm install ../../my-module), which is by intend, but I forgot about it and when I ran npm install in another environment (where my module was not available) the mysteriuos cb() never called error occured.

将选项 --no-package-lock 放在 npm install 后面后,错误变得更加清晰,告诉我它与 有关我的模块.

After putting the option --no-package-lock behind the npm install the error got more clear, telling me that it has something to do with my-module.

另见:https://***.com/a/52474959/3063191

希望这有帮助:)