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

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

问题描述

我在另一台电脑上有这个 react-native 项目,现在我想继续在我的另一台 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 called!"

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 标志),但它对我不起作用.我在基于 Ubuntu 18.04 的操作系统上运行,使用 Node.js v8.10.0 和 npm v3.5.2.

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.

推荐答案

就我而言,我有一个自己的自定义 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://stackoverflow.com/a/52474959/3063191

希望这有帮助:)

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

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