Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm create indiekit fails at URL.canParse(value) #674

Closed
jphastings opened this issue Dec 10, 2023 · 2 comments · Fixed by #677
Closed

npm create indiekit fails at URL.canParse(value) #674

jphastings opened this issue Dec 10, 2023 · 2 comments · Fixed by #677
Assignees
Labels
bug Something isn't working

Comments

@jphastings
Copy link

jphastings commented Dec 10, 2023

Description of the bug

Running the npm create command specified in the guide triggers an error while parsing the given URL.

Steps to reproduce

  1. Run the npm create command on a Macbook (M2) running Sonoma 14.0.
  2. At the prompt to add your website's URL add any URL, any text, or nothing.
  3. See error:
$ npm create indiekit indiekit.byjp.me

Welcome to Indiekit! (create-indiekit v1.0.0-beta.6)
If you encounter a problem, visit https://github.com/getindiekit/indiekit/issues to file a new issue.

> Gathering details…
? What is your website’s URL? › https://www.byjp.me
file:///Users/jp/.npm/_npx/5afa545f499565d0/node_modules/create-indiekit/lib/setup-prompts.js:8
      URL.canParse(value)
          ^

TypeError: URL.canParse is not a function
    at TextPrompt.validate [as validator] (file:///Users/jp/.npm/_npx/5afa545f499565d0/node_modules/create-indiekit/lib/setup-prompts.js:8:11)
    at TextPrompt.validate (/Users/jp/.npm/_npx/5afa545f499565d0/node_modules/prompts/lib/elements/text.js:73:28)
    at TextPrompt.submit (/Users/jp/.npm/_npx/5afa545f499565d0/node_modules/prompts/lib/elements/text.js:85:16)
    at ReadStream.keypress (/Users/jp/.npm/_npx/5afa545f499565d0/node_modules/prompts/lib/elements/prompt.js:32:16)
    at ReadStream.emit (node:events:513:28)
    at emitKeys (node:internal/readline/utils:357:14)
    at emitKeys.next (<anonymous>)
    at ReadStream.onData (node:internal/readline/emitKeypressEvents:61:36)
    at ReadStream.emit (node:events:525:35)
    at addChunk (node:internal/streams/readable:315:12)
npm ERR! code 1
npm ERR! path /Users/jp/src/personal
npm ERR! command failed
npm ERR! command sh -c -- create-indiekit indiekit.byjp.me

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/jp/.npm/_logs/2023-12-10T12_54_46_246Z-debug-0.log

Expected behaviour

It should set up a new indiekit instance.

Environment

  • IndieKit 1.0.0-beta6
  • macOS 14.0 (Sonoma)
  • Macbook M2

Additional context

Pressing Ctrl-C (instead of entering a URL) results in a semi-successful run of the create script (the publication key in package.json is empty, and text in the readme & description in package.json refer to the side "undefined")

@jphastings jphastings added the bug Something isn't working label Dec 10, 2023
@paulrobertlloyd
Copy link
Collaborator

paulrobertlloyd commented Dec 24, 2023

Thanks for filing this bug.

URL.canParse() is available in all Node versions after 18.17.0, so this error shouldn’t return if you have Node 18.17.0 or above installed. Do you know which version you had installed when you got this error?

I note that the docs say Node v20 is the minimum supported version, but the version check in the create-indiekit package currency only warns you if v16 or below is installed. I’ll update that, which hopefully means this error won’t be shown.

@jphastings
Copy link
Author

Hi @paulrobertlloyd, this is exactly the issue — I have multiple versions of node on my machine and this was using v16.19.0! Thanks for the explanation — I think the dependency check change is a great idea too! 🙇

All is working now 😊 Thanks for the help (and feel free to close this issue as/when that suits!)

@paulrobertlloyd paulrobertlloyd changed the title npm create indiekit fails at "URL.canParse(value)" npm create indiekit fails at URL.canParse(value) Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants