npm安装错误 - cb()从未调用过

时间:2017-10-09 12:13:30

标签: npm

我尝试在我下载的角度项目中安装node_module,但是我收到此错误:

  

npm ERR!注册表错误解析json

然后我使用npm intall npm -g重新安装npm,当我尝试使用npm install后,我收到此错误:

(node:11252) UnhandledPromiseRejectionWarning: Unhandled promise
rejection (rejection id: 1): Error: ENOENT: no such file or directory, stat
'C:\Users\User\AppData\Roaming\npm-cache\_cacache\tmp\git-clone-ec5da46c\angular\cdk.es5.js'

的debug.log:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\User\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install' ]
2 info using npm@5.4.2
3 info using node@v6.10.2
4 verbose npm-session ff5ce249dfe37f0e
5 silly install runPreinstallTopLevelLifecycles
6 silly preinstall spa@0.0.0
7 info lifecycle spa@0.0.0~preinstall: spa@0.0.0
8 silly install loadCurrentTree
9 silly install readLocalPackageData
10 silly install loadIdealTree
11 silly install cloneCurrentTreeToIdealTree
12 silly install loadShrinkwrap
13 info lifecycle @angular/cdk@2.0.0-beta.10-a7ce31e~prepack: @angular/cdk@2.0.0-beta.10-a7ce31e
14 error cb() never called!
15 error This is an error with npm itself. Please report this error at:
16 error <https://github.com/npm/npm/issues>

我已经尝试npm cache clean --force,但我得到同样的错误。

node -v v6.10.2
npm -v 5.4.2

9 个答案:

答案 0 :(得分:3)

我有同样的问题。我解决了

通过排除package-lock.json文件

def encrypt(message):
    words = message.split(" ")
    vowels=("aeiouAEIOU")
    encrypted_words = []
    for word in words:
        if any(letter not in vowels for letter in word):
            word = ''.join([letter for letter in word if letter not in vowels])
        encrypted_words.append(word)
    return " ".join(encrypted_words)

或通过手动删除package-lock.json

答案 1 :(得分:0)

确保在角项目的根目录中有一个package.json文件,该文件看起来与此类似。

https://github.com/heroku/node-js-sample/blob/master/package.json

如果package.json文件存在,则运行npm install以保存包,并为您生成node_modules目录。

但是,如果文件不存在,则意味着您必须通过运行npm i -y将npm初始化到项目中,npm install npm -g应自动为您创建package.json文件,并允许您安装节点模块。

NB:您的计算机上已经安装了npm,因此运行 <meta name="description" content="Description is here" /> <meta property="og:image" content="http://www.example.com/images/11.png" /> <meta name="keywords" content="Business Intelligence, Big Data, Data driven" /> <meta name="developer" content="companyName"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">并不理想。

答案 2 :(得分:0)

运行npm clean cache --force并执行安装。

答案 3 :(得分:0)

当我的package.json使用文件file:../(本地路径)引用一个包并且目录不存在时,出现了此错误。将其指向正确的路径即可解决该错误。

答案 4 :(得分:0)

我有同样的问题。我通过删除nodejs @ 10并安装nodejs @ 8

来解决它

答案 5 :(得分:0)

就我而言...以上都不起作用。然后,我删除了package-lock.json。当我运行npm安装时,出现错误,表明在存储库中找不到某个软件包。当我从package.json中删除该文件时,我的npm安装成功了!

答案 6 :(得分:0)

我有同样的问题。就我而言,它是由.npmrc文件中的语法错误引起的,该文件是手动编辑的

答案 7 :(得分:0)

在 Windows 10 上运行 npm install 给了我这个错误。

我在 Administrator: Command Prompt 中解决了这个问题。

答案 8 :(得分:0)

方法一: npm clean cache --force 然后安装您的软件包

方法二: 禁用您的防病毒软件并尝试安装您的包

方法三: 这是您的互联网连接,如果您使用的是 Wifi 或以太网连接,请使用您的蜂窝网络或其他网络并尝试安装您的软件包