Failed to fetch plugin cordova-plugin-local-notification@* via registry问题解决过程
kelvin 发布于 2021-06-19

local-notification是消息提示插件,按照Ionic官网上的方法,

ionic cordova plugin add cordova-plugin-local-notification
npm install @ionic-native/local-notifications

当执行ionic cordova plugin add cordova-plugin-local-notification后,出现
CordovaError: Failed to fetch plugin cordova-plugin-local-notification@* via registry,

看到有些说是因为Cordova的版本和npm的版本不兼容,要把npm降下来,然后执行
npm i -g npm@6
再执行ionic cordova plugin add cordova-plugin-local-notification还是有错误,后来想了直接从源码加载,从https://github.com/katzer/cordova-plugin-local-notifications 下载了源码,然后在本地解压,根据提示cordova plugin add —nofetch —nosave —link

Installation
The plugin can be installed via Cordova-CLI and is publicly available on NPM.

Execute from the projects root folder:

$ cordova plugin add cordova-plugin-local-notification
Or install a specific version:

$ cordova plugin add cordova-plugin-local-notification@VERSION
Or install the latest head version:

$ cordova plugin add https://github.com/katzer/cordova-plugin-local-notifications.git
Or install from local source:

$ cordova plugin add <path> --nofetch --nosave --link

执行cordova plugin add —nofetch —nosave —link,是解压到本地的路径,然后就可以添加成功,

继续执行npm install @ionic-native/local-notifications

这样就算安装好了

kelvin
关注 私信
文章
92
关注
0
粉丝
0