运行子进程cordova时发生错误,cordova.cmd platform add android退出,退出代码为1

xggvc2p6  于 2022-11-15  发布在  Android
关注(0)|答案(2)|浏览(193)

我在我的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中给出的其他解决方案,但都不起作用。
谁能帮我解决这个问题?谢谢)

t5fffqht

t5fffqht1#

你可以试试

ionic cordova prepare android

如果不想构建项目,请使用标志--no-build

ionic cordova prepare android --no-build

更多关于“ionic cordova prepare”的信息here

slhcrj9b

slhcrj9b2#

根据我的情况,我确实删除了android文件夹,如果你确实尝试用其他框架(如电容器)创建项目,请删除它们并再次尝试重新运行

相关问题