npm ERR! Unexpected end of input at 1:379680

2019-04-02 10:54发布

问题:

I recently installed the latest version of nodejs i.e v8.1.3 and I am using windows 10

After that, i wanted to install the cordova and ionic packages so I ran the command

npm install -g ionic cordova

after running this command I am getting the below error! I am fed up as this error isn't available in Google search also yet.

This is the error log I am getting on the cmd console

npm ERR! Unexpected end of input at 1:379680
npm ERR! .1","osenv":"~0.1.3","path-is inside":"~1.0.1","read":"~1.0.7","read-
npm ERR!                                                                      ^                                                           
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\SYS73M CR4CK3R\AppData\Roaming\npm-cache\_logs\2017-07-10T13_45_29_711Z-debug.log

Pls, help _/_

回答1:

What solved it for me was running

npm cache clean --force


回答2:

"Unexpected end of input" means can not download file,use "npm config set registry https://registry.npm.xxxxx.org " change the mirroring adress.



回答3:

Same here, and fixed with @Thomas' idea.

I think you should read the debug.log, mine has a lot of "http fetch GET 304 https://xxxxxxx (from cache)" in it, so it seems like something wrong with npm cache.



回答4:

This happens mostly due to poor internet connection. fix your internet issues then run npm cache clean --force and then run npm install -g ionic cordova