question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Uncaught TypeError: Parser is not a constructor

See original GitHub issue

Hi

Thanks for the plugin, we would really like to use it for our project. Unfortunately it does not seem to be working for us.

We have cypress set up and can run tests fine, but when we add in a .feature file the tests fail to run with an error:

Uncaught TypeError: Parser is not a constructor

Digging into it, it seems to be coming from here: https://github.com/TheBrainFamily/cypress-cucumber-preprocessor/blob/master/lib/loader.js#L18 I have added some console logs and can see that the gherkin module is empty when this code runs.

I have tried installing the gherkin dependency in my own project, this then results in a different error:

Error: Cannot find module 'cucumber-messages/node_modules/protobufjs' from '/Users/...my_project.../node_modules/gherkin/dist/src'

Node version is 9.11.1 npm version 6.4.0

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
joseph-abellcommented, Jan 18, 2019

Hi, I am Jamie’s colleague. So it looks like for some reason we needed to install gherkin as a dependency, despite the fact that I did not need to do so in the example app. We needed to make sure that the Gherkin version matched the one the preprocessor is expecting, and everything seems to be okay.

I’d suggest closing this ticket.

Thanks for your hard work!

0reactions
lgandeckicommented, Jan 18, 2019

coolio, great and thanks for coming back to us. Someone might hit this solution now through googling 😃 Not much we can do about this, probably one of your existing dependencies somehow depends on a gherkin internally, but on a different version, and then something like this happens? hard to say.

Thanks again and please let us know if you need help with anything else!

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: "x" is not a constructor - JavaScript - MDN Web Docs
The JavaScript exception "is not a constructor" occurs when there was an attempt to use an object or a variable as a constructor,...
Read more >
Uncaught TypeError: Parser is not a constructor #135 - GitHub
Hi Thanks for the plugin, we would really like to use it for our project. Unfortunately it does not seem to be working...
Read more >
Javascript "Not a Constructor" Exception while creating objects
Sometimes it is just how you export and import it. For this error message it could be, that the default keyword is missing....
Read more >
TypeError: parser_1.Parser is not a constructor - Help
Getting this error while creating Apollo gateway by following the article in “Federation 2 quickstart - Apollo GraphQL Docs”.
Read more >
Resolving TypeError: "X" is Not a Constructor in JavaScript
JavaScript "TypeError: "x" is not a constructor" errors occur when invalid objects or a variable is erroneously used as a constructor.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found