question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Spectral Docker Develop Image - Module Not Found

See original GitHub issue

Describe the bug Attempting to use the linter provided by the Spectral docker image (https://hub.docker.com/r/stoplight/spectral) and getting a node “Module Not Found” error. This only seems to happen with the develop tag, which I am utilizing because I wanted to make use of the new Junit formatter (https://github.com/stoplightio/spectral/pull/519).

To Reproduce

stoplight/spectral:latest (completes without error):

docker run -v "$(pwd):/app" stoplight/spectral:latest lint "/app/storage/api-docs/api-docs.json" --verbose --format=json --output="/app/api-violations.json" 

spotlight/spectral:develop (throws error):

docker run -v "$(pwd):/app" stoplight/spectral:develop lint "/app/storage/api-docs/api-docs.json" --verbose --format=junit --output="/app/api-violations.json"

Stacktrace

internal/modules/cjs/loader.js:775
    throw err;
    ^

Error: Cannot find module 'tslint/lib/utils'
Require stack:
- /usr/src/spectral/dist/functions/schema.js
- /usr/src/spectral/dist/functions/index.js
- /usr/src/spectral/dist/spectral.js
- /usr/src/spectral/dist/cli/services/linter.js
- /usr/src/spectral/dist/cli/commands/lint.js
- /usr/src/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/src/spectral/dist/functions/schema.js:8: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/src/spectral/dist/functions/schema.js',
    '/usr/src/spectral/dist/functions/index.js',
    '/usr/src/spectral/dist/spectral.js',
    '/usr/src/spectral/dist/cli/services/linter.js',
    '/usr/src/spectral/dist/cli/commands/lint.js',
    '/usr/src/spectral/dist/cli/index.js'
  ]
}

Expected behavior I expected the linter command to complete without errors and populate the report in junit format.

Environment (remove any that are not applicable):

Debugging Attempts

  • Tried to create a new dockerfile and add the required module myself in the build but was not successful.
  • Googled the missing module and haven’t found a clear source of the problem.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
XVincentXcommented, Sep 24, 2019

It turns out it’s used in another part as well. #592

0reactions
philsturgeoncommented, Sep 25, 2019

Junit is in v4.2.0-beta2 so you can npm install that. 😎

– Phil Sturgeon @philsturgeon

On Sep 24, 2019, at 16:21, Chad Windnagle notifications@github.com wrote:

Thanks @XVincentX want to confirm after the new build its working! Thanks so much for this. I can now fully implement into our CI / CD.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Create and Run a Native Docker Container - TechDocs
To create an MLS container: docker run -e LANDSCAPE_HANDLE=128 -e IS_MLS=yes -e ROOT_PASSWORD=<pwd> -it spectrum-ss-image · To create Non-MLS/LS ...
Read more >
stoplight/spectral - Docker Image
Demo of Spectral linting an OpenAPI document from the CLI CircleCI npm Downloads Stoplight Forest. Custom Rulesets: Create custom rules to lint JSON...
Read more >
Docker integration with IBM Spectrum Symphony
This blog article takes IBM Spectrum Symphony as examples to illustrate ... The Docker image can then be stored and distributed by a...
Read more >
Docker and the RIS Compute Service
The development of “modules” that would use environment variables and ... A Docker container image is a lightweight, standalone, executable package of ...
Read more >
Building Python Data Science Container using Docker
Powering a wide spectrum of use-cases ranging from self-driving ... with the Dockerfile using the terminal and build the image using the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found