https://www.growthbook.io/ logo
b

busy-air-96466

08/23/2023, 4:40 PM
Hiya, I'm trying to authenticate the growthbook CLI as described here: https://docs.growthbook.io/tools/cli But I can't get it to work? I've installed the CLI with:
npm install growthbook --save
And package.json shows:
Copy code
"growthbook": "^0.2.2",
The CLI doc says to run:
growthbook auth login --apiKey XXX
This doesn't work, giving an error:
command not found: growthbook
I looked at the github README: https://github.com/growthbook/growthbook-cli#commands Unfortunately, the code there also doesn't work for me:
npx growthbook auth login --apiKey
I see an error:
Cannot find module 'node:os'
Require stack:
- /xxx/node_modules/growthbook/node_modules/@oclif/core/lib/config/config.js
- /xxx/node_modules/growthbook/node_modules/@oclif/core/lib/config/index.js
I'm running node v14.16.1 and can't upgrade. 1. Does anyone know a way to run the CLI so I can use the types generation? 2. It'd be great to update the docs with the working command, and if there is a minimum version of node required, to make that information prominent?
h

happy-autumn-40938

08/23/2023, 4:46 PM
I believe you are indeed facing a node version issue. I think we require v16 at minimum for the CLI tools. But perhaps @better-magician-65629 can confirm
b

busy-air-96466

08/23/2023, 4:57 PM
node:os seems to be used in the @oclif package. I see that growthbook's usage seems to be a major version behind, and that as far as I can see, the current version "version": "3.11.3", doesn't use node:os. I wonder if upgrading growthbook's version of @oclif might be an idea? https://github.com/oclif/oclif/blob/main/package.json
It looks like they plan to remove support for v14 but haven't merged it yet 🙂 https://github.com/oclif/oclif/pull/1169
b

better-magician-65629

08/23/2023, 5:03 PM
yes we require a minimum node version of 16.x. you can find this info in the docs at the top. if you need to use an older version of node.js for your projects, you may want to consider using nvm to switch between node versions as needed.
b

busy-air-96466

08/23/2023, 5:04 PM
Thanks @better-magician-65629! Somehow I missed that line in the doc...so I can use nvm to switch to node 16.x to run the CLI, then switch back to run our app? Cool.
b

better-magician-65629

08/23/2023, 5:06 PM
yes. every version of node when using nvm will have its own set of packages/dependencies. so you'll need to switch to node 16 with nvm, then install it while you're on that version, and then you should be able to use it. if you haven't used nvm before, it may conflict with your current version of node, but you can install the current version of node in nvm too so it's easier to switch between them (and uninstall the one that you installed via the installer from the node.js website)
i should note, before switching to node 16, it'll prompt you to install it. the latest node 16 should be fine.
b

busy-air-96466

08/23/2023, 5:11 PM
Hmm, perhaps I need to install the CLI globally instead of as part of package.json?
Otherwise my npm install will be confused!
h

happy-autumn-40938

08/23/2023, 5:15 PM
That is also what I'd recommend doing (global install)
b

busy-air-96466

08/23/2023, 5:16 PM
Thank you!
b

better-magician-65629

08/23/2023, 5:26 PM
it would need to be global if your project depended on an older version of node, but if your project uses node 16, then locally would work too, it just may not be recognized when running
growthbook
unless you've added local
node_modules
to your path (or is run via an
npm/yarn run
script
b

busy-air-96466

08/24/2023, 8:20 AM
Hiya, I'm getting an error when I try to authenticate global growthbook? I've done this:
nvm install 16
nvm use 16
npm install -g growthbook
growthbook auth login --apiKey secret_admin_xxx
I'm getting this error:
What is the name of this profile? You can leave this blank (default: default):
›  Error: :boom: Invalid GrowthBook config. Configure the CLI with the following
›  command:
›  $ growthbook auth login
@happy-autumn-40938 @better-magician-65629 my apologies but I can't see from the error message what might be the problem?
b

better-magician-65629

08/24/2023, 4:54 PM
let me take a look. we had a contributed change recently in that area, i'm wondering if there's a bug.
h

happy-autumn-40938

08/24/2023, 4:55 PM
fwiw, I had that bug 2 days ago as well, but it went away after opening and closing my terminal. Your mileage may vary
b

better-magician-65629

08/24/2023, 4:59 PM
bryce if you were running it in the project, it looks like the version of the CLI in our project is the old version without the regression. i'm going to revert the contributed PR. i had caught another issue, and it looked like he fixed it, but obviously there's still an issue, so i'll revert that work.
i was able to reproduce the issue shelagh describes
🙏 1
@busy-air-96466 apologies for this issue. there was a contribution recently to add functionality in this area to make it work better with CI/CD pipelines but it actually introduced a regression. i've reverted the changes and published a new version 0.2.3. if using it globally, please do the following (so you can use it with the command
growthbook
anywhere on your system):
Copy code
npm uninstall -g growthbook
npm install -g growthbook
or if you are installing it at the project level, update the version in your package.json to be 0.2.3 and re-run
npm install
and use with
npx growthbook
at your project root.
b

busy-air-96466

08/24/2023, 5:32 PM
Thank you! Amazing! I'll give this a try tomorrow.
Hiya @better-magician-65629, installation is freezing?
Copy code
nvm use 16
npm uninstall -g growthbook
npm install -g growthbook
This is on a Mac. It's been stuck at the same point for about 10 minutes.
b

better-magician-65629

08/25/2023, 5:12 PM
that's strange, i didn't experience this issue. i'm also on mac. we don't do anything special, it's using npm like other packages. are you able to install other tools in node? also when you run
which node
and
which npm
is it pointing to the right one?
b

busy-air-96466

08/29/2023, 9:02 AM
Hi @better-magician-65629 it's v16.20.2 in both cases, I just tried again and it's still stuck! Is idealTree a package?
My apologies, I should have looked at the terminal output more carefully! It seems this is a common issue with idealTree and there are various ways to resolve it. In my case, the simplest method of temporarily disabling company VPN did the trick.
b

better-magician-65629

09/19/2023, 6:58 PM
was on PTO but i'm back now, did you figure this out?