ijusplab / vue-cli-plugin-gas

Vue CLI plugin for Google Apps Script development using Clasp
11 stars 3 forks source link

Clasp not installed? #5

Closed gerboland closed 4 years ago

gerboland commented 4 years ago

Hey, I wanted to test this but hit a wall with the detection of clasp

~/vue-cli-plugin-gas-test $ npm -g install @google/clasp 
/usr/local/bin/clasp -> /usr/local/lib/node_modules/@google/clasp/src/index.js
npm WARN inquirer-autocomplete-prompt@1.0.1 requires a peer of inquirer@^5.0.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself.

+ @google/clasp@2.3.0
updated 1 package in 7.356s
~/vue-cli-plugin-gas-test $ clasp --version
2.3.0

~/vue-cli-plugin-gas-test $ vue add @ijusplab/vue-cli-plugin-gas

📦  Installing @ijusplab/vue-cli-plugin-gas...

+ @ijusplab/vue-cli-plugin-gas@2.0.4
updated 1 package and audited 1277 packages in 13.668s

48 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

✔  Successfully installed plugin: @ijusplab/vue-cli-plugin-gas

? Select locale English
? Create new script? Yes
? Select script type standalone
? Select a region UCT
? Select a timezone UCT
? Add license? No

🚀  Invoking generator for @ijusplab/vue-cli-plugin-gas...
📝 Changing files...
 GAS-PLUGIN     File not found .env. Had to create it.
⠋  Running completion hooks...Error: Cannot find module '@google/clasp/package.json'
Require stack:
- /Users/gerry/vue-cli-plugin-gas-test/node_modules/@ijusplab/vue-cli-plugin-gas/utils/claspHelpers.js
- /Users/gerry/vue-cli-plugin-gas-test/node_modules/@ijusplab/vue-cli-plugin-gas/generator/index.js
- /Users/gerry/vue-cli-plugin-gas-test/package.json
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1030:15)
    at Function.resolve (internal/modules/cjs/helpers.js:81:19)
    at isInstalled (/Users/gerry/vue-cli-plugin-gas-test/node_modules/@ijusplab/vue-cli-plugin-gas/utils/claspHelpers.js:53:33)
    at checkVersion (/Users/gerry/vue-cli-plugin-gas-test/node_modules/@ijusplab/vue-cli-plugin-gas/utils/claspHelpers.js:117:17)
    at setup (/Users/gerry/vue-cli-plugin-gas-test/node_modules/@ijusplab/vue-cli-plugin-gas/utils/claspHelpers.js:166:3)
    at Installer.setup (/Users/gerry/vue-cli-plugin-gas-test/node_modules/@ijusplab/vue-cli-plugin-gas/utils/claspHelpers.js:179:24)
    at /Users/gerry/vue-cli-plugin-gas-test/node_modules/@ijusplab/vue-cli-plugin-gas/generator/index.js:49:27
    at runGenerator (/usr/local/lib/node_modules/@vue/cli/lib/invoke.js:132:13)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async invoke (/usr/local/lib/node_modules/@vue/cli/lib/invoke.js:92:3) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/gerry/vue-cli-plugin-gas-test/node_modules/@ijusplab/vue-cli-plugin-gas/utils/claspHelpers.js',
    '/Users/gerry/vue-cli-plugin-gas-test/node_modules/@ijusplab/vue-cli-plugin-gas/generator/index.js',
    '/Users/gerry/vue-cli-plugin-gas-test/package.json'
  ]
}
⚓  Running completion hooks...
 ERROR  Error: Clasp not installed
Error: Clasp not installed
    at checkVersion (/Users/gerry/dev/donutz/app-script/vue-cli-plugin-gas-test/node_modules/@ijusplab/vue-cli-plugin-gas/utils/claspHelpers.js:118:23)
    at setup (/Users/gerry/dev/donutz/app-script/vue-cli-plugin-gas-test/node_modules/@ijusplab/vue-cli-plugin-gas/utils/claspHelpers.js:166:3)
    at Installer.setup (/Users/gerry/dev/donutz/app-script/vue-cli-plugin-gas-test/node_modules/@ijusplab/vue-cli-plugin-gas/utils/claspHelpers.js:179:24)
    at /Users/gerry/dev/donutz/app-script/vue-cli-plugin-gas-test/node_modules/@ijusplab/vue-cli-plugin-gas/generator/index.js:49:27
    at runGenerator (/usr/local/lib/node_modules/@vue/cli/lib/invoke.js:132:13)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async invoke (/usr/local/lib/node_modules/@vue/cli/lib/invoke.js:92:3)

I'm using OS X Cataline 10.15.5, and have been using GAS and clasp for some time.

I do have /usr/local/lib/node_modules/@google/clasp/package.json but perhaps my search path is bad? Help appreciated

gerboland commented 4 years ago

Hmm NODE_PATH=/usr/local/lib/node_modules vue add @ijusplab/vue-cli-plugin-gas worked. I thought that was the default...

barecool commented 4 years ago

for me it didnt work unless i installed clasp locally to the dev dependencies... i have clasp 2.3.0 installed globally and it did not detect it.

cmlima commented 4 years ago

Have you got the error output?

barecool commented 4 years ago

same as above except im on windows 10, if i install clasp as a dependency it works fine.

cmlima commented 4 years ago

Ok, thanks @barecool. The issue you and @gerboland experienced seems to be related to the isInstalled function in the claspHelpers.js file, particularly to the command require.resolve('@google/clasp/package.json').

In my case, I tested it directly in node shell. When I ran the command I got a path inside my global node modules (under /Users/cmlima/node_modules), as expected.

Regardless, I will update the README file in order to instruct other developers about installing clasp locally in case they get the same error message you did. Since I was not able to reproduce your issue, I am afraid I will not be able to do much more for now. Any help will be much appreciated.