エラーの発生
CreateReactAppプロジェクトのコンパイル時に色々エラーが出てきた。
エラー内容
WARNING in ./node_modules/@firebase/auth/dist/auth.esm.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/ユーザー名/プロジェクト名/node_modules/@firebase/auth/dist/ [synthetic:es6/promise/promise] ' file: Error: ENOENT: no such file or directory, open '/Users/ユーザー名/プロジェクト/node_modules/@firebase/auth/dist/ [synthetic:es6/promise/promise] '
WARNING in ./node_modules/@firebase/auth/dist/auth.esm.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/ユーザー名/プロジェクト名/node_modules/@firebase/auth/dist/ [synthetic:es6/util/arrayiterator] ' file: Error: ENOENT: no such file or directory, open '/Users/ユーザー名/プロジェクト名/node_modules/@firebase/auth/dist/ [synthetic:es6/util/arrayiterator] '
WARNING in ./node_modules/@firebase/auth/dist/auth.esm.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/ユーザー名/プロジェクト名/node_modules/@firebase/auth/dist/ [synthetic:es6/util/makeiterator] ' file: Error: ENOENT: no such file or directory, open '/Users/ユーザー名/プロジェクト名/node_modules/@firebase/auth/dist/ [synthetic:es6/util/makeiterator] '
WARNING in ./node_modules/@firebase/auth/dist/auth.esm.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/ユーザー名/プロジェクト名/node_modules/@firebase/auth/dist/ [synthetic:util/defineproperty] ' file: Error: ENOENT: no such file or directory, open '/Users/ユーザー名/プロジェクト名/node_modules/@firebase/auth/dist/ [synthetic:util/defineproperty] '
WARNING in ./node_modules/@firebase/auth/dist/auth.esm.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/ユーザー名/プロジェクト名/node_modules/@firebase/auth/dist/ [synthetic:util/global] ' file: Error: ENOENT: no such file or directory, open '/Users/ユーザー名/プロジェクト名/node_modules/@firebase/auth/dist/ [synthetic:util/global] '
WARNING in ./node_modules/@firebase/auth/dist/auth.esm.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/ユーザー名/プロジェクト名/node_modules/@firebase/auth/dist/ [synthetic:util/polyfill] ' file: Error: ENOENT: no such file or directory, open '/Users/ユーザー名/プロジェクト名/node_modules/@firebase/auth/dist/ [synthetic:util/polyfill] '
エラーの解決方法
以下のコマンドを実行後、コンパイルエラーが消えた
npm audit fix --force
(参考までに) package.jsonの中身は以下
package.json
{
"name": "xxx",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^11.2.7",
"@testing-library/user-event": "^12.8.3",
"firebase": "^8.10.1",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"react-scripts": "^2.1.3",
"web-vitals": "^0.2.4",
"workbox-background-sync": "^5.1.4",
"workbox-broadcast-update": "^5.1.4",
"workbox-cacheable-response": "^5.1.4",
"workbox-core": "^5.1.4",
"workbox-expiration": "^5.1.4",
"workbox-google-analytics": "^5.1.4",
"workbox-navigation-preload": "^5.1.4",
"workbox-precaching": "^5.1.4",
"workbox-range-requests": "^5.1.4",
"workbox-routing": "^5.1.4",
"workbox-strategies": "^5.1.4",
"workbox-streams": "^5.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}