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

Can't run spectral 4.1.0 when installed via npm #524

Closed
johlo opened this issue Sep 5, 2019 · 4 comments · Fixed by #525
Closed

Can't run spectral 4.1.0 when installed via npm #524

johlo opened this issue Sep 5, 2019 · 4 comments · Fixed by #525
Labels
t/bug Something isn't working

Comments

@johlo
Copy link
Contributor

johlo commented Sep 5, 2019

Describe the bug
I installed spectral 4.1.0 via npm, when running the spectral command it errors out.
When I install 4.0.3 via npm the command works.

To Reproduce

  1. $ npm install -g @stoplight/spectral
  2. $ spectral
    This gives an error:
internal/modules/cjs/loader.js:775
    throw err;
    ^

Error: Cannot find module 'tslib'
Require stack:
- /usr/local/lib/node_modules/@stoplight/spectral/dist/cli/commands/lint.js
- /usr/local/lib/node_modules/@stoplight/spectral/dist/cli/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:772:15)
    at Function.Module._load (internal/modules/cjs/loader.js:677:27)
    at Module.require (internal/modules/cjs/loader.js:830:19)
    at require (internal/modules/cjs/helpers.js:68:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/@stoplight/spectral/dist/cli/commands/lint.js:3:17)
    at Module._compile (internal/modules/cjs/loader.js:936:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
    at Module.load (internal/modules/cjs/loader.js:790:32)
    at Function.Module._load (internal/modules/cjs/loader.js:703:12)
    at Module.require (internal/modules/cjs/loader.js:830:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/usr/local/lib/node_modules/@stoplight/spectral/dist/cli/commands/lint.js',
    '/usr/local/lib/node_modules/@stoplight/spectral/dist/cli/index.js'
  ]
}

Expected behavior
No error when running

Environment (remove any that are not applicable):

  • Library version: 4.1.0
  • OS: mac os 10.13.5
  • npm: 6.11.13

Additional context
FYI, I also tried to installed the binary by running the curl from your install instructions, but that doesn't work:

$ curl -L https://raw.githack.com/stoplightio/spectral/master/install.sh
404: Not Found
@johlo johlo added the t/bug Something isn't working label Sep 5, 2019
@P0lip
Copy link
Contributor

P0lip commented Sep 5, 2019

@johlo
I'm sorry to hear you are having troubles with latest Spectral 4.1.
I can confirm it run fine under Node 12, but 10 version is in fact broken, so a fix is certainly needed.
In the meantime, you can switch over to Node 12 if you have such a possibility.

EDIT:
@XVincentX tried it out under Node 12 and it does not work for him either. I must have tslib somewhere in node_modules, therefore it works for me.

You can also try using the compiled binaries that can be found over here https://github.com/stoplightio/spectral/releases/tag/v4.1.0.
My apologies for any inconvenience caused.

@P0lip
Copy link
Contributor

P0lip commented Sep 5, 2019

@johlo
4.1.1 containing the fix has been released.
Let me know if you face any troubles.

@johlo
Copy link
Contributor Author

johlo commented Sep 5, 2019

Works now, thanks!

@philsturgeon
Copy link
Contributor

Also the installer script 404 was due to the docs not being published after we merged v4.1.0 changes into master. The docs have been updated now, and soon they'll be auto-publishing so we don't have to remember.

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

Successfully merging a pull request may close this issue.

3 participants