简体   繁体   中英

Error when running 'ionic capacitor build android' and npm install

I deleted the bin folder in the node_modules folder to try fix some errors I was having.

Then when I run sudo npm install I get his following error:

npm ERR! code EACCES
npm ERR! syscall rename
npm ERR! path /mnt/c/Users/aks/Documents/GitHub/mpl/node_modules/typescript
npm ERR! dest /mnt/c/Users/aks/Documents/GitHub/mpl/node_modules/.typescript-4Gn4pDgu
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, rename '/mnt/c/Users/aks/Documents/GitHub/mpl/node_modules/typescript' -> '/mnt/c/Users/aks/Documents/GitHub/mpl/node_modules/.typescript-4Gn4pDgu'
npm ERR!  [Error: EACCES: permission denied, rename '/mnt/c/Users/aks/Documents/GitHub/mpl/node_modules/typescript' -> '/mnt/c/Users/aks/Documents/GitHub/mpl/node_modules/.typescript-4Gn4pDgu'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'rename',
npm ERR!   path: '/mnt/c/Users/aks/Documents/GitHub/mpl/node_modules/typescript',
npm ERR!   dest: '/mnt/c/Users/aks/Documents/GitHub/mpl/node_modules/.typescript-4Gn4pDgu'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
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.

and also when I try to run ionic capacitor build android I get this following error:

Build at: 2022-03-22T22:37:13.895Z - Hash: a5c2e39c5192c37b - Time: 25907ms
> capacitor sync android
Error

at new SubprocessError (/usr/local/lib/node_modules/@ionic/cli/node_modules/@ionic/utils-subprocess/dist/index.js:41:23)
at ChildProcess.<anonymous>
(/usr/local/lib/node_modules/@ionic/cli/node_modules/@ionic/utils-subprocess/dist/index.js:110:27)
at ChildProcess.emit (node:events:390:28)
at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
at onErrorNT (node:internal/child_process:477:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)

I am wondering what I can do to solve this, I am running these commands on WSL

Thanks

The following might help you resolve the issue:

  • Implying the command with sudo to override any access issues. So sudo npm install
  • Run ionic cap sync and then ionic cap build android

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM