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

[ERR_PACKAGE_PATH_NOT_EXPORTED] when running ng e2e #1869

Closed
dmdum opened this issue Dec 10, 2021 · 12 comments · Fixed by #1870
Closed

[ERR_PACKAGE_PATH_NOT_EXPORTED] when running ng e2e #1869

dmdum opened this issue Dec 10, 2021 · 12 comments · Fixed by #1870

Comments

@dmdum
Copy link

dmdum commented Dec 10, 2021

Hello, trying to use cucumber with protractor in angular.
When running ng e2e --port 4201 I get an error:

E/launcher - Error: Error [ERR_PACKAGE_PATH_NOT_EXPORTED] [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './package.json' is not defined by "exports" in C:\Users\dndum\Documents\Projects\angular-project\node_modules@cucumber\cucumber\package.json
at throwExportsNotFound (internal/modules/esm/resolve.js:299:9)
at packageExportsResolve (internal/modules/esm/resolve.js:522:3)
at resolveExports (internal/modules/cjs/loader.js:424:36)
at Function.Module._findPath (internal/modules/cjs/loader.js:464:31)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:802:27)
at Function.Module._load (internal/modules/cjs/loader.js:667:27)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at ModuleLoader.require (C:\Users\dndum\Documents\Projects\angular-project\node_modules@serenity-js\core\src\io\ModuleLoader.ts:68:20)
at ModuleLoader.versionOf (C:\Users\dndum\Documents\Projects\angular-project\node_modules@serenity-js\core\src\io\ModuleLoader.ts:80:33)
[11:27:45] E/launcher - Process exited with error code 100
An unexpected error occurred: undefined

Please advise on how to proceed.
Thank you!

@aurelien-reeves
Copy link
Contributor

Hi,

Thank you for your report.

With v8.0.0-rc.1 and the ESM support, indeed package.json is not exported anymore. I will take a look on that to see if we can add it to the exports.

This is actually related to that: #1853
serenity-js wants to check the version number from the package.json.
It is difficult to ask them to do otherwise as this is within a generic module loader: https://github.com/serenity-js/serenity-js/blob/master/packages/core/src/io/ModuleLoader.ts#L79

@dmdum
Copy link
Author

dmdum commented Dec 10, 2021

Hello,

Thank you for responding.
Will be using 7.3.1 instead.
Cheers!

@aurelien-reeves
Copy link
Contributor

@dmdum would you have the possibility to test with the following branch: #1870?

You should be able to do that with the following:

npm install https://github.com/cucumber/cucumber-js#export-package-json-again

Important: do not use that branch in production. This is just for testing purpose! 😅

@dmdum
Copy link
Author

dmdum commented Dec 10, 2021

I might be able to after work hours. I'll post here whatever I find.

@dmdum
Copy link
Author

dmdum commented Dec 14, 2021

Hey, sorry for the delay. Been busy the past couple of days. I tried installing today but I got this error.
image

@aurelien-reeves
Copy link
Contributor

Hey :)

Indeed, the branch has been merged on main.
Could you try npm install https://github.com/cucumber/cucumber-js?

@dmdum
Copy link
Author

dmdum commented Dec 14, 2021

Got another error
Capture

@aurelien-reeves
Copy link
Contributor

Yes
I have suggested a totally wrong command 😑
It won't be as easy as I though because the package needs to be built. So, unfortunately you won't be able to test it before we release it.

Sorry for that 😓

@dmdum
Copy link
Author

dmdum commented Dec 14, 2021

Oh, no worries. Btw, I'm actually still learning cucumber and I was wondering if I can use it on Angular alone without Protractor. Would that be possible? I've been looking for a setup guide on how to do that but Cucumber always seems to be paired with something...

@aurelien-reeves
Copy link
Contributor

Actually I don't know Angular or Protractor.
Cucumber can work on its own, it does not need to be coupled with something else.

But maybe Angular itself requires Protractor?

@dmdum
Copy link
Author

dmdum commented Dec 14, 2021

Hmmm, yeah maybe that's it, thanks.

@davidjgoss
Copy link
Contributor

Protractor is (or was when I last used it) essentially a wrapper around WebDriver that had special handling for Angular's event loop etc.

You could definitely test an Angular app with Cucumber paired with WebDriver, Puppeteer or Playwright.

There's an example here with Puppeteer (not an endorsement of that over any of the other options, just something I've used).

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

Successfully merging a pull request may close this issue.

3 participants