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

Cannot find module 'stryker-api/config' when running npx stryker init #1440

Closed
trollepierre opened this issue Mar 7, 2019 · 16 comments
Closed
Labels
🐛 Bug Something isn't working

Comments

@trollepierre
Copy link

Hi,
I run npx stryker init on my new computer.
I got this error: Cannot find module 'stryker-api/config'

Your Environment

| MacOS | Mojace 10.14.3

| node | 10.14.2
| npm | 6.4.1

@simondel
Copy link
Member

simondel commented Mar 7, 2019

Thanks for opening this issue!

Could you share your logging? I can't reproduce this on my machine.

@trollepierre
Copy link
Author

yes, if you tell me how to get more than this picture ;-)

capture d ecran 2019-03-07 a 12 59 54

@simondel
Copy link
Member

simondel commented Mar 7, 2019

Alright. This is strange. I cannot reproduce it on my machine, but I can reproduce it in Azure on all platforms:
image

https://dev.azure.com/simondel/Public/_build/results?buildId=208&_a=summary

@simondel simondel added the 🐛 Bug Something isn't working label Mar 7, 2019
@simondel
Copy link
Member

simondel commented Mar 7, 2019

As a workaround you could globally install the stryker-cli:

npm i -g stryker-cli
stryker init

image

@trollepierre
Copy link
Author

trollepierre commented Mar 7, 2019 via email

@simondel
Copy link
Member

simondel commented Mar 7, 2019

I think something went wrong with the image

@trollepierre
Copy link
Author

can I do anything about it, to make it work?

@simondel
Copy link
Member

simondel commented Mar 8, 2019

You could either do:

npm i -g stryker-cli
 stryker init

or:

npm install --save-dev @stryker-mutator/core 
./node_modules/.bin/stryker

@simondel
Copy link
Member

simondel commented Mar 8, 2019

Ok. I've found it. npx stryker doesn't work. It should be npx stryker-cli:
stryker-mutator/stryker-cli#33

@nicojs
Copy link
Member

nicojs commented Mar 8, 2019

npx stryker does work after installing @stryker-mutator/core locally. So this should also work:

npm install --save-dev @stryker-mutator/core 
npx stryker init

@trollepierre
Copy link
Author

Ok. npx stryker-cli worked. But I got this issue at the end of the install.
Capture d’écran 2019-03-11 à 16 05 29

@simondel
Copy link
Member

@trollepierre Could you try npx stryker-cli init?

@nicojs
Copy link
Member

nicojs commented Mar 12, 2019

@trollepierre npx stryker-cli will temporary install stryker-cli (standard npx functionality).

The stryker-cli in turn will try to find a local @stryker-mutator/core, but will not be able to find it, so it will prompt for install.

After install: stryker-cli will forward the command you have put into the fresh local @stryker-mutator/core instance. The command is "" since you didn't provide one. That's why it gives the error.

Since you've now got a local installation of Stryker, you can use npx stryker to forward commands to that local instance (again, standard npx functionality). So npx stryker init will work. npx stryker-cli init will also work (npx will install a fresh version of stryker-cli temporarily, it will find your local @stryker-mutator/core and forward the command).

@trollepierre
Copy link
Author

Awesome: maybe the documentation should be updated.
Thanks!

@nicojs
Copy link
Member

nicojs commented Mar 12, 2019

Happy to help 😄

maybe the documentation should be updated.

I think we did that last week. Can you confirm that this is more clear: https://stryker-mutator.io/stryker/quickstart

If you don't have any other problems, could you please close this issue?

@trollepierre
Copy link
Author

@nicojs : i believe npx stryker-cli init should be mentioned. It looks more simple than If you choose to not install the stryker-cli, use npx stryker (after installing @stryker-mutator/core locally) instead of stryker for the rest of the quickstart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants