npm ERR! cb()从未调用过!尝试运行npm install命令时出现错误 [英] npm ERR! cb() never called! error when trying to run npm install command

查看:1433
本文介绍了npm ERR! cb()从未调用过!尝试运行npm install命令时出现错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在另一台PC上有一个本机反应项目,现在我想继续在另一台Linux机器上处理此确切的项目文件夹.

I have this react-native project I worked on my other pc, and I want now to keep working on this exact project folder in my other linux machine.

因此,现在我有了项目文件夹,该文件夹不包含node_modules目录,但确实包含"package.json".据我了解,在目录内进行NPM安装时,应安装并创建具有所有必需依赖项的node_modules目录. 但是,一段时间后操作失败,并显示错误消息"npm ERR!cb()never call!".

So now I have the project folder, which doesn't contain node_modules directory, but it does contain "package.json". As I understood it, doing NPM install inside the directory, should install and create the node_modules directory with all the needed dependencies. However, the operation is failed after a while with the error "npm ERR! cb() never called!"

我已经尝试清理npm缓存(带有-f标志),但是对我来说不起作用. 我正在基于Node.js v8.10.0和npm v3.5.2.的基于Ubuntu 18.04的操作系统上运行.

I've already tried to clean npm cache (with -f flag) but it doesn't worked for me. I'm running on Ubuntu 18.04 based os with Node.js v8.10.0 and npm v3.5.2.

推荐答案

在我的情况下,我在package.json中有一个自己的自定义node_module,如下所示:

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时忘记了 发生了mysteriuos 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后面之后,错误变得更加明显,告诉我它与my-module有关.

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://stackoverflow.com/a/52474959/3063191

希望这会有所帮助:)

这篇关于npm ERR! cb()从未调用过!尝试运行npm install命令时出现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆