leonardoquevedox / capacitor-resources

Generates icon & splash screen for Capacitor projects using javascript only.
MIT License
136 stars 16 forks source link

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

Open scottieslg opened 2 years ago

scottieslg commented 2 years ago

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}"`)
bvdalling commented 2 years ago

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

sambunting commented 2 years ago

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.

bvdalling commented 2 years ago

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.