create-react-app got some warning and run eslint --init will cause project failed compile
See original GitHub issueDescribe the bug
npx create-react-app example --template typescript
I will got lots of warnning like this.
--> npx create-react-app example --template typescript
Creating a new React app in /Users/stephen/workstation/frontend/example.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template-typescript...
yarn add v1.22.4
info No lockfile found.
[1/4] π Resolving packages...
warning react-scripts > webpack-dev-server > chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
warning react-scripts > webpack > watchpack > watchpack-chokidar2 > chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
warning react-scripts > jest-environment-jsdom-fourteen > jsdom > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning react-scripts > jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning react-scripts > jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > left-pad@1.3.0: use String.prototype.padStart()
warning react-scripts > workbox-webpack-plugin > workbox-build > strip-comments > babel-plugin-transform-object-rest-spread > babel-runtime > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
[2/4] π Fetching packages...
[3/4] π Linking dependencies...
warning "react-scripts > @typescript-eslint/eslint-plugin > tsutils@3.17.1" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
[4/4] π¨ Building fresh packages...
success Saved lockfile.
success Saved 823 new dependencies.
nitialized a git repository.
Installing template dependencies using yarnpkg...
yarn add v1.22.4
[1/4] π Resolving packages...
[2/4] π Fetching packages...
[3/4] π Linking dependencies...
warning " > @testing-library/user-event@7.2.1" has unmet peer dependency "@testing-library/dom@>=5".
[4/4] π¨ Building fresh packages...
success Saved lockfile.
success Saved 22 new dependencies.
info Direct dependencies
ββ @testing-library/jest-dom@4.2.4
ββ @testing-library/react@9.5.0
ββ @testing-library/user-event@7.2.1
ββ @types/jest@24.9.1
ββ @types/node@12.12.39
ββ @types/react-dom@16.9.8
ββ @types/react@16.9.35
ββ react-dom@16.13.1
ββ react@16.13.1
ββ typescript@3.7.5
info All dependencies
ββ @sheerun/mutationobserver-shim@0.3.3
ββ @testing-library/dom@6.16.0
ββ @testing-library/jest-dom@4.2.4
ββ @testing-library/react@9.5.0
ββ @testing-library/user-event@7.2.1
ββ @types/jest@24.9.1
ββ @types/node@12.12.39
ββ @types/prop-types@15.7.3
ββ @types/react-dom@16.9.8
ββ @types/react@16.9.35
ββ @types/testing-library__dom@7.0.2
ββ @types/testing-library__react@9.1.3
ββ css.escape@1.5.1
ββ csstype@2.6.10
ββ dom-accessibility-api@0.3.0
ββ min-indent@1.0.0
ββ react-dom@16.13.1
ββ react@16.13.1
ββ redent@3.0.0
ββ strip-indent@3.0.0
ββ typescript@3.7.5
ββ wait-for-expect@3.0.2
β¨ Done in 12.37s.
We detected TypeScript in your project (src/App.test.tsx) and created a tsconfig.json file for you.
Your tsconfig.json has been populated with default values.
Removing template package using yarnpkg...
yarn remove v1.22.4
[1/2] π Removing module cra-template-typescript...
[2/2] π¨ Regenerating lockfile and installing missing dependencies...
warning " > @testing-library/user-event@7.2.1" has unmet peer dependency "@testing-library/dom@>=5".
success Uninstalled packages.
β¨ Done in 10.95s.
Created git commit.
Success! Created example at /Users/stephen/workstation/frontend/example
Inside that directory, you can run several commands:
yarn start
Starts the development server.
yarn build
Bundles the app into static files for production.
yarn test
Starts the test runner.
yarn eject
Removes this tool and copies build dependencies, configuration files
and scripts into the app directory. If you do this, you canβt go back!
We suggest that you begin by typing:
cd example
yarn start
I got these warning. ok ,next setp run this command to init eslint
node_modules/.bin/eslint --init
.
οnode_modules/.bin/eslint --init
? How would you like to use ESLint? To check syntax, find problems, and enforce code style
? What type of modules does your project use? JavaScript modules (import/export)
? Which framework does your project use? React
? Does your project use TypeScript? Yes
? Where does your code run? Browser
? How would you like to define a style for your project? Use a popular style guide
? Which style guide do you want to follow? Airbnb: https://github.com/airbnb/javascript
? What format do you want your config file to be in? JavaScript
Checking peerDependencies of eslint-config-airbnb@latest
Local ESLint installation not found.
The config that you've selected requires the following dependencies:
eslint-plugin-react@^7.19.0 @typescript-eslint/eslint-plugin@latest eslint-config-airbnb@latest eslint@^5.16.0 || ^6.8.0 eslint-plugin-import@^2.20.1 eslint-plugin-jsx-a11y@^6.2.3 eslint-plugin-react-hooks@^2.5.0 || ^1.7.0 @typescript-eslint/parser@latest
? Would you like to install them now with npm? Yes
Installing eslint-plugin-react@^7.19.0, @typescript-eslint/eslint-plugin@latest, eslint-config-airbnb@latest, eslint@^5.16.0 || ^6.8.0, eslint-plugin-import@^2.20.1, eslint-plugin-jsx-a11y@^6.2.3, eslint-plugin-react-hooks@^2.5.0 || ^1.7.0, @typescript-eslint/parser@latest
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated left-pad@1.3.0: use String.prototype.padStart()
npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN rm not removing /Users/stephen/workstation/frontend/example/node_modules/.bin/jest as it wasn't installed by /Users/stephen/workstation/frontend/example/node_modules/jest
npm WARN rm not removing /Users/stephen/workstation/frontend/example/node_modules/.bin/rimraf as it wasn't installed by /Users/stephen/workstation/frontend/example/node_modules/rimraf
npm WARN rm not removing /Users/stephen/workstation/frontend/example/node_modules/.bin/semver as it wasn't installed by /Users/stephen/workstation/frontend/example/node_modules/semver
npm WARN rm not removing /Users/stephen/workstation/frontend/example/node_modules/.bin/json5 as it wasn't installed by /Users/stephen/workstation/frontend/example/node_modules/json5
> fsevents@1.2.13 install /Users/stephen/workstation/frontend/example/node_modules/jest-haste-map/node_modules/fsevents
> node install.js
SOLINK_MODULE(target) Release/.node
CXX(target) Release/obj.target/fse/fsevents.o
SOLINK_MODULE(target) Release/fse.node
> fsevents@1.2.13 install /Users/stephen/workstation/frontend/example/node_modules/watchpack-chokidar2/node_modules/fsevents
> node install.js
SOLINK_MODULE(target) Release/.node
CXX(target) Release/obj.target/fse/fsevents.o
SOLINK_MODULE(target) Release/fse.node
> fsevents@1.2.13 install /Users/stephen/workstation/frontend/example/node_modules/webpack-dev-server/node_modules/fsevents
> node install.js
SOLINK_MODULE(target) Release/.node
CXX(target) Release/obj.target/fse/fsevents.o
SOLINK_MODULE(target) Release/fse.node
> core-js@2.6.11 postinstall /Users/stephen/workstation/frontend/example/node_modules/babel-runtime/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock
Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
> core-js@3.6.5 postinstall /Users/stephen/workstation/frontend/example/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
> core-js-pure@3.6.5 postinstall /Users/stephen/workstation/frontend/example/node_modules/core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN notsup Unsupported engine for watchpack-chokidar2@2.0.0: wanted: {"node":"<8.10.0"} (current: {"node":"14.2.0","npm":"6.14.5"})
npm WARN notsup Not compatible with your version of node/npm: watchpack-chokidar2@2.0.0
npm WARN acorn-jsx@5.2.0 requires a peer of acorn@^6.0.0 || ^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN sass-loader@8.0.2 requires a peer of node-sass@^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN sass-loader@8.0.2 requires a peer of sass@^1.3.0 but none is installed. You must install peer dependencies yourself.
npm WARN sass-loader@8.0.2 requires a peer of fibers@>= 3.1.0 but none is installed. You must install peer dependencies yourself.
+ eslint@6.8.0
+ eslint-plugin-jsx-a11y@6.2.3
+ eslint-config-airbnb@18.1.0
+ eslint-plugin-react-hooks@2.5.1
+ eslint-plugin-react@7.20.0
+ eslint-plugin-import@2.20.2
+ @typescript-eslint/eslint-plugin@2.34.0
+ @typescript-eslint/parser@2.34.0
added 211 packages from 80 contributors, removed 297 packages and updated 1396 packages in 76.931s
59 packages are looking for funding
run `npm fund` for details
Successfully created .eslintrc.js file in /Users/stephen/workstation/frontend/example
ESLint was installed locally. We recommend using this local copy instead of your globally-installed copy.
ok.run yarn start
to start project. will get failed compile tip.
Did you try recovering your dependencies?
npm --version: 6.14.5
yarn --version: 1.22.4
Which terms did you search for in User Guide?
remove the nod_modules
folder and package-lock.json
yarn.lock
then run npm install
ok after it install all packages, run yarn start
, the project will success to compile.
Environment
Environment Info:
current version of create-react-app: 3.4.1
running from /usr/local/lib/node_modules/create-react-app
System:
OS: macOS 10.15.4
CPU: (8) x64 Intel(R) Xeon(R) CPU E3-1230 v3 @ 3.30GHz
Binaries:
Node: 14.2.0 - /usr/local/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.5 - /usr/local/bin/npm
Browsers:
Chrome: 81.0.4044.138
Firefox: Not Found
Safari: 13.1
npmPackages:
react: ^16.13.1 => 16.13.1
react-dom: ^16.13.1 => 16.13.1
react-scripts: 3.4.1 => 3.4.1
npmGlobalPackages:
create-react-app: 3.4.1
Steps to reproduce
- npx create-react-app example --template typescirpt 2.cd example && node_modules/.bin/eslint --init wtih this answer
? How would you like to use ESLint? To check syntax, find problems, and enforce code style
? What type of modules does your project use? JavaScript modules (import/export)
? Which framework does your project use? React
? Does your project use TypeScript? Yes
? Where does your code run? Browser
? How would you like to define a style for your project? Use a popular style guide
? Which style guide do you want to follow? Airbnb: https://github.com/airbnb/javascript
? What format do you want your config file to be in? JavaScript
Checking peerDependencies of eslint-config-airbnb@latest
Local ESLint installation not found.
The config that you've selected requires the following dependencies:
eslint-plugin-react@^7.19.0 @typescript-eslint/eslint-plugin@latest eslint-config-airbnb@latest eslint@^5.16.0 || ^6.8.0 eslint-plugin-import@^2.20.1 eslint-plugin-jsx-a11y@^6.2.3 eslint-plugin-react-hooks@^2.5.0 || ^1.7.0 @typescript-eslint/parser@latest
? Would you like to install them now with npm? Yes
- yarn start
Expected behavior
no warning and compile success when run eslint --init.
Actual behavior
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Eslint error causing create-react-app failed to compile
I assume that you have installed ESLint using npm install eslint --save-dev and defined a default configuration withΒ ...
Read more >Create a New React App
Create React App is a comfortable environment for learning React, and is the best way to start building a new single-page application in...
Read more >Basic Features: ESLint - Next.js
Once ESLint has been set up, it will also automatically run during every build ( next build ). Errors will fail the build,...
Read more >How to add a custom ESLint configuration to a Create React ...
Go to package.json at the root of the project, and remove the eslintConfig object. Add ESLint configuration.
Read more >How to set up & deploy your React app from scratch using ...
Setting up ESLint. Linter is a program that checks our code for any error or warning that can cause bugs. JavaScript's linter, ESLint,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had this problem, too. anyone know how to fix it?tks
I had struggled with this issue for a week with no solution. I just switched to nodejs version 12 and it no more reports this error.