google-drive-apiclasp

Clasp won't clone Google Drive project - Error: clasp.json already exists


Clasp version

$ clasp -v
2.4.1

Setup information used: clasp - The Apps Script CLI

Test setup:

  1. Created testClasp project in https://script.google.com/home/
  2. Navigated to local dir ~\Google Drive\Technical-local\gDriveDev
  3. Use clasp login to login to Google account from local dir
  4. clasp clone ID creates error (clasp.json already exists)

I note that the local dir has:

-a---           6/09/2022  1:57 pm             89 .clasp.json

At some stage, while trying to clone a project, this file was created. And for some reason this is preventing the cloning process.

I have searched this problem: In this post Clasp can not create a new Apps Script the following phrase caught my attention "For both cases, your current directory would now have a .clasp.json file, indicating to clasp that this is a clasp-associated repo and corresponds to a single Apps Script project."

So I go back in my path and create a new folder eg ~\Google Drive\Technical-local\test

I login using clasp login

Authorization successful.
Default credentials saved to: C:\Users\david\.clasprc.json

I invoke the clone instruction:

clasp clone ID "11nv2X-WTo4NEVVu6fge8RZIqflLEEfIy9WRt9NOdjV7k9DVoO8_rqDYZ"
Could not find script.
Did you provide the correct scriptId?
Are you logged in to the correct account with the script?

I would answer absolutely yes to the last two questions. But have no answers to not being able to clone with clasp.

Any suggestion appreciated.


Solution

  • Have a look at (https://github.com/google/clasp/), help in use clasp. Delete the generated files .clasp.json and appscript.json and remove the call "ID" word: ex.:

    clasp login

    clasp clone <number id>