[英]ionic 4 - iOS file access with @ionic-native/file/ngx/cordova-plugin-file
[英]Cannot install Ionic-Native File plugin
我有一個Ionic 3項目,我正在嘗試使用以下命令添加Ionic Native File插件:
ionic cordova plugin add cordova-plugin-file
但是,我收到以下錯誤:
L:\MyTrials\test\ionic\locations-app>ionic cordova plugin add cordova-plugin-file
> cordova plugin add cordova-plugin-file --save
x Running command - failed!
[ERROR] An error occurred while running cordova plugin add cordova-plugin-file
--save (exit code 1):
Error: Failed to fetch plugin file:node_modules\cordova-plugin-file 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 1 Error output:
npm ERR! code ENOLOCAL
npm ERR! Could not install from "node_modules\cordova-plugin-file" as it
does not contain a package.json file.
npm ERR! A complete log of this run can be found in:
npm ERR!
C:\Users\xxx\AppData\Roaming\npm-cache\_logs\2017-09-21T05_16_31_940Z-debug.log
我已經嘗試過其他命令,例如:
cordova plugin add cordova-plugin-file
和
cordova plugin add cordova-plugin-file --nofetch
但我基本上得到了同樣的錯誤。
我的網絡連接很好,我以管理員身份運行這些命令。
似乎只有File插件可能會遇到這些問題。 我可以安裝Ionic Native Datepicker插件,沒有任何問題。
任何幫助表示贊賞!
從問題的評論中可以看出,在@amin arghavani的幫助下,執行以下操作解決了問題:
刪除插件如果已經安裝: ionic cordova plugin rm cordova-plugin-file
在我的情況下這個插件從未安裝過,所以我得到了相同的消息作為錯誤。
檢查項目的node_modules
文件夾下是否存在該插件的文件夾。 在我的情況下,我實際上找到了一個以我刪除的插件( cordova-plugin-file
)命名的快捷方式鏈接。
檢查插件是否包含在項目的package.json
作為依賴項或開發人員依賴項。 在我的例子中,我在package.json
找到了依賴關系(我刪除並保存)下的cordova-plugin-file
的引用。
再次從命令行添加cordova組件,這對我有用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.