Skip to content

Cannot find module 'eslint/lib/formatters/stylish' #3617

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

Closed
MaronMariusz opened this issue Dec 17, 2017 · 8 comments
Closed

Cannot find module 'eslint/lib/formatters/stylish' #3617

MaronMariusz opened this issue Dec 17, 2017 · 8 comments

Comments

@MaronMariusz
Copy link

MaronMariusz commented Dec 17, 2017

Hi,

I found some strange issue to me:

Failed to compile.
./src/index.js
Module build failed: Error: Cannot find module 'eslint/lib/formatters/stylish'

What I did is just create app by using create-react-app myapp-name and that worked fine.
After that I had to push the project to repository and erase my mac disk image in order to install fresh copy of macOS image (due to some OS problems). Now I have everything fresh and after cloning repo, running npm i and then npm start I get mentioned message.

Moreover I tested it on newly created project and build works - for my app that I work on - does not.

I tried to test some case and steps like following:

  1. create-react-app myapp
  2. cd myapp
  3. rm -rf node_modules/
  4. cd ..
  5. mv myapp otherapp
  6. cd otherapp/
  7. npm i
  8. npm start

are good example to reproduce described issue.

My node version is: 9.3.0.
Trying it with 4.x and nothing changed.

Do you have some quick tip how to resolve it ?
Thanks.

@eltoro
Copy link

eltoro commented Dec 20, 2017

I had the same issue. I solved it by just installing eslint in the project: npm install eslint -S

@gaearon
Copy link
Contributor

gaearon commented Dec 20, 2017

Please provide package.json. This information is not sufficient to help you.

My guess is you tried to install eslint manually by adding it to package.json. This can break things. Please remove it and try again.

I solved it by just installing eslint in the project: npm install eslint -S

This will cause further issues. Please don't do this unless you've ejected and know what you're doing.

@stephenfjohnson
Copy link

stephenfjohnson commented Dec 22, 2017

Ran into the same issue! I tried installing eslint in my local project. Now even after being removed my build is broken. Did what @eltoro did and it solved it.

{
  "name": "backdrop-finder",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "apollo-cache-inmemory": "^1.1.0",
    "apollo-client": "^2.0.2",
    "apollo-link-http": "^1.1.0",
    "eslint": "^4.13.1",
    "graphql": "^0.11.7",
    "graphql-tag": "^2.5.0",
    "mapbox-gl": "^0.41.0",
    "mapbox-gl-geocoder": "^2.0.1",
    "polished": "^1.9.0",
    "react": "^16.0.0",
    "react-amplitude": "0.0.6",
    "react-apollo": "^2.0.1",
    "react-dom": "^16.0.0",
    "react-instagram-embed": "^1.3.2",
    "react-mapbox-gl": "^2.7.0",
    "react-router-dom": "^4.2.2",
    "react-scripts": "1.0.17",
    "styled-components": "^2.2.3"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  }
}

@gaearon
Copy link
Contributor

gaearon commented Dec 22, 2017

It's not supported to try to install these tools into a project managed by react-scripts. Please don't do this, you'll just break the setup. I filed an issue to make it harder to break this way: #3638.

I'll close this one as it seems to be caused by a misunderstanding of how CRA works.

@gaearon gaearon closed this as completed Dec 22, 2017
@jnelken
Copy link

jnelken commented Jan 5, 2018

I removed node_modules folder and the package.lock.json file and then ran npm install.

Fixed it for me

@flyher
Copy link

flyher commented Jan 8, 2018

@eltoro
It works for me, thank you!

@abohannon
Copy link

I uninstalled eslint from my project with no luck. Only thing that worked for me was installing eslint into my dependencies rather than my devDependencies.

@gaearon
Copy link
Contributor

gaearon commented Jan 10, 2018

If you haven't ejected and see this problem:

  1. Remove anything with the word eslint from package.json
  2. Remove package-lock.json and yarn.lock
  3. Remove node_modules
  4. Run npm install (or yarn if you use it)

@facebook facebook locked and limited conversation to collaborators Jan 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants