google-apps-scriptclasp

What is wrong with my clasp re-installation?


I have a Mac running macOS 11.4. I've used clasp (extensively) on this same machine with same OS but recently I had to wipe my SSD and reinstall everything.

I've installed node.js using the macOS installer (node-v14.17.3.pkg), this includes npm.

Then I've installed clasp via Terminal with sudo npm install @google/clasp -g.

The above process mirrors what I did when I installed first time round, although they would have been earlier versions (maybe a year ago).

Now when I try to run clasp (with or without options) I get an error, I'm hoping someone can help diagnose?

Error: ENOENT: no such file or directory, open 'package.json'
    at Object.openSync (fs.js:498:3)
    at Object.readFileSync (fs.js:394:35)
    at file:///usr/local/lib/node_modules/@google/clasp/node_modules/ts2gas/src/index.js:35:35
    at ModuleJob.run (internal/modules/esm/module_job.js:169:25)
    at async Loader.import (internal/modules/esm/loader.js:177:24)
    at async Object.loadESM (internal/process/esm_loader.js:68:5) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: 'package.json'
}

Solution

  • I had the exact same issue. I downgraded to clasp version 2.3

    npm i @google/clasp@2.3.0 -g
    

    The version 2.4 was released only 7 days ago It look to be working now. I'll switch back to the latest version when the 2.4.1 will be out