npm犯错!注册表错误解析json -在Windows 8中试图安装Cordova用于Ionic框架。

时间:2022-10-09 23:21:43

I was trying to instal Ionic framework in my Windows 8 system and was trying to install Cordova first.

我试图在我的Windows 8系统中安装Ionic框架,并试图首先安装Cordova。

I'm getting this error while trying to install Cordova, that says

我在试图安装Cordova时犯了这个错误。

Your environment has been set up for using Node.js 0.12.4 (x64) and npm.

C:\Users\Sworup>npm install -g cordova ionic
npm ERR! registry error parsing json
npm ERR! tar.unpack untar error C:\Users\Sworup\AppData\Local\Temp\npm-1424-df7f
43fe\registry.npmjs.org\underscore\-\underscore-1.7.0.tgz
npm ERR! tar.unpack untar error C:\Users\Sworup\AppData\Local\Temp\npm-1424-df7f
43fe\registry.npmjs.org\npm\-\npm-2.1.3.tgz
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs
\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "cordova" "ionic"
npm ERR! node v0.12.4
npm ERR! npm  v2.10.1
npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR! syscall read

npm ERR! network read ECONNRESET
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settin
gs.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'
npm ERR! tar.unpack untar error C:\Users\Sworup\AppData\Local\Temp\npm-1424-df7f
43fe\registry.npmjs.org\prompt\-\prompt-0.2.12.tgz
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs
\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "cordova" "ionic"
npm ERR! node v0.12.4
npm ERR! npm  v2.10.1

npm ERR! unexpected eof
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\Sworup\npm-debug.log

C:\Users\Sworup>

My system configuration is as follows:

我的系统配置如下:

C:\Windows\System32>npm -v
2.10.1

C:\Windows\System32>node -v
v0.12.4

C:\Windows\System32>git --version
git version 1.9.4.msysgit.1

I already did

我已经做了

C:\Windows\System32>npm cache clear

before running the install command to no use.

在运行安装命令之前,不要使用。

I tried changing the registry to http still no use.

我尝试将注册表更改为http仍然没有使用。

I tried installing Ionic framework separately, still no luck.

我尝试单独安装Ionic框架,但还是没有成功。

I tried installing Phonegap, same errors as above.

我尝试安装Phonegap,与上面相同的错误。

I'm just stuck at this point and have no idea what to do.

我只是困在这一点,不知道该怎么办。

9 个解决方案

#1


68  

In my case, I had a very old version of npm. Upgrading npm using sudo npm install npm -g fixed the problem for me. Additionally I also did rm -rf node_modules and npm cache clean and npm config set registry "http://registry.npmjs.org/"

在我的例子中,我有一个非常旧的npm版本。使用sudo npm对npm进行升级,为我解决了问题。另外,我还做了rm -rf node_modules和npm缓存clean和npm配置注册表“http://registry.npmjs.org/”

#2


18  

I had similar problem. I rаn npm cache clear, closed android SDK manager(which was open before) and re-ran npm install -g cordova and that was enough to solve the problem.

我也有类似的问题。我rаn npm缓存,关闭android SDK经理(开放)和重复npm安装- g科尔多瓦,就足以解决问题。

#3


8  

npm config set registry "http://registry.npmjs.org"

Solved the issue for me. Note that it wouldn't accecpt a forward slash at the end of the url and it had to be entered exactly as shown above.

帮我解决了这个问题。注意,它不会在url的末尾处一个正斜杠,它必须按照上面显示的那样输入。

#4


4  

first I had to delete my registry by using npm config delete registry and register new value using npm config set registry "http://registry.npmjs.org"

首先,我必须使用npm配置删除注册表来删除注册表,并使用npm配置注册表“http://registry.npmjs.org”注册新值。

#5


1  

In my case all Internet access must run through a proxy and npm was not configured with the proxy to reach http://registry.npmjs.org.

在我的情况下,所有的Internet访问必须通过代理运行,而npm并没有被配置为访问http://registry.npmjs.org。

I ran npm install --log-level verbose to get more information and saw that the response had HTML stating I was not authenticated with the proxy.

我运行npm安装——loglevel verbose以获得更多的信息,并且看到响应有HTML声明我没有通过代理进行身份验证。

Running the following fixed it (replacing below with your username/password/proxy address:

运行以下修复程序(以您的用户名/密码/代理地址替换如下:

npm config set proxy 'username:password@your.proxy.com'
npm config set https-proxy 'username:password@your.proxy.com'

I do not advise putting the password in raw text instead using something like cntlm to set up a local proxy that delegates to the real proxy.

我不建议在原始文本中设置密码,而是使用像cntlm这样的东西来设置一个本地代理,委托给真正的代理。

#6


0  

I had this same problem when trying to upgrade pm2 to the latest version.

我在升级pm2到最新版本时遇到了同样的问题。

Thanks to sdm's answer I did npm update npm -g and it did the trick for me.

感谢sdm的回答,我做了npm更新的npm -g,它帮了我的忙。

#7


0  

npm install -g @angular/cli --registry http://registry.npmjs.org/ worked for me

npm安装-g @角/cli -注册表http://registry.npmjs.org/为我工作。

#8


0  

For me following fixed the issue:

对我来说,解决这个问题:

  1. npm cache clear
  2. npm缓存清除
  3. Made sure that NPM & Git proxies are set properly
  4. 确保正确设置NPM和Git代理。

In this case Git proxy may not be required.

在这种情况下,可能不需要Git代理。

#9


-1  

pls remove the

请删除

HTTP_PROXY HTTPS_PROXY proxy from the npmrc file

来自npmrc文件的HTTP_PROXY HTTPS_PROXY代理。

#1


68  

In my case, I had a very old version of npm. Upgrading npm using sudo npm install npm -g fixed the problem for me. Additionally I also did rm -rf node_modules and npm cache clean and npm config set registry "http://registry.npmjs.org/"

在我的例子中,我有一个非常旧的npm版本。使用sudo npm对npm进行升级,为我解决了问题。另外,我还做了rm -rf node_modules和npm缓存clean和npm配置注册表“http://registry.npmjs.org/”

#2


18  

I had similar problem. I rаn npm cache clear, closed android SDK manager(which was open before) and re-ran npm install -g cordova and that was enough to solve the problem.

我也有类似的问题。我rаn npm缓存,关闭android SDK经理(开放)和重复npm安装- g科尔多瓦,就足以解决问题。

#3


8  

npm config set registry "http://registry.npmjs.org"

Solved the issue for me. Note that it wouldn't accecpt a forward slash at the end of the url and it had to be entered exactly as shown above.

帮我解决了这个问题。注意,它不会在url的末尾处一个正斜杠,它必须按照上面显示的那样输入。

#4


4  

first I had to delete my registry by using npm config delete registry and register new value using npm config set registry "http://registry.npmjs.org"

首先,我必须使用npm配置删除注册表来删除注册表,并使用npm配置注册表“http://registry.npmjs.org”注册新值。

#5


1  

In my case all Internet access must run through a proxy and npm was not configured with the proxy to reach http://registry.npmjs.org.

在我的情况下,所有的Internet访问必须通过代理运行,而npm并没有被配置为访问http://registry.npmjs.org。

I ran npm install --log-level verbose to get more information and saw that the response had HTML stating I was not authenticated with the proxy.

我运行npm安装——loglevel verbose以获得更多的信息,并且看到响应有HTML声明我没有通过代理进行身份验证。

Running the following fixed it (replacing below with your username/password/proxy address:

运行以下修复程序(以您的用户名/密码/代理地址替换如下:

npm config set proxy 'username:password@your.proxy.com'
npm config set https-proxy 'username:password@your.proxy.com'

I do not advise putting the password in raw text instead using something like cntlm to set up a local proxy that delegates to the real proxy.

我不建议在原始文本中设置密码,而是使用像cntlm这样的东西来设置一个本地代理,委托给真正的代理。

#6


0  

I had this same problem when trying to upgrade pm2 to the latest version.

我在升级pm2到最新版本时遇到了同样的问题。

Thanks to sdm's answer I did npm update npm -g and it did the trick for me.

感谢sdm的回答,我做了npm更新的npm -g,它帮了我的忙。

#7


0  

npm install -g @angular/cli --registry http://registry.npmjs.org/ worked for me

npm安装-g @角/cli -注册表http://registry.npmjs.org/为我工作。

#8


0  

For me following fixed the issue:

对我来说,解决这个问题:

  1. npm cache clear
  2. npm缓存清除
  3. Made sure that NPM & Git proxies are set properly
  4. 确保正确设置NPM和Git代理。

In this case Git proxy may not be required.

在这种情况下,可能不需要Git代理。

#9


-1  

pls remove the

请删除

HTTP_PROXY HTTPS_PROXY proxy from the npmrc file

来自npmrc文件的HTTP_PROXY HTTPS_PROXY代理。