Cant install Plugin

i try to install the plugin “cordova-plugin-network-information” (as administrator) via

npm install --save @ionic-native/network

the process stops at:

/ postinstall: info lifecycle @ionic-native/network@4.2.1~postinstall: @ionic-native/network@4.2.1

and i get the following error:

npm ERR! path C:\path\node_modules\fsevents\node_modules\ansi-regex\package.json
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\path\node_modules\fsevents\node_modules\ansi-regex\package.json'
npm ERR!     at Error (native)
npm ERR!  { Error: EPERM: operation not permitted, unlink 'C:\path\node_modules\fsevents\node_modules\ansi-regex\package.json'
npm ERR!     at Error (native)
npm ERR!   stack: 'Error: EPERM: operation not permitted, unlink \'C:\\path\\node_modules\\fsevents\\node_modules\\ansi-regex\\package.json\'\n    
at Error (native)',
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'unlink',
npm ERR!   path: 'C:\\path\\node_modules\\fsevents\\node_modules\\ansi-
regex\\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\username\AppData\Roaming\npm-cache\_logs\2017-09-05T09_43_58_528Z-debug.log

Info:

cli packages: (C:\Users\username.npm-packages\node_modules)

@ionic/cli-utils  : 1.9.2
ionic (Ionic CLI) : 3.9.2

global packages:

Cordova CLI : 7.0.1

local packages:

@ionic/app-scripts : 1.1.4
Cordova Platforms  : android 6.2.1
Ionic Framework    : ionic-angular 2.3.0

System:

Node : v6.9.4
npm  : 5.4.0
OS   : Windows 10

Please help.

Your problem is probably with npm, something to do with permissions and files. This happens quite often and is almost impossible to successfully debug (at least here in the forum).

One solution: Uninstall your node, install nvm (or nvm-windows when you are using Windows), install a new node with this, then install ionic and cordova again and try your command again. The problem should be gone.

Thank you very much. It works fine again. I do the following:

npm uninstall npm -g

install nvm for Windows from here:
https://github.com/coreybutler/nvm-windows/releases (Version 1.1.5 - nvm-setup.zip)

using Node-version 6.9.4

Install Cordova with:

npm install -g cordova

Install Ionic (specific Version) with:

npm install -g ionic@2.2.3

1 Like