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' #2012

Closed
danilobjr opened this issue May 12, 2020 · 7 comments
Closed

Cannot find module 'json-schema' #2012

danilobjr opened this issue May 12, 2020 · 7 comments
Labels
duplicate This issue or pull request already exists package: utils Issues related to the @typescript-eslint/utils package

Comments

@danilobjr
Copy link

danilobjr commented May 12, 2020

Hello. I'm getting an error when trying to run a npm script on terminal. I got below code from TypeScript-Node-Starter repo from Microsoft. I just updated all packages to the latest version. Maybe something is not right with new versions or am I doing something wrong? Thanks in advance.

Repro

On terminal

yarn lint

lint script on package.json

  ...
  "lint": "tsc --noEmit && eslint \"**/*.{js,ts}\" --quiet --fix",
  ...

.eslintrc.js file. Simplified version of Microsoft one.

module.exports = {
  root: true,
  parser: "@typescript-eslint/parser",
  plugins: [
    '@typescript-eslint',
  ],
  "extends": [
    'plugin:@typescript-eslint/eslint-recommended',
  ],
}

Expected Result

Run without errors

Actual Result

Throws an exception

Additional Info

I just run this command in terminal yarn lint ---debug and got this:

  eslint:cli CLI args: [ '**/*.{js,ts}', '--quiet', '--fix', '--debug' ] +0ms                                                
  eslint:cli Running on files +3ms                                                                                           
  eslint:config-array-factory Loading .eslintignore file: /home/danilo/repos/acal-web-api/.eslintignore +0ms                 
  eslint:ignore-pattern Create with: [ IgnorePattern { patterns: [ '/**/node_modules/*' ], basePath: '/home/danilo/repos/acal
-web-api', loose: false } ] +0ms                                                                                             
  eslint:ignore-pattern   processed: { basePath: '/home/danilo/repos/acal-web-api', patterns: [ '/**/node_modules/*' ] } +1ms
  eslint:ignore-pattern Create with: [ IgnorePattern { patterns: [ '/**/node_modules/*' ], basePath: '/home/danilo/repos/acal
-web-api', loose: false } ] +1ms                                                                                             
  eslint:ignore-pattern   processed: { basePath: '/home/danilo/repos/acal-web-api', patterns: [ '/**/node_modules/*' ] } +0ms
  eslint:file-enumerator Start to iterate files: [ '**/*.{js,ts}' ] +0ms                                                     
  eslint:file-enumerator Glob: /home/danilo/repos/acal-web-api/**/*.{js,ts} +1ms                                             
  eslint:file-enumerator recursive? true +1ms                                                                                
  eslint:file-enumerator Enter the directory: /home/danilo/repos/acal-web-api +1ms                                           
  eslint:cascading-config-array-factory Load config files for /home/danilo/repos/acal-web-api. +0ms                          
  eslint:cascading-config-array-factory No cache found: /home/danilo/repos/acal-web-api. +0ms                                
  eslint:config-array-factory Loading JS config file: /home/danilo/repos/acal-web-api/.eslintrc.js +5ms                      
  eslint:config-array-factory Config file found: /home/danilo/repos/acal-web-api/.eslintrc.js +1ms                           
  eslint:config-array-factory Loading {extends:"plugin:@typescript-eslint/eslint-recommended"} relative to /home/danilo/repos
/acal-web-api/.eslintrc.js +0ms                                                                                              
  eslint:config-array-factory Loading plugin "@typescript-eslint" from /home/danilo/repos/acal-web-api/.eslintrc.js +0ms     
  eslint:config-array-factory Loaded: @typescript-eslint/eslint-plugin@2.32.0 (/home/danilo/repos/acal-web-api/node_modules/@
typescript-eslint/eslint-plugin/dist/index.js) +1ms                                                                          
  eslint:config-array-factory Failed to load plugin '@typescript-eslint' declared in '.eslintrc.js'. +8ms                    
                                                                                                                             
Oops! Something went wrong! :(                                                                                               
                                                                                                                             
ESLint: 7.0.0                                                                                                                
                                                                                                                             
Error: Failed to load plugin '@typescript-eslint' declared in '.eslintrc.js': Cannot find module 'json-schema'               
Require stack:                                                                                                               
- /home/danilo/repos/acal-web-api/node_modules/@typescript-eslint/experimental-utils/dist/json-schema.js                     
- /home/danilo/repos/acal-web-api/node_modules/@typescript-eslint/experimental-utils/dist/index.js                           
- /home/danilo/repos/acal-web-api/node_modules/@typescript-eslint/eslint-plugin/dist/rules/adjacent-overload-signatures.js   
- /home/danilo/repos/acal-web-api/node_modules/@typescript-eslint/eslint-plugin/dist/rules/index.js                          
- /home/danilo/repos/acal-web-api/node_modules/@typescript-eslint/eslint-plugin/dist/index.js                                
- /home/danilo/repos/acal-web-api/node_modules/eslint/lib/cli-engine/config-array-factory.js                                 
- /home/danilo/repos/acal-web-api/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js                       
- /home/danilo/repos/acal-web-api/node_modules/eslint/lib/cli-engine/cli-engine.js                                           
- /home/danilo/repos/acal-web-api/node_modules/eslint/lib/eslint/eslint.js                                                   
- /home/danilo/repos/acal-web-api/node_modules/eslint/lib/eslint/index.js                                                    
- /home/danilo/repos/acal-web-api/node_modules/eslint/lib/cli.js                                                             
- /home/danilo/repos/acal-web-api/node_modules/eslint/bin/eslint.js                                                          
Referenced from: /home/danilo/repos/acal-web-api/.eslintrc.js                                                                
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15)                                              
    at Function.Module._load (internal/modules/cjs/loader.js:840:27)                                                         
    at Module.require (internal/modules/cjs/loader.js:1019:19)                                                               
    at require (/home/danilo/repos/acal-web-api/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)                    
    at Object.<anonymous> (/home/danilo/repos/acal-web-api/node_modules/@typescript-eslint/experimental-utils/dist/json-schem
a.js:7:10)                                                                                                                   
    at Module._compile (/home/danilo/repos/acal-web-api/node_modules/v8-compile-cache/v8-compile-cache.js:194:30)            
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)                                                
    at Module.load (internal/modules/cjs/loader.js:977:32)                                                                   
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)                                                         
    at Module.require (internal/modules/cjs/loader.js:1019:19)                                                               

Versions

package version
Ubuntu 20.04
@typescript-eslint/eslint-plugin 2.32.0
@typescript-eslint/parser 2.32.0
@typescript-eslint/experimental-utils 2.32.0
ESLint 7.0.0
TypeScript 3.8.3
node 12.16.3
npm 6.14.4
@danilobjr danilobjr added package: utils Issues related to the @typescript-eslint/utils package triage Waiting for maintainers to take a look labels May 12, 2020
@just-dont
Copy link

Seems like a peer dependency issue somewhere. Manually installing json-schema resolves the problem.

@LeoEatle
Copy link

#2007

waiting for release

@corno
Copy link

corno commented May 12, 2020

I experience the same issue

@marekdedic
Copy link
Contributor

Hi,
I started getting the same issue after upgrading to eslint 7.0.0... This is with @typescript-eslint/eslint-plugin 2.32.0

@saadriazkhan
Copy link

saadriazkhan commented May 12, 2020

Try downgrading to
@typescript-eslint/parser@2.31.0
and
@typescript-eslint/eslint-plugin@2.31.0

Hope this helps.

@AviVahl
Copy link

AviVahl commented May 12, 2020

This issue is a duplicate of #2009, which was fixed in master and in canary versions. We are all awaiting a release.

Unrelated to the json-schema error, is the fact that eslint@7 is not yet supported. This is tracked on #1550.

Both issues are pinned at the top of the issues list.

@bradzacher bradzacher added duplicate This issue or pull request already exists and removed triage Waiting for maintainers to take a look labels May 12, 2020
@typescript-eslint typescript-eslint locked as resolved and limited conversation to collaborators May 12, 2020
@bradzacher
Copy link
Member

This has now been released to latest - 2.33.0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists package: utils Issues related to the @typescript-eslint/utils package
Projects
None yet
Development

No branches or pull requests

8 participants