clasp is not recognized after installing on windows 10

1k views Asked by At

I am trying to use Visual Studio Code as Google Sheets Script editor on a win 10 machine.

To make a long story short I will not describe all my steps, as I didn't really understood at the beginning exactly what I need. I also wouldn't be able to do it even I want to.

The current situation is that clasp is not recognized on the system. These are command line results:

c:\>where npm
C:\Program Files\nodejs\npm
C:\Program Files\nodejs\npm.cmd

c:\>where clasp
C:\Users\XXX\AppData\Roaming\npm\clasp
C:\Users\XXX\AppData\Roaming\npm\clasp.cmd

on drive c: root (and any folder other than C:\Users\XXX\AppData\Roaming\npm\clasp) clasp is not recognized

c:\>clasp -v     
'clasp' is not recognized as an internal or external command,
 operable program or batch file.


C:\Users\XXX\AppData\Roaming\npm>clasp -v
2.3.0

One suggestion I found is setting Windows user variable as follows:

SET NODE_PATH=% APPDATA%\npm

Didn't help.

npm related paths on Windows PATH :

C:\Users\XXX\AppData\Roaming\npm

I tried to add to PATH the following file path before the one above

C:\Program Files\nodejs\npm

Didn't help

Based on this post looks like npm is actually installed twice. For current user C:\Users\XXX\AppData\Roaming\npm and for all users C:\Program Files\nodejs\npm. Maybe this is the problem.

I would like to start over from clean env.

How can I uninstall the local user npm installation on C:\Users\XXX\AppData\Roaming\npm?

1

There are 1 answers

1
Hari Das On

You need to add path to npm in environment variables. Then it will work.

  • Press Ctrl+r
  • Write %AppData% and hit enter
  • You will land on roaming folder
  • Go to npm folder inside roaming and check if a file named clasp is there or not
  • If yes, then add the path to npm in environment variables
  • In my case the path is C:\Users\HARI\AppData\Roaming\npm