Stryker: Cannot find module 'stryker-api/config' when running `npx stryker init`

Created on 7 Mar 2019  ·  16Comments  ·  Source: stryker-mutator/stryker

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

🐛 Bug

All 16 comments

Thanks for opening this issue!

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

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

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

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

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

npm i -g stryker-cli
stryker init

image

I would like to do that...

[image: Capture d’écran 2019-03-07 à 13.24.28.png]

Le jeu. 7 mars 2019 à 13:20, Simon de Lang notifications@github.com a
écrit :

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

npm i -g stryker-cli
stryker init

[image: image]
https://user-images.githubusercontent.com/4221997/53956389-c645f600-40db-11e9-919d-40d293b0cad0.png


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/stryker-mutator/stryker/issues/1440#issuecomment-470505018,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AH-dRlCC6vibLkhzuU1IZwXfB0t59Dnuks5vUQQpgaJpZM4bi8dk
.

>

Pierre Trollé

I think something went wrong with the image

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

You could either do:

npm i -g stryker-cli
 stryker init

or:

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

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

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

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

@trollepierre Could you try npx stryker-cli init?

@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).

Awesome: maybe the documentation should be updated.
Thanks!

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?

@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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Lakitna picture Lakitna  ·  97Comments

j-truax picture j-truax  ·  20Comments

simondel picture simondel  ·  25Comments

trollepierre picture trollepierre  ·  18Comments

davesag picture davesag  ·  17Comments