Я пытаюсь запустить npx eslint --init
в терминале VScode, но получаю эту ошибку:
npx 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? JSON
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.20.0 @typescript-eslint/eslint-plugin@latest eslint-config-airbnb@latest eslint@^5.16.0 || ^6.8.0 || ^7.2.0 eslint-plugin-import@^2.21.2 eslint-plugin-jsx-a11y@^6.3.0 eslint-plugin-react-hooks@^4 || ^3 || ^2.3.0 || ^1.7.0 @typescript-eslint/parser@latest
? Would you like to install them now with npm? Yes
Installing eslint-plugin-react@^7.20.0, @typescript-eslint/eslint-plugin@latest, eslint-config-airbnb@latest, eslint@^5.16.0 || ^6.8.0 || ^7.2.0, eslint-plugin-import@^2.21.2, eslint-plugin-jsx-a11y@^6.3.0, eslint-plugin-react-hooks@^4 || ^3 || ^2.3.0 || ^1.7.0, @typescript-eslint/parser@latest
npm WARN checkPermissions Missing write access to /mnt/c/users/janbdev/new-app/node_modules/@typescript-eslint/typescript-estree
npm WARN checkPermissions Missing write access to /mnt/c/users/janbdev/new-app/node_modules/@typescript-eslint/eslint-plugin
npm WARN checkPermissions Missing write access to /mnt/c/users/janbdev/new-app/node_modules/@typescript-eslint/experimental-utils
npm WARN checkPermissions Missing write access to /mnt/c/users/janbdev/new-app/node_modules/aria-query
npm WARN checkPermissions Missing write access to /mnt/c/users/janbdev/new-app/node_modules/@typescript-eslint/parser
npm WARN checkPermissions Missing write access to /mnt/c/users/janbdev/new-app/node_modules/eslint-plugin-react
npm WARN checkPermissions Missing write access to /mnt/c/users/janbdev/new-app/node_modules/eslint-plugin-react-hooks
npm WARN checkPermissions Missing write access to /mnt/c/users/janbdev/new-app/node_modules/eslint-plugin-jsx-a11y
npm WARN checkPermissions Missing write access to /mnt/c/users/janbdev/new-app/node_modules/espree
npm WARN checkPermissions Missing write access to /mnt/c/users/janbdev/new-app/node_modules/eslint-plugin-jsx-a11y/node_modules/emoji-regex
npm WARN checkPermissions Missing write access to /mnt/c/users/janbdev/new-app/node_modules/eslint
npm WARN checkPermissions Missing write access to /mnt/c/users/janbdev/new-app/node_modules
npm WARN checkPermissions Missing write access to /mnt/c/users/janbdev/new-app/node_modules/eslint-plugin-import
npm WARN checkPermissions Missing write access to /mnt/c/users/janbdev/new-app/node_modules/@typescript-eslint
npm WARN checkPermissions Missing write access to /mnt/c/users/janbdev/new-app/node_modules/@types
npm WARN checkPermissions Missing write access to /mnt/c/users/janbdev/new-app/node_modules/eslint/node_modules
npm WARN checkPermissions Missing write access to /mnt/c/users/janbdev/new-app/node_modules/watchpack-chokidar2/node_modules
npm WARN checkPermissions Missing write access to /mnt/c/users/janbdev/new-app/node_modules/webpack-dev-server/node_modules
npm WARN checkPermissions Missing write access to /mnt/c/users/janbdev/new-app/node_modules/react-scripts
npm WARN checkPermissions Missing write access to /mnt/c/users/janbdev/new-app/node_modules/eslint-plugin-import/node_modules
npm WARN checkPermissions Missing write access to /mnt/c/users/janbdev/new-app/node_modules/eslint-plugin-jsx-a11y/node_modules
npm WARN checkPermissions Missing write access to /mnt/c/users/janbdev/new-app/node_modules/jest-haste-map
npm WARN eslint-config-react-app@5.2.1 requires a peer of @typescript-eslint/eslint-plugin@2.x but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-react-app@5.2.1 requires a peer of @typescript-eslint/parser@2.x but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-react-app@5.2.1 requires a peer of eslint@6.x but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-react-app@5.2.1 requires a peer of eslint-plugin-react-hooks@1.x || 2.x but none is installed. You must install peer dependencies yourself.
npm WARN eslint-loader@3.0.3 requires a peer of eslint@^5.0.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN tsutils@3.17.1 requires a peer of 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 but none is installed. You must install peer dependencies yourself.
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /mnt/c/users/janbdev/new-app/node_modules/@typescript-eslint/typescript-estree
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/mnt/c/users/janbdev/new-app/node_modules/@typescript-eslint/typescript-estree'
npm ERR! [Error: EACCES: permission denied, access '/mnt/c/users/janbdev/new-app/node_modules/@typescript-eslint/typescript-estree'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/mnt/c/users/janbdev/new-app/node_modules/@typescript-eslint/typescript-estree'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/jansel/.npm/_logs/2020-08-06T13_21_58_467Z-debug.log
EACCES: permission denied, open './.eslintrc.json'
Error: EACCES: permission denied, open './.eslintrc.json'
at Object.openSync (fs.js:462:3)
at Object.writeFileSync (fs.js:1362:35)
at writeJSONConfigFile (/mnt/c/users/janbdev/new-app/node_modules/eslint/lib/init/config-file.js:50:8)
at Object.write (/mnt/c/users/janbdev/new-app/node_modules/eslint/lib/init/config-file.js:124:13)
at writeFile (/mnt/c/users/janbdev/new-app/node_modules/eslint/lib/init/config-initializer.js:58:16)
at /mnt/c/users/janbdev/new-app/node_modules/eslint/lib/init/config-initializer.js:608:29
at processTicksAndRejections (internal/process/task_queues.js:97:5)
Я читал об этом и нашел некоторые исправления, например:
установить eslint глобально, используя sudo npm install -g eslint
, но я получил эту ошибку
sudo: npm: command not found
Я также читал о том, что эта ошибка связана с тем, что npm не установлен на /usr/local/bin
. Я попытался переустановить npm с их веб-сайта и с терминала, но ничего не помогло.
Я также пробовал использовать npm install eslint --save-dev
, но у меня такая же ошибка с EACCES
Я работаю над windows 10 WSL2 Ubuntu 20.04, используя zsh в качестве терминала и оболочки