Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error running specs in fresh project #57

Closed
nuclearglow opened this issue Mar 11, 2020 · 7 comments
Closed

Error running specs in fresh project #57

nuclearglow opened this issue Mar 11, 2020 · 7 comments

Comments

@nuclearglow
Copy link

nuclearglow commented Mar 11, 2020

Describe the bug
A fresh install of gauge, gauge-ts and gauge init ts yields an error...

To Reproduce
Steps to reproduce the behavior:

npm install -g @getgauge/cli
gauge install ts
gauge init ts
npm i
gauge run specs/

Expected behavior
Running gauge TS project

Screenshots
n/a

Desktop (please complete the following information):

  • OS: [e.g. linux]
    cat /etc/lsb-release
    DISTRIB_ID=Ubuntu
    DISTRIB_RELEASE=18.04
    DISTRIB_CODENAME=bionic
    DISTRIB_DESCRIPTION="Ubuntu 18.04.4 LTS"

  • Gauge and plugin version [run gauge -v]
    gauge -v
    Gauge version: 1.0.7
    Commit Hash: ed7b4fd6

Plugins
html-report (4.0.9)
js (2.3.8)
screenshot (0.0.1)
ts (0.0.5)

  • Node version [run node -v]
    node -v
    v12.13.1

  • Npm version [run npm -v]
    npm -v
    6.12.1

Additional context
A couple weeks back everything was working fine on my machine, this is new... :-(

npm install -g @getgauge/cli
npm WARN deprecated [email protected]: request has been deprecated, see request/request#3142
/home/dwp6827/.nvm/versions/node/v12.13.1/bin/gauge -> /home/dwp6827/.nvm/versions/node/v12.13.1/lib/node_modules/@getgauge/cli/bin/gauge

@getgauge/[email protected] install /home/dwp6827/.nvm/versions/node/v12.13.1/lib/node_modules/@getgauge/cli
node ./src/index.js

Fetching download url for Gauge version 1.0.7
Downloading https://github.com/getgauge/gauge/releases/download/v1.0.7/gauge-1.0.7-linux.x86_64.zip to ./bin

gauge install ts
.
Successfully installed plugin 'ts' version 0.0.5

gauge install screenshot
Plugin screenshot was successfully added to the project

gauge install html-report
........................
gSuccessfully installed plugin 'html-report' version 4.0.9

gauge install js
..........
[grpc] Success: "/tmp/gauge_temp1583938237445470161/node_modules/grpc/src/node/extension_binary/node-v72-linux-x64-glibc/grpc_node.node" is installed via remote
Attention
Console-stamp version 3.0.0 Release Candidate is out. Install by using the tag '@next'. NB: Breaking changes.
For more details goto: https://www.npmjs.com/package/console-stamp/v/next

added 172 packages from 164 contributors and audited 886 packages in 4.224s
found 1 moderate severity vulnerability
run npm audit fix to fix them, or npm audit for details
auSuccessfully installed plugin 'js' version 2.3.8

gauge init ts
Downloading ts.zip
.
Copying Gauge template ts to current directory ...

[email protected] install /home/dwp6827/workspace/dwp/taiko-ts-test2/node_modules/grpc
node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp WARN Using needle for node-pre-gyp https download
[grpc] Success: "/home/dwp6827/workspace/dwp/taiko-ts-test2/node_modules/grpc/src/node/extension_binary/node-v72-linux-x64-glibc/grpc_node.node" is installed via remote

[email protected] postinstall /home/dwp6827/workspace/dwp/taiko-ts-test2/node_modules/protobufjs
node scripts/postinstall

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.

added 122 packages from 138 contributors and audited 201 packages in 5.053s
found 0 vulnerabilities

Successfully initialized the project. Run specifications with "gauge run specs/".

gauge run specs/
internal/modules/cjs/loader.js:800
throw err;
^
Error: Cannot find module '../gen/messages'
Require stack:

  • /home/dwp6827/workspace/dwp/taiko-ts-test2/node_modules/gauge-ts/dist/connection/GaugeConnection.js
  • /home/dwp6827/workspace/dwp/taiko-ts-test2/node_modules/gauge-ts/dist/connection/GaugeListener.js
  • /home/dwp6827/workspace/dwp/taiko-ts-test2/node_modules/gauge-ts/dist/GaugeRuntime.js
  • /home/dwp6827/workspace/dwp/taiko-ts-test2/[eval].ts
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)
    at Function.Module._load (internal/modules/cjs/loader.js:690:27)
    at Module.require (internal/modules/cjs/loader.js:852:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object. (/home/dwp6827/workspace/dwp/taiko-ts-test2/node_modules/gauge-ts/dist/connection/GaugeConnection.js:6:20)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Module.require (internal/modules/cjs/loader.js:852:19)
    gauge -vError ----------------------------------

[Gauge]
Failed to start gauge API: Timed out connecting to 127.0.0.1:39227

Get Support ----------------------------
Docs: https://docs.gauge.org
Bugs: https://github.com/getgauge/gauge/issues
Chat: https://spectrum.chat/gauge

Your Environment Information -----------
linux, 1.0.7, ed7b4fd6
html-report (4.0.9), js (2.3.8), screenshot (0.0.1), ts (0.0.5)

@nuclearglow
Copy link
Author

Just switched to my Mac and was able to reproduce, here it is a fresh install of Gauge:

$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.15.3
BuildVersion: 19D76

node -v
v12.13.0

npm -v
6.12.0

gauge -v
Gauge version: 1.0.7
Commit Hash: ed7b4fd6

Plugins

html-report (4.0.9)
js (2.3.8)
screenshot (0.0.1)
ts (0.0.5)

npm i -g @getgauge/cli
npm WARN deprecated [email protected]: request has been deprecated, see request/request#3142
/Users/vowe/.nvm/versions/node/v12.13.0/bin/gauge -> /Users/vowe/.nvm/versions/node/v12.13.0/lib/node_modules/@getgauge/cli/bin/gauge

@getgauge/[email protected] install /Users/vowe/.nvm/versions/node/v12.13.0/lib/node_modules/@getgauge/cli
node ./src/index.js

Fetching download url for Gauge version 1.0.7
Downloading https://github.com/getgauge/gauge/releases/download/v1.0.7/gauge-1.0.7-darwin.x86_64.zip to ./bin

gauge install js
gauge i...n....sta...
[grpc] Success: "/private/var/folders/lx/642lfljs6zv9q3gnhf2vpktc0000gn/T/gauge_temp1583939475692132000/node_modules/grpc/src/node/extension_binary/node-v72-darwin-x64-unknown/grpc_node.node" is installed via remote
Attention
Console-stamp version 3.0.0 Release Candidate is out. Install by using the tag '@next'. NB: Breaking changes.
For more details goto: https://www.npmjs.com/package/console-stamp/v/next

added 172 packages from 164 contributors and audited 886 packages in 4.289s

gauge init ts
Downloading ts.zip
.
Copying Gauge template ts to current directory ...

[email protected] install /Users/vowe/workspace/experiments/test-gauge-ts/node_modules/grpc
node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp WARN Using needle for node-pre-gyp https download
[grpc] Success: "/Users/vowe/workspace/experiments/test-gauge-ts/node_modules/grpc/src/node/extension_binary/node-v72-darwin-x64-unknown/grpc_node.node" is installed via remote

[email protected] postinstall /Users/vowe/workspace/experiments/test-gauge-ts/node_modules/protobufjs
node scripts/postinstall

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.

added 122 packages from 138 contributors and audited 201 packages in 15.931s
found 0 vulnerabilities

Successfully initialized the project. Run specifications with "gauge run specs/".

gauge run specs/
internal/modules/cjs/loader.js:797
throw err;
^
Error: Cannot find module '../gen/messages'
Require stack:

  • /Users/vowe/workspace/experiments/test-gauge-ts/node_modules/gauge-ts/dist/connection/GaugeConnection.js
  • /Users/vowe/workspace/experiments/test-gauge-ts/node_modules/gauge-ts/dist/connection/GaugeListener.js
  • /Users/vowe/workspace/experiments/test-gauge-ts/node_modules/gauge-ts/dist/GaugeRuntime.js
  • /Users/vowe/workspace/experiments/test-gauge-ts/[eval].ts
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:794:15)
    at Function.Module._load (internal/modules/cjs/loader.js:687:27)
    at Module.require (internal/modules/cjs/loader.js:849:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object. (/Users/vowe/workspace/experiments/test-gauge-ts/node_modules/gauge-ts/dist/connection/GaugeConnection.js:6:20)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:849:19)

@BugDiver
Copy link
Member

@nuclearglow Thanks for reporting the issue. Seems like the latest release didn't happen properly. I will look into it soon. Meanwhile, you can continue with the old version.

@BugDiver
Copy link
Member

Can you check what version of gauge-ts is specified in your package.json? Can you try making that 0.0.5 and running npm install and then running the tests again?

@nuclearglow
Copy link
Author

Sure, good one, now it worked, I guess, at least on Mac:
package.json:

  "dependencies": {
    "gauge-ts": "0.0.5"
  },

gauge run specs/

Specification Heading

Vowel counts in single word ✔ ✔

Vowel counts in multiple word ✔ ✔

Successfully generated html-report to => /Users/vowe/workspace/experiments/test-gauge-ts/reports/html-report/index.html

Specifications: 1 executed 1 passed 0 failed 0 skipped
Scenarios: 2 executed 2 passed 0 failed 0 skipped

Total time taken: 500ms

@nuclearglow
Copy link
Author

@BugDiver just switched to Ubuntu, the fix is also working there! Great, thanks for your quick help, it seems the gauge-ts template was not updated to reflect the 0.0.5 change in package.json.

@BugDiver
Copy link
Member

BugDiver commented Mar 12, 2020

@nuclearglow Thanks for confirming.
This tells me that sometimes there can be a mismatch between gauge-ts plugin (it includes starter script )and the gauge-ts (it includes all typescript related code) npm library and that can cause an issue.

So I was thinking of adding a check in the starter script to make sure the gauge-ts version in projects matches it. We can do one of the two

  1. If there is a mismatch it can error out suggesting to fix the version
  2. If there is a mismatch it can try to upgrade the version in the project informing the user

I prefer 2. What do you say?

@nuclearglow
Copy link
Author

Do you mean launcher.js (https://github.com/BugDiver/gauge-ts/blob/master/launcher.js#L3)?
It seems the version is derived from ts.json?

I have two ideas here (but only had a short look):

  • When you release, you could bump up both versions, in ts.json and package.json at the same time.that could help avoid mismatches
  • When launcher.js starts, it should definitely check the output from gauge -v and check the ts version (is there a way to get a plugin version directly?) and also check the dependency in ts.json. I guess if the gauge version is lower, a gauge update ts could do the trick, otherwise a package.json update can be done in your template

So yes, I guess version 2 could work fine...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants