Skip to content
Book a free call
Guides

Set up Node, clasp, and Apps Script access

The one-time setup every build guide on this site starts from: a JavaScript runtime, the command-line tool that pushes code to Google, and a Google account ready to authorize it.

About 10 minutes One-time setup Terminal required

Every build on this site is Google Apps Script, pushed from your machine with a command-line tool called clasp. Before any of that works, you need three things in place: Node.js, clasp itself, and a Google account with the Apps Script API turned on. Do this once and every future guide skips straight to the build.

1Install Node.js

clasp is a Node package, so Node comes first. Download the current LTS release from nodejs.org and run the installer. Then confirm it worked:

terminal
node -v
npm -v

Both should print a version number. If you get command not found, the installer didn't add Node to your shell's PATH, close and reopen your terminal before trying again.

2Install clasp

clasp is Google's own CLI for Apps Script. Install it globally so it's available from any project directory:

terminal
npm install -g @google/clasp
clasp -v

The version command confirms the install. If npm install -g fails with a permissions error, that's your global npm prefix pointing somewhere your user account can't write, not a clasp problem; the fix depends on how Node was installed, and the error message itself usually names the exact directory to check.

3Turn on the Apps Script API

This is the step almost everyone misses, and the one that produces the most confusing error later. clasp talks to Apps Script through an API that is off by default on every Google account.

Do this before you log in

Open script.google.com/home/usersettings while signed into the Google account you'll build with, and switch Google Apps Script API to On. If you skip this, cloning or pushing a project later fails with a permissions error that gives no hint the toggle is the cause.

4Log in

Now authorize clasp against that same account:

terminal
clasp login

A browser tab opens asking you to sign in and grant clasp access. Approve it, and the tab shows "Authorization successful"; you can close it and go back to your terminal. Confirm clasp saved the login:

terminal
clasp show-authorized-user

That prints the email address clasp is authorized as. Make sure it's the account you intend to build with, not a different Google account you happen to be signed into elsewhere.

The quick check

Every other guide on this site links back to this page with the same four commands. If any guide tells you to "run the quick check," this is it:

terminal
node -v
npm -v
clasp -v
clasp show-authorized-user

Four version numbers and an email address, no errors. That's a working setup.

Troubleshooting

"command not found: clasp"

The global npm install didn't land on your shell's PATH. Close and reopen your terminal first; if it's still missing, run npm root -g and confirm that path is on your PATH environment variable.

clasp login opens a browser, but nothing happens after you approve

Some corporate networks or browser extensions block the local server clasp starts to receive the callback. Retry with clasp login --no-localhost, which prints a code to paste back into the terminal instead of waiting for the browser to call home.

"User has not enabled the Apps Script API" on clone or push

This is step 3 above, skipped or applied to the wrong account. Revisit script.google.com/home/usersettings signed in as the account clasp is authorized as (check with clasp show-authorized-user), turn the toggle on, and retry.

Logged into the wrong Google account

clasp login again; it overwrites the saved credentials with whichever account you sign into in the browser tab it opens.