[英]Ionic 4 platform add android error code ENOLOCAL
I removed my android platform on my ionic project and tried to re-install it but I keep receiving npm ERR! code ENOLOCAL
我在我的 ionic 项目中删除了我的 android 平台并尝试重新安装它,但我一直收到
npm ERR! code ENOLOCAL
npm ERR! code ENOLOCAL
. npm ERR! code ENOLOCAL
。 here is the error when I type platform add android
:这是我输入
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.
I tried removing and adding the platform, also removing and adding the node_modules but still get the same error.我尝试删除和添加平台,也删除和添加 node_modules 但仍然得到相同的错误。 My Cordova version is 8.0 .
我的 Cordova 版本是 8.0 。 anybody knows how to solve this?
有人知道如何解决这个问题吗?
在根目录(不是平台目录)中创建了 Android 文件夹,删除此文件夹后,命令再次运行。
从项目目录中删除 Android 文件夹
重命名该文件夹后,根目录 (而非platforms目录)中存在一个Android文件夹,该命令再次生效。就像您重命名android2一样,因为它是您的备份。
I accidentiall run the capacitor command instead of using cordova.我不小心运行了电容命令而不是使用cordova。 After removing the android forlder that was created with the capacitor command it worked again.
删除使用电容器命令创建的 android 文件夹后,它再次工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.