![](/img/trans.png)
[英]BUILD FAILED in 2s [ERROR] An error occurred while running subprocess cordova.[cordova.cmd compile android exited with exit code 1]
[英]An error occurred while running subprocess cordova. cordova.cmd platform add android exited with exit code 1
我在我的 ionic 項目中運行了以下命令
ionic cordova platform add android
我得到了錯誤
> cordova.cmd platform add android
Using cordova-fetch for cordova-android@^9.0.0
Failed to fetch platform cordova-android@^9.0.0
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
CordovaError: Error: npm: Command failed with exit code 4294963248 Error output:
npm ERR! code EPERM
npm ERR! syscall open
npm ERR! path C:\Users\shafi\Desktop\newwest\testmakingAPK\myapp\node_modules\.bin\ng.cmd
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, open 'C:\Users\shafi\Desktop\newwest\testmakingAPK\myapp\node_modules\.bin\ng.cmd'
npm ERR! [Error: EPERM: operation not permitted, open 'C:\Users\shafi\Desktop\newwest\testmakingAPK\myapp\node_modules\.bin\ng.cmd'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'open',
npm ERR! path: 'C:\\Users\\shafi\\Desktop\\newwest\\testmakingAPK\\myapp\\node_modules\\.bin\\ng.cmd'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\shafi\AppData\Local\npm-cache\_logs\2021-07-01T05_45_13_193Z-debug.log
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd platform add android exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
我嘗試了諸如刪除和添加cordova之類的解決方案,以及stackoverflow中給出的其他解決方案,但它們都不起作用
誰能幫我解決這個問題? 謝謝)
你可以試試
ionic cordova prepare android
如果您不想構建項目,請使用標志 --no-build
ionic cordova prepare android --no-build
有關“離子科爾多瓦准備”的更多信息在這里
根據我的情況,我確實刪除了 android 文件夾,如果您確實嘗試使用其他一些框架(如電容器)創建項目,請刪除它們並重試重新運行
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.