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 'json-schema-faker' #283

Closed
xieyx opened this issue May 10, 2019 · 5 comments · Fixed by #289
Closed

Cannot find module 'json-schema-faker' #283

xieyx opened this issue May 10, 2019 · 5 comments · Fixed by #289

Comments

@xieyx
Copy link

xieyx commented May 10, 2019

when i run

prism mock https://raw.githack.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore-expanded.yaml

show me

Error: Cannot find module 'json-schema-faker'
    at Object.<anonymous> (~/.nvm/versions/node/v8.9.3/lib/node_modules/@stoplight/prism-cli/node_modules/@stoplight/prism-http/lib/mocker/generator/JSONSchemaExampleGenerator.js:5:11)
@philsturgeon
Copy link
Contributor

Hey, let’s get this sorted! What was your installation method and which version are you running, and are we on windows, OS X or Linux here?

@tbarn
Copy link
Contributor

tbarn commented May 10, 2019

I get the same error when I do:

➜  Stoplight npm install -g @stoplight/prism-cli@alpha
npm WARN deprecated [email protected]: Package no longer supported. Contact [email protected] for more info.
npm WARN deprecated [email protected]: This module has moved and is now available at @hapi/bourne. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
/Users/taylorbarnett/.nvm/versions/node/v10.15.3/bin/prism -> /Users/taylorbarnett/.nvm/versions/node/v10.15.3/lib/node_modules/@stoplight/prism-cli/bin/run
+ @stoplight/[email protected]
added 288 packages from 276 contributors in 44.784s
➜  Stoplight prism mock https://raw.githack.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore-expanded.yaml

Error: Cannot find module 'json-schema-faker'
    at Object.<anonymous> (~/.nvm/versions/node/v10.15.3/lib/node_modules/@stoplight/prism-cli/node_modules/@stoplight/prism-http/lib/mocker/generator/JSONSchemaExampleGenerator.js:5:11)
➜  Stoplight nvm current
v10.15.3

@XVincentX
Copy link
Contributor

This is happening because we're using the resolutions property in the package.json which is working exclusively with yarn. We'll figure out a way to get rid of this.

In meantime, @xieyx, can you try to install Spectral using the binaries or yarn?

yarn global add @stoplight/prism-cli

@XVincentX
Copy link
Contributor

XVincentX commented May 10, 2019

@xieyx This should now be fixed in the latest alpha. Just upgrade your local installation with the same command you ran:

Make sure to use the latest npm:

npm i -g npm
npm i -g @stoplight/prism-cli@alpha or also npm i -g @stoplight/prism-cli

@xieyx
Copy link
Author

xieyx commented May 20, 2019

@XVincentX Thanks. It's ok now.

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.

4 participants