Typically clasp
is installed as a global package for convenience when using the command line.
Still there may be occasions when you want a project to use a specific version of clasp
(i.e. to prevent potential breaking changes in future version)
This can be achieved by simply adding clasp as a local dependency and a fixed version
npm install --save-exact @google/clasp
Optionally, you can specify an older version.
npm install --save-exact @google/[email protected]
After this, any npm scripts using clasp
will use the local version
"scripts": {
"push-project1": "cd src/GasProject1 && clasp push",
},
From the command line, within your project, use the npx
tool in order to use the local version of clasp
rather than any global one.
npx clasp --version