Install Gemini CLI in VS Code by using Chocolatey (PRE-Install Python and Node.js) first and then NPM (Node.js) - FAILED! TIDAK BISA TERINSTALL!!
YOUTUBE-CHANNEL
MY Self-Done PROCEDURE
Chocolatey is a package manager for Windows, similar to how apt works on Linux or brew on macOS. It helps you install, update, and manage software from the command line.
🧩 What Chocolatey Does
It automates the installation of programs and tools like:
choco install googlechrome
choco install vscode
choco install git
Chocolatey downloads and installs software silently — no manual clicking through installers.
⚙️ How to Install Chocolatey
You can install it by running this command in PowerShell (as Administrator):
Set-ExecutionPolicy Bypass -Scope Process -Force; `
[System.Net.ServicePointManager]::SecurityProtocol = `
[System.Net.ServicePointManager]::SecurityProtocol -bor 3072; `
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
Once installed, you can verify it with:
choco --version
📦 Example Commands
| Action | Command |
|---|---|
| Install package | choco install nodejs |
| Upgrade all packages | choco upgrade all |
| Uninstall package | choco uninstall firefox |
| Search package | choco search python |
🐍 Step: Install Python
Run this command:
Check the installation:
⚙️ Step: Install Node.js
Run this command:
Check the installation:
✅ Step to Verify everything works
After installation, you should be able to run:
If these show version numbers, both tools are successfully installed and added to your PATH.
Install the Gemini CLI using npm (instead of Chocolatey), here’s exactly how to do it inside VS Code’s terminal, step by step:
🧩 Prerequisites
Before installing, make sure you already have:
-
Node.js installed
Check in your VS Code terminal:node --versionExample output:
v18.x.x -
npm (comes with Node.js)
npm --versionExample output:
10.x.x -
(Optional but recommended) Python
Some dependencies might require it:python --version
⚙️ Step: Install Gemini CLI Globally via npm
In your VS Code terminal, run:
npm install -g @google/gemini-cli
Explanation:
-
npm install→ tells npm to install a package -
-g→ installs it globally, so it works from anywhere -
@google/gemini-cli→ the official Gemini CLI package name
🧪 Step: Verify the Installation
Once it’s done, check the version:
gemini --version
You should see something like:
gemini-cli v1.x.x
If you get an error like “gemini not recognized”, try restarting VS Code (so it reloads your PATH).
✅ That’s it!
NOW Gemini CLI ALREADY installed globally via npm and ready to use inside VS Code.
An important distinction because only one of these is the official Google Gemini CLI.
Let’s break it down 👇
✅ Official package
npm install -g @google/generative-ai-cli
-
Publisher:
@google -
Official command-line tool from Google for interacting with Gemini (Google’s generative AI models).
-
Provided by Google’s Generative AI team under the official
@googlenpm scope. -
It integrates with the Gemini API via your Google AI Studio API key.
-
Command:
gemini -
Docs: https://www.npmjs.com/package/@google/generative-ai-cli
⚠️ Likely unofficial or outdated
npm install -g @google/gemini-cli
-
As of now,
@google/gemini-cliis not an official Google package. -
It may:
-
Not exist on npm at all.
-
Or be a third-party / placeholder package not maintained by Google.
-
-
Installing it could give you errors like:
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@google%2fgemini-cli - Not found
🧭 In summary
| Command | Status | Publisher | Purpose |
|---|---|---|---|
npm install -g @google/generative-ai-cli |
✅ Official | The real Gemini CLI | |
npm install -g @google/gemini-cli |
❌ Unofficial / invalid | Unknown | Don’t use |
✅ Correct way to install
npm install -g @google/generative-ai-cli
Then verify:
gemini --versionDifference between Node.js and npm clearly 👇
🟢 Node.js
➤ What it is
Node.js is a runtime environment that lets you run JavaScript outside the browser (on your computer or server).
➤ What it does
-
Executes JavaScript files (e.g.,
app.js). -
Powers server-side applications (like APIs, CLIs, tools).
-
Provides built-in modules (like
fs,http, etc.) for working with files, networking, and processes.
➤ Example
node app.js
This runs a JavaScript file using the Node.js engine (V8, from Chrome).
📦 npm (Node Package Manager)
➤ What it is
npm is a package manager that comes bundled with Node.js.
It manages reusable code modules (called packages) you can install from the npm registry.
➤ What it does
-
Installs, updates, and removes JavaScript packages.
-
Tracks dependencies in a
package.jsonfile. -
Lets you install CLI tools (like the Gemini CLI) or libraries (like Express).
➤ Example
npm install express
This downloads the Express framework into your project.
Or install globally:
npm install -g @google/generative-ai-cli
⚖️ Node.js vs npm — Side by Side
| Feature | Node.js | npm |
|---|---|---|
| Type | Runtime environment | Package manager |
| Purpose | Runs JavaScript outside browsers | Manages JS libraries and tools |
| Installed with | Chocolatey, installer from nodejs.org | Bundled with Node.js |
| Example command | node app.js |
npm install express |
| Core use | Running JS programs | Installing/managing dependencies |
✅ In short
-
Node.js = runs JavaScript
-
npm = installs and manages packages for Node.js
Or simply:
🧠 “Node.js runs the code, npm gets the code.”
Comments