CrystallizeAPI / crystallize-nextjs-boilerplate

Fully featured Next.js / React eCommerce boilerplate. Combine rich marketing content with product information to create highly converting online stores. Fully tuned for performance with JAMStack edge page generation.
https://crystallize.com
MIT License
309 stars 56 forks source link

npx @crystallize/cli bug #56

Closed hthaigler closed 4 years ago

hthaigler commented 4 years ago

I'm getting the below error every time I run npx @crystallize/cli <project-name> . I would appreciate any help fixing it. Thanks.

npx @crystallize/cli test-project
npx: installed 108 in 12.891s
? Which shop do you want to use? Our template shop - prefilled with lots of juicy data
? Which template would you like to use? Next.js + React
? Which features would you like to use? Add payment methods for checkout, Use SendGrid (https://sendgrid.com) for emails
? Which payment methods would you like to use? Stripe (https://stripe.com)
? Configure tokens and API keys now? (You can configure these in your .env/.env.local file later) No
? Save these template settings as default? No
info Cloning https://github.com/CrystallizeAPI/crystallize-nextjs-boilerplate
Too many arguments.

usage: git clone [<options>] [--] <repo> [<dir>]

    -v, --verbose         be more verbose
    -q, --quiet           be more quiet
    --progress            force progress reporting
    -n, --no-checkout     don't create a checkout
    --bare                create a bare repository
    --mirror              create a mirror repository (implies bare)
    -l, --local           to clone from a local repository
    --no-hardlinks        don't use local hardlinks, always copy
    -s, --shared          setup as shared repository
    --recursive           initialize submodules in the clone
    --recurse-submodules  initialize submodules in the clone
    --template <template-directory>
                          directory from which templates will be used
    --reference <repo>    reference repository
    --dissociate          use --reference only while cloning
    -o, --origin <name>   use <name> instead of 'origin' to track upstream
    -b, --branch <branch>
                          checkout <branch> instead of the remote's HEAD
    -u, --upload-pack <path>
                          path to git-upload-pack on the remote
    --depth <depth>       create a shallow clone of that depth
    --single-branch       clone only one branch, HEAD or --branch
    --separate-git-dir <gitdir>
                          separate git dir from working tree
    -c, --config <key=value>
                          set config inside the new repository

error Unable to clone https://github.com/CrystallizeAPI/crystallize-nextjs-boilerplate
info Creating a new Crystallize project
error ENOENT: no such file or directory, uv_chdir { Error: ENOENT: no such file or directory, uv_chdir
    at process.chdir (/home/homeuser/.npm/_npx/900/lib/node_modules/@crystallize/cli/node_modules/graceful-fs/polyfills.js:20:9)
    at createNextjsProject (/home/homeuser/.npm/_npx/900/lib/node_modules/@crystallize/cli/lib/templates/nextjs.js:237:11)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7) errno: -2, code: 'ENOENT', syscall: 'uv_chdir' }
hakonkrogh commented 4 years ago

Hi,

I'm not able to reproduce this. Can you provide a bit more information?

After a quick search, I've seen ppl with this error message having node_modules in their home directory which for some reason messes up the instalment. Deleting that folder resolved the issue in some cases. Worth checking out.

In any case, I just published a new version of @crystallize/cli which just outputs any error given by the cloneRepository function. Please have another go and let's see if we can clear this up.

hthaigler commented 4 years ago

I'm using the Ubuntu Linux subsystem for windows with node version 8.9.4. I just ran npx @crystallize/cli test-project again and got no new errors regarding the cloning. I ran npm i @crystallize/cli to see if that would update the package and give me the errors, but that didn't work either.

I saw the recommendation to delete the node_modules but my folder is empty.

hakonkrogh commented 4 years ago

Allright. Just realised that we don't enforce a minimum Node version of the CLI tool. It needs to match the minimum requirement of the boilerplates, which is 10.10 at the moment. I've just updated the CLI to enforce that. So in order to run the CLI and setup the Next.js boilerplate you need at least Node 10.10.

That aside, this might just be a git issue, it does complain about too many arguments. What is your git version?

Alternatively, we could potentially bypass git all together and just download the tarball instead.

hthaigler commented 4 years ago

Ok, I just updated Node to version 12.16.3. I'm on git version 2.7.4. I think it might be a git problem too. If I had to guess, it fails to download the repo, and the following error is a result of a missing file that should have been cloned in from the repo.

My new error:

info Cloning https://github.com/CrystallizeAPI/crystallize-nextjs-boilerplate
Too many arguments.

usage: git clone [<options>] [--] <repo> [<dir>]

    -v, --verbose         be more verbose
    -q, --quiet           be more quiet
    --progress            force progress reporting
    -n, --no-checkout     don't create a checkout
    --bare                create a bare repository
    --mirror              create a mirror repository (implies bare)
    -l, --local           to clone from a local repository
    --no-hardlinks        don't use local hardlinks, always copy
    -s, --shared          setup as shared repository
    --recursive           initialize submodules in the clone
    --recurse-submodules  initialize submodules in the clone
    --template <template-directory>
                          directory from which templates will be used
    --reference <repo>    reference repository
    --dissociate          use --reference only while cloning
    -o, --origin <name>   use <name> instead of 'origin' to track upstream
    -b, --branch <branch>
                          checkout <branch> instead of the remote's HEAD
    -u, --upload-pack <path>
                          path to git-upload-pack on the remote
    --depth <depth>       create a shallow clone of that depth
    --single-branch       clone only one branch, HEAD or --branch
    --separate-git-dir <gitdir>
                          separate git dir from working tree
    -c, --config <key=value>
                          set config inside the new repository

error Unable to clone https://github.com/CrystallizeAPI/crystallize-nextjs-boilerplate
info Creating a new Crystallize project in /mnt/c/Users/homeuser/Documents/Sidetrack/website/test
error ENOENT: no such file or directory, chdir '/mnt/c/Users/home user/Documents/Sidetrack/website' -> '/mnt/c/Users/home user/Documents/Sidetrack/website/test' Error: ENOENT: no such file or directory, chdir '/mnt/c/Users/home user/Documents/Sidetrack/website' -> '/mnt/c/Users/home user/Documents/Sidetrack/website/test'
    at process.wrappedChdir (internal/bootstrap/switches/does_own_process_state.js:115:14)
    at process.chdir (/home/homeuser/.npm/_npx/5251/lib/node_modules/@crystallize/cli/node_modules/graceful-fs/polyfills.js:20:9)
    at process.chdir (internal/worker.js:80:5)
    at createNextjsProject (/home/homeuser/.npm/_npx/5251/lib/node_modules/@crystallize/cli/lib/templates/nextjs.js:237:11)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async createTemplateProject (/home/homeuser/.npm/_npx/5251/lib/node_modules/@crystallize/cli/lib/template.js:65:5) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'chdir',
  path: '/mnt/c/Users/home user/Documents/Sidetrack/website',
  dest: '/mnt/c/Users/home user/Documents/Sidetrack/website/test'
}
hakonkrogh commented 4 years ago

What happens if you try to do a clean git clone?

git clone --depth 1 git@github.com:CrystallizeAPI/crystallize-nextjs-boilerplate.git test-project
hthaigler commented 4 years ago

I get this error:

$ git clone --depth 1 git@github.com:CrystallizeAPI/crystallize-nextjs-boilerplate.git test-project
Cloning into 'test-project'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
hakonkrogh commented 4 years ago

What about this one using https?

git clone --depth 1 https://github.com/CrystallizeAPI/crystallize-nextjs-boilerplate test-project
hthaigler commented 4 years ago

That worked! Thanks for the help. The repo is now cloned onto my computer. I would still like to use the cli to set up all my features stripe and send grid.

hakonkrogh commented 4 years ago

Great. All those features are enabled by default in the boilerplate. The only thing the CLI does is to disable the ones you do not want 😉

hthaigler commented 4 years ago

That's great. Thank you for all the help!!