Clasp: TypeError: dotf is not a function

Created on 24 May 2019  Â·  16Comments  Â·  Source: google/clasp

Expected Behavior

Being able to run clasp

Actual Behavior

Gets an error message on any execution of the clasp command

Steps to Reproduce the Problem

1) Installing clasp like instructed
2) Running "clasp" or "clasp login" results in the following:

...AppData\Roaming\npm\node_modules\@google\clasp\src\dotfile.js:89
    RC: dotf(exports.DOT.RC.DIR, exports.DOT.RC.NAME),
        ^
TypeError: dotf is not a function

Specifications

  • Node version (node -v):
    v10.14.1
  • Version (clasp -v):
    Clasp -v failes
  • OS (Mac/Linux/Windows):
    Windows 10

Most helpful comment

@dermidgen : I just released [email protected] which should address this issue

All 16 comments

@robfordww there is an issue with the dotf package

A PR to fix it has been produced, for @grant to review and re-publish.

Meanwhile, the workaround is to edit Clasp package.json so that it does not use [email protected]

    "dotf": "~1.2.0",

confirmed, facing similar issue but my config is already set to use ~1.2.0 version.

@robfordww @darul75 (and others) be sure to issue a ~npm install~ after patching dotf version to ~1.2.0

On my system at least, this fixed the issue.

I am on a mac and it does not make any differences, I have tried to uninstall it globally and install a previous release but I still got this error.

"dependencies": { "chalk": "^2.4.1", "cli-spinner": "^0.2.8", "commander": "^2.15.1", "connect": "^3.6.6", "del": "^3.0.0", "dotf": "^1.2.0",

/usr/local/lib/node_modules/@google/clasp/src/dotfile.js:89
RC: dotf(exports.DOT.RC.DIR, exports.DOT.RC.NAME),
^
TypeError: dotf is not a function
at Object. (/usr/local/lib/node_modules/@google/clasp/src/dotfile.js:89:9)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object. (/usr/local/lib/node_modules/@google/clasp/src/auth.js:57:17)
at Module._compile (internal/modules/cjs/loader.js:701:30)

@darul75 (and others) for a correct workaround:

  1. patch clasp package.json with "~1.2.0" for "dotf" version
  2. from the clasp root folder run the command npm uninstall -g @google/clasp && npm run build-fresh (your system may require you to sudo that command)
  3. run clasp --version to verify clasp no longer crashes

ok, thanks my bad, I confused ^1.2.0 with ~1.2.0 your initial @PopGoesTheWza workaround worked.

Looks like a PR to dotf broke the module.


Update:

I'm still seeing multiple reports for clasp being broken.
Working on a fix.

@PopGoesTheWza Thank you for the work around!

Hi all,
I believe I've successfully deprecated the broken dotf versions on npm.

If you installed clasp between now and yesterday, you may have installed a version that includes the broken dotf package. Please re-install clasp to undo that.

Details

https://www.npmjs.com/package/dotf/v/1.2.0 – Latest/Working (published 6 months ago)
https://www.npmjs.com/package/dotf/v/1.3.0 – Broken (unpublished)
https://www.npmjs.com/package/dotf/v/1.4.0 – Broken attempt to fix (unpublished)

As a result, I believe clasp will use [email protected] as the latest.


Before:

sudo npm i @google/clasp -g
npm WARN deprecated [email protected]: Issue: https://github.com/grant/dotf/issues/10

After:

sudo npm i @google/clasp -g
+ @google/[email protected]

@grant This appears to have popped up again. When installing on a fresh system today, I got nailed with this one. It was trying to use https://www.npmjs.com/package/dotf/v/1.4.1

The same workaround above works for pinning to ~1.2.0.

You can also install via your project's package.json and run using npx clasp.

  "devDependencies": {
    "@google/clasp": "^2.2.0",
    "dotf": "~1.2.0"
  }

@dermidgen PR #739 is successful in build & test with [email protected]

Can you give more details about reproducing the issue?

@PopGoesTheWza

Ubuntu 18.04.4 LTS
Node v12.8.0
NVM v0.32.1

  • Cleaned all local & globally installed node_modules
  • Install via npm i -g @google/clasp
  • Run clasp (also ran ./src/index.js from ~/.nvm/versions/node/v12.8.0/lib/node_modules/@google/clasp for same result)
~/.nvm/versions/node/v12.8.0/lib/node_modules/@google/clasp/src/dotfile.js:112
    RC: dotf(exports.DOT.RC.DIR, exports.DOT.RC.NAME),
        ^

TypeError: dotf is not a function
    at Object.<anonymous> (~/.nvm/versions/node/v12.8.0/lib/node_modules/@google/clasp/src/dotfile.js:112:9)
    at Module._compile (internal/modules/cjs/loader.js:868:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:879:10)
    at Module.load (internal/modules/cjs/loader.js:731:32)
    at Function.Module._load (internal/modules/cjs/loader.js:644:12)
    at Module.require (internal/modules/cjs/loader.js:771:19)
    at require (internal/modules/cjs/helpers.js:68:18)
    at Object.<anonymous> (~/.nvm/versions/node/v12.8.0/lib/node_modules/@google/clasp/src/utils.js:58:17)
    at Module._compile (internal/modules/cjs/loader.js:868:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:879:10)

Also tried by using local package overrides and npx. For the same result. Any dotf > @1.2.0 is borked for me.

@dermidgen : I just released [email protected] which should address this issue

@PopGoesTheWza you nailed it. Thanks for the amazing turn-around on that! Wowza! :heart_eyes:

@dermidgen thanks for pointing out this (silly) bug early.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DominikPalo picture DominikPalo  Â·  4Comments

hariharasuthan-balaji picture hariharasuthan-balaji  Â·  8Comments

dustinmichels picture dustinmichels  Â·  4Comments

RomainVialard picture RomainVialard  Â·  5Comments

grant picture grant  Â·  3Comments