checkly-cli icon indicating copy to clipboard operation
checkly-cli copied to clipboard

bug: installing into an existing directory fails

Open tnolet opened this issue 2 years ago • 6 comments

Node.js version

18

NPM version

16

@checkly/cli version

4.0.13

Steps to reproduce

  • Create some app directory with a package.json
  • Run npm create checkly
  • Answer ✔ It looks like you are already in a project, would you like to initialize? with yes

What is expected?

It installs a checkly.config.js or .ts file

What is actually happening?

it crashes because it can't find the boilerplate project

✔ It looks like you are already in a project, would you like to initialize? … yes
✖ Couldn't find template "boilerplate-project"
npm ERR! code 1
npm ERR! path /Users/timnolet/WebstormProjects/svelte-tmp
npm ERR! command failed
npm ERR! command sh -c create-cli

npm ERR! A complete log of this run can be found in: /Users/timnolet/.npm/_logs/2023-08-01T07_33_42_468Z-debug-0.log
timnolet@MacBook-Pro-van-Tim svelte-tmp % npm i -D checkly@latest

added 186 packages, and audited 451 packages in 5s

95 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

Any additional comments?

No response

tnolet avatar Aug 01 '23 07:08 tnolet

@tnolet , this seems like a known issue downloading the template when the CLI was released without the v prefix version tag. There are changes in the create-cli pending to be released but I think this issue is not related. I was able to install a project into an existing directory with latest version. Please, let me know if it works for you.

nahuelon avatar Aug 10 '23 20:08 nahuelon

I'm getting the same error with version 4.5.2

sa@mst: /tmp  npm create checkly
 checkly  v4.5.2 Build and Run Synthetics That Scale

Hi Tom! Let's get you started on your monitoring as code journey!

✔ Where do you want to create your new project? … foo/test
◼  Cool. Your project will be created in the directory "foo/test"

✔ Which template would you like to use for your new project › An advanced project with multiple examples and best practices (recommended)
✖ Couldn't find template "advanced-project"
npm ERR! code 1
npm ERR! path /private/tmp
npm ERR! command failed
npm ERR! command sh -c create-cli

npm ERR! A complete log of this run can be found in: /Users/sa/.npm/_logs/2024-01-22T16_49_49_709Z-debug-0.log
sa@mst: /tmp  cat /Users/sa/.npm/_logs/2024-01-22T16_49_49_709Z-debug-0.log
0 verbose cli /usr/local/bin/node /usr/local/bin/npm
1 info using [email protected]
2 info using [email protected]
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 0ms
5 timing config:load:file:/usr/local/lib/node_modules/npm/npmrc Completed in 1ms
6 timing config:load:builtin Completed in 1ms
7 timing config:load:cli Completed in 1ms
8 timing config:load:env Completed in 0ms
9 timing config:load:file:/private/tmp/.npmrc Completed in 0ms
10 timing config:load:project Completed in 1ms
11 timing config:load:file:/Users/sa/.npmrc Completed in 1ms
12 timing config:load:user Completed in 1ms
13 timing config:load:file:/usr/local/etc/npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:setEnvs Completed in 0ms
16 timing config:load Completed in 4ms
17 timing npm:load:configload Completed in 5ms
18 timing config:load:flatten Completed in 1ms
19 timing npm:load:mkdirpcache Completed in 0ms
20 timing npm:load:mkdirplogs Completed in 0ms
21 verbose title npm create checkly
22 verbose argv "create" "checkly"
23 timing npm:load:setTitle Completed in 6ms
24 timing npm:load:display Completed in 0ms
25 verbose logfile logs-max:10 dir:/Users/sa/.npm/_logs/2024-01-22T16_49_49_709Z-
26 verbose logfile /Users/sa/.npm/_logs/2024-01-22T16_49_49_709Z-debug-0.log
27 timing npm:load:logFile Completed in 3ms
28 timing npm:load:timers Completed in 0ms
29 timing npm:load:configScope Completed in 0ms
30 timing npm:load Completed in 21ms
31 silly logfile start cleaning logs, removing 1 files
32 timing arborist:ctor Completed in 1ms
33 silly logfile done cleaning log files
34 http fetch GET 200 https://registry.npmjs.org/create-checkly 1258ms (cache revalidated)
35 timing arborist:ctor Completed in 0ms
36 timing arborist:ctor Completed in 0ms
37 timing command:create Completed in 10909ms
38 verbose stack Error: command failed
38 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:53:27)
38 verbose stack     at ChildProcess.emit (node:events:519:28)
38 verbose stack     at maybeClose (node:internal/child_process:1105:16)
38 verbose stack     at ChildProcess._handle.onexit (node:internal/child_process:305:5)
39 verbose cwd /private/tmp
40 verbose Darwin 23.2.0
41 verbose node v21.6.0
42 verbose npm  v10.2.4
43 error code 1
44 error path /private/tmp
45 error command failed
46 error command sh -c create-cli
47 verbose exit 1
48 timing npm Completed in 10994ms
49 verbose code 1
50 error A complete log of this run can be found in: /Users/sa/.npm/_logs/2024-01-22T16_49_49_709Z-debug-0.log
sa@mst: /tmp

evdama avatar Jan 22 '24 16:01 evdama

@evdama thanks for mentioning this, we will fix it. You can copy and paste the project for now from https://github.com/checkly/checkly-cli/tree/main/examples

tnolet avatar Jan 22 '24 16:01 tnolet

Hey @evdama, do you also get the same error when you run npm create [email protected]?

umutuzgur avatar Jan 22 '24 19:01 umutuzgur

yes, I get the same error running npm create [email protected]

evdama avatar Jan 23 '24 16:01 evdama

@evdama I pushed another tag, could you run the command again? I can't repro the problem locally but I have a gut feeling that it might be an issue with the older versions

umutuzgur avatar Jan 25 '24 09:01 umutuzgur