簡體   English   中英

Ionic 4 平台添加android 錯誤代碼ENOLOCAL

[英]Ionic 4 platform add android error code ENOLOCAL

我在我的 ionic 項目中刪除了我的 android 平台並嘗試重新安裝它,但我一直收到npm ERR! code ENOLOCAL npm ERR! code ENOLOCAL 這是我輸入platform add android時的錯誤:

(node:3880) UnhandledPromiseRejectionWarning: CordovaError: Error: cmd: Command failed with exit code 1 Error output:
npm ERR! code ENOLOCAL
npm ERR! Could not install from "android" 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\RMT016\AppData\Roaming\npm-cache\_logs\2018-09-26T08_08_46_485Z-debug.log
    at C:\Users\RMT016\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-fetch\index.js:105:29
    at _rejected (C:\Users\RMT016\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:864:24)
    at C:\Users\RMT016\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:890:30
    at Promise.when (C:\Users\RMT016\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:1142:31)
    at Promise.promise.promiseDispatch (C:\Users\RMT016\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:808:41)
    at C:\Users\RMT016\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:624:44
    at runSingle (C:\Users\RMT016\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:137:13)
    at flush (C:\Users\RMT016\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:125:13)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)
(node:3880) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:3880) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate
the Node.js process with a non-zero exit code.

我嘗試刪除和添加平台,也刪除和​​添加 node_modules 但仍然得到相同的錯誤。 我的 Cordova 版本是 8.0 。 有人知道如何解決這個問題嗎?

在根目錄(不是平台目錄)中創建了 Android 文件夾,刪除此文件夾后,命令再次運行。

從項目目錄中刪除 Android 文件夾

重命名該文件夾后,根目錄 (而非platforms目錄)中存在一個Android文件夾,該命令再次生效。就像您重命名android2一樣,因為它是您的備份。

我不小心運行了電容命令而不是使用cordova。 刪除使用電容器命令創建的 android 文件夾后,它再次工作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM