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 'babel-eslint' (both standard and babel-eslint already installed locally) #1257

Closed
inovramadani opened this issue Mar 15, 2019 · 7 comments

Comments

@inovramadani
Copy link

commented Mar 15, 2019

What version of standard?
12.0.1

What operating system, Node.js, and npm version?
Windows 10
Node v10.15.1
NPM v.6.8.0

What did you expect to happen?
I install both standard and babel-eslint on devDependencies (locally).
I run standard --parser babel-eslint
I get the standard use babel-eslint parser to recognize babel code style and not stating it as style error

What actually happened?
I install both standard and babel-eslint on devDependencies (locally).
I run standard --parser babel-eslint
I get error: Cannot find module 'babel-eslint'

I read from previous issues 85 1167, it should be fixed when they are installed on the same level. But it does not happen on mine.

I have tried to put config below on package.json:

"standard": {
    "parser": "babel-eslint"
  }

But it does not resolve the issue.

@LinusU

This comment has been minimized.

Copy link
Member

commented Mar 15, 2019

Just tried this in an empty directory, and it works for me:

$ echo {} > package.json

$ npm add standard babel-eslint
+ babel-eslint@10.0.1
+ standard@12.0.1

$ echo 'export class Foo { test = 3 }' > index.js

$ standard --parser babel-eslint 
@timoxley

This comment has been minimized.

Copy link
Contributor

commented Mar 15, 2019

@inovramadani can you post your package.json and the exact steps to reproduce?

@timoxley

This comment has been minimized.

Copy link
Contributor

commented Mar 15, 2019

@inovramadani what happens if you run npx standard --parser babel-eslint

@inovramadani

This comment has been minimized.

Copy link
Author

commented Mar 15, 2019

Just tried this in an empty directory, and it works for me:

$ echo {} > package.json

$ npm add standard babel-eslint
+ babel-eslint@10.0.1
+ standard@12.0.1

$ echo 'export class Foo { test = 3 }' > index.js

$ standard --parser babel-eslint 

It does not work either for me.

@inovramadani what happens if you run npx standard --parser babel-eslint

It works with this one!

@inovramadani

This comment has been minimized.

Copy link
Author

commented Mar 15, 2019

@inovramadani can you post your package.json and the exact steps to reproduce?

As I explained in the beginning:
I install both standard and babel-eslint on devDependencies (locally).
I run standard --parser babel-eslint
I get error: Cannot find module 'babel-eslint'

I could notice the weird thing though, I use sublime 3 and use StandardFormat and SublimeLinter-contrib-standard packages, when I save the files get updated and reformat everything as expected when I put config below on package.json:

"standard": {
    "parser": "babel-eslint"
  }

but always got the Cannot find module 'babel-eslint' error when I do standard --fix or standard --parser babel-eslint

@timoxley

This comment has been minimized.

Copy link
Contributor

commented Mar 15, 2019

@inovramadani ok the problem is that without npx you're running a globally installed standard, not the locally installed version of standard in node_modules. The local version works because babel-eslint is installed locally. Always use npx to use locally installed executables.

@inovramadani

This comment has been minimized.

Copy link
Author

commented Mar 15, 2019

@timoxley you are right, I forgot I have installed standard globally long time before. After installing eslint and babel-eslint also globally I can use standard --fix and standard --parser babel-eslint now.
Thanks!

@lock lock bot locked as resolved and limited conversation to collaborators Jun 13, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
3 participants
You can’t perform that action at this time.