Phonegap doen't install in windows 10 with npm

355 Views Asked by At

When I try to install phonegap I got an error. If I use admin console I get the same errror:

C:\Windows\system32>npm i -g phonegap
npm WARN deprecated [email protected]: connect 2.x series is deprecated
npm WARN deprecated [email protected]: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
npm WARN deprecated [email protected]: Use uuid module instead
C:\Users\juand\AppData\Roaming\npm\phonegap -> C:\Users\juand\AppData\Roaming\npm\node_modules\phonegap\bin\phonegap.js
npm ERR! path C:\Users\juand\AppData\Roaming\npm\node_modules\phonegap\node_modules\nan\package.json
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\juand\AppData\Roaming\npm\node_modules\phonegap\node_modules\nan\package.json'
npm ERR!     at Error (native)
npm ERR!  { Error: EPERM: operation not permitted, unlink 'C:\Users\juand\AppData\Roaming\npm\node_modules\phonegap\node_modules\nan\package.json'
npm ERR!     at Error (native)
npm ERR!   stack: 'Error: EPERM: operation not permitted, unlink \'C:\\Users\\juand\\AppData\\Roaming\\npm\\node_modules\\phonegap\\node_modules\\nan\\package.json\'\n    at Error (native)',
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'unlink',
npm ERR!   path: 'C:\\Users\\juand\\AppData\\Roaming\\npm\\node_modules\\phonegap\\node_modules\\nan\\package.json' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\juand\AppData\Roaming\npm-cache\_logs\2017-09-05T21_35_02_068Z-debug.log

C:\Windows\system32>node -v
v6.11.2

C:\Windows\system32>npm -v
5.4.0

npm version is upgraded, node version is last 6.x (LTS). It seems it's working ok though.

2

There are 2 best solutions below

1
On

Hi did you got last version of nodejs and update

npm install npm 

try it if any change, i am on win10 its ok for me, same in debian jessie.

0
On

Every time I have a problem with the installation of packages and I get errors with the paths, I just go directly where the folder is supposed to live and delete it. In your case, look for the PhoneGap folder in C:\Users\juand\AppData\Roaming\npm\node_modules. Delete it and run phonegap -v to make sure that you get the message "'phonegap' is not recognized as an internal or external command, operable program or batch file". Now you can run npm i -g phonegap and it will start the process from scratch and you will never see that error message again. This happens because when packages are updated, the may change the order of their internal folders, hence the old path won't work. Cheers