capacitor-resources icon indicating copy to clipboard operation
capacitor-resources copied to clipboard

If the users NPM folder has a first and last name, the copy fails

Open scottieslg opened this issue 3 years ago • 3 comments

I use my first and last name as my user name, and I get the following error:

Could not install from "Gines\AppData\Roaming\npm-cache_npx\28524" as it does not contain a package.json file.

I fixed this by running

npm config set cache "C:\Users\Scott~1\AppData\Roaming\npm-cache" --global

But then I get a new error:

Cannot find module 'C:\Users\Scott'

I fixed this in the file capacitor-resource\src\copy\index.js by putting quotes around ${copyAndroid} and ${copyIOS}, like this:

  // display.header('Copying resources to native projects...')
  await exec(`npx cross-env CAPACITOR_PROJECT_ROOT=${paths.getRootPath()} node "${copyAndroid}"`)
  // display.success('Copied android resources')
  await exec(`npx cross-env CAPACITOR_PROJECT_ROOT=${paths.getRootPath()} node "${copyIOS}"`)

scottieslg avatar Mar 09 '22 18:03 scottieslg

I've been waiting a while for my pull request to be approved. I ran into this and solved it the exact same way! https://github.com/leonardoquevedox/capacitor-resources/pull/12

bvdalling avatar Mar 24 '22 20:03 bvdalling

I've ran into the a similar same issue today! One of the folders in the path had a space in it - I tried the fix by @bvdalling, and it worked for me!

However, something which I ended up doing is rename the folder to not include any spaces. Not 100% ideal for everyone. Especially if it's something like a user directory, but it's kinda a workaround at least.

sambunting avatar Apr 01 '22 10:04 sambunting

I'm still waiting for the pull request to be completed. I'm getting close to forking this and making it available in my repository.

bvdalling avatar Apr 01 '22 20:04 bvdalling