前提・実現したいこと
Next.js11&ts環境にてBuildを試みていますが、eslint関連のエラーで落ちてしまいます。
発生している問題・エラーメッセージ
bash
1> Build error occurred 2Error: Failed to load plugin '@typescript-eslint' declared in '.eslintrc': Cannot find module '@typescript-eslint/eslint-plugin'
該当のソースコード
json
1// .eslintrc 2 3{ 4 "env": { 5 "browser": true, 6 "es2021": true 7 }, 8 "extends": ["next", "next/core-web-vitals"], 9 "parser": "@typescript-eslint/parser", 10 "parserOptions": { 11 "ecmaFeatures": { 12 "jsx": true 13 }, 14 "ecmaVersion": 12, 15 "sourceType": "module" 16 }, 17 "plugins": ["react", "@typescript-eslint", "react-hooks"], 18 "rules": { 19 "react/display-name": "off" 20 } 21} 22
json
1// package.json 2 3{ 4 "name": "hoge", 5 "version": "0.1.0", 6 "private": true, 7 "scripts": { 8 "dev": "next dev", 9 "build": "next build", 10 "start": "next start", 11 "lint": "next lint" 12 }, 13 "dependencies": { 14 "@typescript-eslint/parser": "^4.28.3", 15 "moment": "^2.29.1", 16 "next": "^11.0.1", 17 "react": "^17.0.2", 18 "react-dom": "^17.0.2", 19 "react-moment": "^1.1.1" 20 // 省略 21 }, 22 "devDependencies": { 23 "@types/react": "17.0.11", 24 "@typescript-eslint/eslint-plugin": "^4.28.3", 25 "autoprefixer": "^10.2.6", 26 "eslint": "^7.30.0", 27 "eslint-config-next": "11.0.1", 28 "eslint-plugin-react": "^7.24.0", 29 "postcss": "^8.3.5", 30 "typescript": "4.3.4" 31 } 32} 33 34
試したこと
- eslintバージョン上げ
- eslint再インストール
bash
1npm i --save-dev typescript @typescript-eslint/parser
log
1npm install --save-dev eslint @typescript-eslint/eslint-plugin @typescript-eslint/parser prettier eslint-config-prettier eslint-plugin-prettier 2npm notice save @typescript-eslint/parser is being moved from dependencies to devDependencies 3npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules\fsevents): 4npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) 5 6+ eslint@7.30.0 7+ eslint-config-prettier@8.3.0 8+ eslint-plugin-prettier@3.4.0 9+ @typescript-eslint/eslint-plugin@4.28.3 10+ @typescript-eslint/parser@4.28.3 11+ prettier@2.3.2 12added 8 packages from 7 contributors, removed 2 packages, updated 5 packages, moved 1 package and audited 551 packages in 3.806s 13 1477 packages are looking for funding 15 run `npm fund` for details 16 17found 0 vulnerabilities
回答1件
あなたの回答
tips
プレビュー