如何在现有的Ionic / Cordova项目中安装额外的Cordova插件?我需要Cordova Battery-Status插件。如果我尝试:
ionic cordova plugin add cordova-plugin-battery-status
我得到了这个:
Error: Failed to fetch plugin cordova-plugin-battery-status via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: cmd: Command failed with exit code 4294963248 Error output:
npm ERR! path
C:\development\ionic\baterry-status\battery_test\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:\development\ionic\baterry-status\battery_test\node_modules\fsevents\node_modules\ansi-regex\package.json'
npm ERR! at Error (native)
npm ERR! { Error: EPERM: operation not permitted, unlink
'C:\development\ionic\baterry-status\battery_test\node_modules\fsevents\node_modules\ansi-regex\package.json'
npm ERR! at Error (native)
npm ERR! stack: 'Error: EPERM: operation not permitted, unlink
\'C:\\development\\ionic\\baterry-status\\battery_test\\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:\\development\\ionic\\baterry-status\\battery_test\\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\Administrador\AppData\Roaming\npm-cache\_logs\2017-09-14T14_55_19_022Z-debug.log
答案 0 :(得分:0)
试试这个,它的工作原理。我在发布之前已经过测试
cordova plugin add cordova-plugin-battery-status
了解更多细节,请转到 https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-battery-status/#installation