Clasp: Command "clasp version" emits TypeError

Created on 6 Mar 2020  Β·  10Comments  Β·  Source: google/clasp

Expected Behavior

Prints out version information

Actual Behavior

Emits TypeError

kenyo@Kens-MacBook-Pro mc % npm install -g @google/clasp
/Users/kenyo/.nvm/versions/node/v10.0.0/bin/clasp -> /Users/kenyo/.nvm/versions/node/v10.0.0/lib/node_modules/@google/clasp/src/index.js
npm WARN [email protected] requires a peer of inquirer@^5.0.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself.

+ @google/[email protected]
added 162 packages in 12.356s
kenyo@Kens-MacBook-Pro mc % clasp
/Users/kenyo/.nvm/versions/node/v10.0.0/lib/node_modules/@google/clasp/node_modules/dotf/lib/index.js:7
const { access, chmod, unlink } = graceful_fs_1.promises;
        ^

TypeError: Cannot destructure property `access` of 'undefined' or 'null'.
    at Object.<anonymous> (/Users/kenyo/.nvm/versions/node/v10.0.0/lib/node_modules/@google/clasp/node_modules/dotf/lib/index.js:7:49)
    at Module._compile (internal/modules/cjs/loader.js:678:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
    at Module.load (internal/modules/cjs/loader.js:589:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
    at Function.Module._load (internal/modules/cjs/loader.js:520:3)
    at Module.require (internal/modules/cjs/loader.js:626:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/Users/kenyo/.nvm/versions/node/v10.0.0/lib/node_modules/@google/clasp/src/dotfile.js:24:12)
    at Module._compile (internal/modules/cjs/loader.js:678:30)
kenyo@Kens-MacBook-Pro mc %

Steps to Reproduce the Problem

  1. Install clasp by npm install -g @google/clasp
  2. Execute a command clasp version

Specifications

  • Node version (node -v10.0.0):
  • Version (clasp -v2.3.0):
  • OS (Mac Catalina):

Most helpful comment

Quick fix - lock dotf version in your package.json file

"dotf": "1.4.2"

All 10 comments

Similar issue for me running clasp login

clasp login
/Users/ever/.nvm/versions/node/v8.5.0/lib/node_modules/@google/clasp/node_modules/dotf/lib/index.js:7
const { access, chmod, unlink } = graceful_fs_1.promises;
                                               ^

TypeError: Cannot match against 'undefined' or 'null'.
    at Object.<anonymous> (/Users/ever/.nvm/versions/node/v8.5.0/lib/node_modules/@google/clasp/node_modules/dotf/lib/index.js:7:48)
    at Module._compile (module.js:624:30)
    at Object.Module._extensions..js (module.js:635:10)
    at Module.load (module.js:545:32)
    at tryModuleLoad (module.js:508:12)
    at Function.Module._load (module.js:500:3)
    at Module.require (module.js:568:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/ever/.nvm/versions/node/v8.5.0/lib/node_modules/@google/clasp/src/dotfile.js:24:12)
    at Module._compile (module.js:624:30)

Steps to Reproduce the Problem

Install clasp by npm install -g @google/clasp
Execute a command clasp login

Specifications

Node version (node -v 8.5.0)
Version (clasp -v 2.3.0)
OS (Mac Mojave)

+1

Quick fix - lock dotf version in your package.json file

"dotf": "1.4.2"

@kenyodev @andybrewer can you share the output of npm list -g dotf graceful-fs?

Also supported NodeJS version should be ">= 10.3.0"

From the error stacks above, [email protected] should be installed and it has a dependency with [email protected]

Similar Issue to me, after that I update my clasp package

I ran npm install -g @google/clasp

clasp -v
I got this error

/usr/local/lib/node_modules/@google/clasp/node_modules/dotf/lib/index.js:7
const { access, chmod, unlink } = graceful_fs_1.promises;
        ^

TypeError: Cannot destructure property `access` of 'undefined' or 'null'.
    at Object.<anonymous> (/usr/local/lib/node_modules/@google/clasp/node_modules/dotf/lib/index.js:7:49)
    at Module._compile (module.js:662:30)
    at Object.Module._extensions..js (module.js:673:10)
    at Module.load (module.js:575:32)
    at tryModuleLoad (module.js:515:12)
    at Function.Module._load (module.js:507:3)
    at Module.require (module.js:606:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/@google/clasp/src/dotfile.js:24:12)
    at Module._compile (module.js:662:30)

I tried to include the "dotf": "1.4.2" like @kalkov suggest but didn't work.

NPM Version

npm -v = 5.6.0

Node Version

node -v = v9.7.1

OS mac El Capitan

10.11.6

Result for NPM LIST

npm list -g dtof graceful-fs
/usr/local/lib β”œβ”€β”¬ @google/[email protected] β”‚ β”œβ”€β”¬ [email protected] β”‚ β”‚ β”œβ”€β”€ [email protected] β”‚ β”‚ └─┬ [email protected] β”‚ β”‚ └── [email protected] deduped β”‚ β”œβ”€β”¬ [email protected] β”‚ β”‚ β”œβ”€β”€ [email protected] deduped β”‚ β”‚ └─┬ [email protected] β”‚ β”‚ └── [email protected] deduped β”‚ └─┬ [email protected] β”‚ β”œβ”€β”¬ [email protected] β”‚ β”‚ β”œβ”€β”¬ [email protected] β”‚ β”‚ β”‚ └── [email protected] deduped β”‚ β”‚ └─┬ [email protected] β”‚ β”‚ └── [email protected] deduped β”‚ β”œβ”€β”¬ [email protected] β”‚ β”‚ └── [email protected] deduped β”‚ └─┬ [email protected] β”‚ └─┬ [email protected] β”‚ └─┬ [email protected] β”‚ └─┬ [email protected] β”‚ └── [email protected] deduped β”œβ”€β”¬ [email protected] β”‚ └─┬ [email protected] β”‚ └── [email protected] β”œβ”€β”€ [email protected] └─┬ [email protected] β”œβ”€β”¬ @google/[email protected] β”‚ β”œβ”€β”¬ [email protected] β”‚ β”‚ └─┬ [email protected] β”‚ β”‚ └── [email protected] deduped β”‚ └─┬ [email protected] β”‚ └── [email protected] deduped β”œβ”€β”¬ [email protected] β”‚ └── [email protected] deduped β”œβ”€β”¬ [email protected] β”‚ └── [email protected] deduped β”œβ”€β”¬ [email protected] β”‚ └── [email protected] deduped β”œβ”€β”¬ [email protected] β”‚ └── [email protected] deduped β”œβ”€β”¬ [email protected] β”‚ └── [email protected] deduped β”œβ”€β”¬ [email protected] β”‚ └── [email protected] deduped β”œβ”€β”€ [email protected] β”œβ”€β”¬ [email protected] β”‚ └─┬ [email protected] β”‚ └─┬ [email protected] β”‚ └─┬ [email protected] β”‚ └─┬ [email protected] β”‚ └── [email protected] deduped β”œβ”€β”¬ [email protected] β”‚ β”œβ”€β”€ [email protected] deduped β”‚ └─┬ [email protected] β”‚ β”œβ”€β”¬ [email protected] β”‚ β”‚ └── [email protected] deduped β”‚ └── [email protected] deduped β”œβ”€β”¬ [email protected] β”‚ └─┬ [email protected] β”‚ └─┬ [email protected] β”‚ └── [email protected] deduped β”œβ”€β”¬ [email protected] β”‚ └── [email protected] deduped β”œβ”€β”¬ [email protected] β”‚ └── [email protected] deduped β”œβ”€β”¬ [email protected] β”‚ └── [email protected] deduped β”œβ”€β”¬ [email protected] β”‚ └── [email protected] deduped β”œβ”€β”¬ [email protected] β”‚ └── [email protected] deduped β”œβ”€β”¬ [email protected] β”‚ └── [email protected] deduped β”œβ”€β”¬ [email protected] β”‚ └─┬ [email protected] β”‚ └─┬ [email protected] β”‚ └─┬ [email protected] β”‚ └── [email protected] deduped β”œβ”€β”¬ [email protected] β”‚ └─┬ [email protected] β”‚ β”œβ”€β”¬ [email protected] β”‚ β”‚ └─┬ [email protected] β”‚ β”‚ └── [email protected] β”‚ └─┬ [email protected] β”‚ └─┬ [email protected] β”‚ └─┬ [email protected] β”‚ β”œβ”€β”¬ [email protected] β”‚ β”‚ └── [email protected] deduped β”‚ └─┬ [email protected] β”‚ └── [email protected] deduped β”œβ”€β”¬ [email protected] β”‚ └─┬ [email protected] β”‚ └── [email protected] deduped └─┬ [email protected] └── [email protected] deduped

Edit

Updating node to latest version work again clasp.

I am also facing this issue after doing sudo npm install -g @google/clasp:
This is the output when I run clasp:

/usr/local/lib/node_modules/@google/clasp/node_modules/dotf/lib/index.js:7
const { access, chmod, unlink } = graceful_fs_1.promises;
        ^

TypeError: Cannot destructure property `access` of 'undefined' or 'null'.

Edit:

For some reason updating node to version v14.x fixed the issue and I am able to use clasp...

I was using node version v8.x, upgrading to node v12.xwhich is the LTS, it is working now, so I think not even necessary to update to v14.x

Can you test with the #791 unofficial release?

npm uninstall -g @google/clasp && npm install -g forked-clasp
clasp --version
# should be 2.4.0 or more

@PopGoesTheWza

Sorry I haven't checked this issue for a while.
The error went away after updating the node version to a higher one.

Also supported NodeJS version should be ">= 10.3.0"

This was the solution for me.

Same as @kenyodev

Needed to update node.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

imthenachoman picture imthenachoman  Β·  3Comments

PopGoesTheWza picture PopGoesTheWza  Β·  4Comments

OleksandrRakovets picture OleksandrRakovets  Β·  3Comments

freddy-daniel picture freddy-daniel  Β·  7Comments

RomainVialard picture RomainVialard  Β·  5Comments