Description:
Hi am encountering an error when I try to globally install ionic and cordova on my Windows pc. Below is the error am getting when I try to. Please, clearly advice on how I should go about it because its the first time am getting this error.
**C:\Windows\System32> npm install -g ionic cordova
npm ERR! Unexpected end of JSON input while parsing near '...,"stringstream":"~0.0'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\pc\AppData\Roaming\npm-cache_logs\2018-06-09T15_59_38_387Z-debug.log**
2018-06-09T15_59_38_387Z-debug.log
Hi, check this log file. I forgot to upload it before. Thank you!
@Elvis254 I highly recommend not running commands within your System32 folder. Have you tried installing the latest LTS Node & npm? I recommend Node 8 and then updating npm: npm install -g npm
@dwieeb am still getting the error even when not within my System32 folder. I have installed the latest Node. Below is the error am getting and attached is the log file.
C:> npm install -g ionic cordova
npm ERR! Unexpected end of JSON input while parsing near '...,"stringstream":"~0.0'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\pc\AppData\Roaming\npm-cache_logs\2018-06-11T19_53_09_890Z-debug.log
I need the output of node -v and npm -v
Did you try installing them separately? npm install -g ionic and then npm install -g cordova
Are you behind a network proxy?
What else have you tried?
node -v is v10.4.0 and npm -v is 6.1.0
Below is an error I get when I try npm install -g ionic
npm install -g ionic
npm ERR! Unexpected end of JSON input while parsing near '...:{"name":"qs","versio'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\pc\AppData\Roaming\npm-cache_logs\2018-06-11T20_22_08_987Z-debug.log
While npm install -g cordova gives me the error below.
C:> npm install -g cordova
npm ERR! Unexpected end of JSON input while parsing near '...,"stringstream":"~0.0'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\pc\AppData\Roaming\npm-cache_logs\2018-06-11T20_25_45_519Z-debug.log
Am not behind a proxy. I have also tried uninstalling Nodejs and installing a new version altogether. I think there is an error on the JSON being returned from one the repositories its installing on my pc.
Please try Node 8 and npm 5.
The npm registry is known to be buggy at times, but not for entire days. The entire world uses it. I am guessing something on your computer or network is interfering with the requests. Node 10 is also fairly unstable.
Hi, I have found a solution when using a Windows PC. You have to delete all files in these folders:
C:\Users\pc\AppData\Roaming\npm and
C:\Users\pc\AppData\Roaming\npm-cache
Then update your npm to the latest version by running npm i npm@latest -g
This should solve the JSON errors you are experiencing when globally installing ionic and cordova.
Thanks for following up on the solution, @Elvis254 !
I believe the npm cache clean command also works.
Just FYI, when I tried npm cache clean, it gives following message...
"npm ERR! As of npm@5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify' instead. On the other hand, if you're debugging an issue with the installer,
you can use npm install --cache /tmp/empty-cache to use a temporary cache instead of nuking the actual one."
npm install --cache /tmp/empty-cache works fine..
Hi, I have found a solution when using a Windows PC. You have to delete all files in these folders:
C:\Users\pc\AppData\Roaming\npmand
C:\Users\pc\AppData\Roaming\npm-cacheThen update your
npmto the latest version by runningnpm i npm@latest -gThis should solve the JSON errors you are experiencing when globally installing ionic and cordova.
You were perfect , thank you so muuuuuuuuuuuuuuuuuuuuch
Make sure that your package-lock.json file is alright. I stuck with this issue before because of missing curly brace in package-lock.json after pulling and fixing conflicts with other git commit.
This is what really solve my exact problem! https://github.com/npm/npm/issues/19072
Hi, I have found a solution when using a Windows PC. You have to delete all files in these folders:
C:\Users\pc\AppData\Roaming\npmand
C:\Users\pc\AppData\Roaming\npm-cacheThen update your
npmto the latest version by runningnpm i npm@latest -gThis should solve the JSON errors you are experiencing when globally installing ionic and cordova.
i got the same issue by tryng to install yeoman with npm, and your solution work perfectly for me thank
npm WARN tarball tarball data for https://registry.npmjs.org/npm/-/npm-6.7.0.tgz
(sha512-OtxCLzx+pcsjMGrjZpBp214ZjxzHcAe3zLYIlaVpRYqFHff6bgggyTLf2OZPO8lfxN0RHLJ
nFFUU016JCzM/Ww==) seems to be corrupted. Trying one more time.
npm ERR! path C:\Users\shiva\AppData\Local\Tempnpm-4032-edb6d9c5\unpack-dd47c30
4\CHANGELOG.md
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\shiva\AppData\L
ocal\Tempnpm-4032-edb6d9c5\unpack-dd47c304\CHANGELOG.md'
npm ERR! { [Error: EPERM: operation not permitted, unlink 'C:\Users\shiva\AppDa
ta\Local\Tempnpm-4032-edb6d9c5\unpack-dd47c304\CHANGELOG.md']
npm ERR! cause:
npm ERR! { Error: EPERM: operation not permitted, unlink 'C:\Users\shiva\AppD
ata\Local\Tempnpm-4032-edb6d9c5\unpack-dd47c304\CHANGELOG.md'
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path:
npm ERR! 'C:\Users\shiva\AppData\Local\Temp\npm-4032-edb6d9c5\unpac
k-dd47c304\CHANGELOG.md' },
npm ERR! isOperational: true,
npm ERR! stack:
npm ERR! 'Error: EPERM: operation not permitted, unlink \'C:\Users\shiva\A
ppData\Local\Temp\npm-4032-edb6d9c5\unpack-dd47c304\CHANGELOG.md\'',
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path:
npm ERR! 'C:\Users\shiva\AppData\Local\Temp\npm-4032-edb6d9c5\unpack-d
d47c304\CHANGELOG.md' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or ant
ivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check t
he
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended
).
showing error when i use this npm i npm@latest -g
i tried to run as admin too
I'm going to lock this as the issues in this repo should be reserved for feature requests and bug reports of the Ionic CLI.
A better place for these discussions is Stack Overflow or the Ionic Forum. See our Support page for Community Support options.
Most helpful comment
Hi, I have found a solution when using a Windows PC. You have to delete all files in these folders:
C:\Users\pc\AppData\Roaming\npmandC:\Users\pc\AppData\Roaming\npm-cacheThen update your
npmto the latest version by runningnpm i npm@latest -gThis should solve the JSON errors you are experiencing when globally installing ionic and cordova.