我已经坚持了一个多小时。我遵循列出的每一步。
我从我的项目中删除了 node_modules,并在我的 mac 上找到了所有节点模块文件夹。
然后我删除了 packagelock,然后运行 npm install,这给了我一个新的 nm 和 packagelock。
运行npm start 不断给我同样的错误。我知道这不是我的代码,因为我可以签出另一个分支并得到同样的错误。
这一切都是从我安装 react 测试库并将 react-scripts 从 2.1.1 升级到 4 开始的。.
我在运行一个关于 react-scripts 的测试后由于错误而升级(我不记得它到底说了什么。)
我已经用旧的 react-scripts 版本和没有测试库将我的 package.json 重置为旧的工作版本,再次执行上述所有步骤,但仍然有错误。
我在依赖项或开发依赖项中没有 webpack。
这是我以前工作的 package.json
{
"name": "bidrlfront",
"version": "1.0.0",
"private": true,
"homepage": "./",
"dependencies": {
"@date-io/moment": "^1.3.13",
"@material-ui/core": "^4.12.3",
"@material-ui/icons": "^4.11.2",
"@material-ui/pickers": "^3.3.10",
"camelize": "^1.0.0",
"chart.js": "^2.7.3",
"classnames": "^2.2.6",
"cross-env": "^5.2.0",
"css-loader": "^1.0.0",
"dateformat": "^3.0.3",
"flux": "^3.1.3",
"lodash.find": "^4.6.0",
"moment": "^2.29.1",
"node-sass": "^4.14.1",
"react": "^16.14.0",
"react-bootstrap": "^1.6.1",
"react-dom": "^16.6.3",
"react-ga": "^2.5.6",
"react-loading": "^2.0.3",
"react-quill": "^1.3.3",
"react-router": "^4.3.1",
"react-router-dom": "^5.2.0",
"react-scripts": "2.1.1",
"shards-react": "^1.0.0",
"shortid": "^2.2.14"
},
"scripts": {
"start": "react-scripts start",
"build:prod": "cross-env REACT_APP_BASENAME=/demo/shards-dashboard-lite-react REACT_APP_GAID=UA-115105611-1 npm run build",
"build": "cross-env REACT_APP_BASENAME=/demo/shards-dashboard-lite-react react-scripts build",
"test": "react-scripts test",
"scss": "node-sass --watch -include-path src/css -o css",
"eject": "react-scripts eject",
"gitty": "node g.js"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
],
"devDependencies": {
"sass-loader": "^7.1.0"
},
"repository": {
"type": "git",
"url": "git+ssh://git@bitbucket.org/rldev2/bidrl-app.git"
},
"keywords": [],
"author": "Stephanie Raymos <sraymos@rlliquidators.com>",
"license": "ISC"
}
当错误开始发生时,这是我的 package.json
{
"name": "bidrlfront",
"version": "1.0.0",
"private": true,
"homepage": "./",
"dependencies": {
"@date-io/moment": "^1.3.13",
"@material-ui/core": "^4.12.3",
"@material-ui/icons": "^4.11.2",
"@material-ui/pickers": "^3.3.10",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^12.0.0",
"@testing-library/user-event": "^13.2.1",
"camelize": "^1.0.0",
"chart.js": "^2.7.3",
"classnames": "^2.2.6",
"cross-env": "^5.2.0",
"css-loader": "^1.0.0",
"dateformat": "^3.0.3",
"flux": "^3.1.3",
"lodash.find": "^4.6.0",
"moment": "^2.29.1",
"node-sass": "^4.14.1",
"react": "^16.14.0",
"react-bootstrap": "^1.6.1",
"react-dom": "^16.6.3",
"react-ga": "^2.5.6",
"react-loading": "^2.0.3",
"react-quill": "^1.3.3",
"react-router": "^4.3.1",
"react-router-dom": "^5.2.0",
"react-scripts": "^2.1.1",
"shards-react": "^1.0.0",
"shortid": "^2.2.14"
},
"scripts": {
"start": "react-scripts start",
"build:prod": "cross-env REACT_APP_BASENAME=/demo/shards-dashboard-lite-react REACT_APP_GAID=UA-115105611-1 npm run build",
"build": "cross-env REACT_APP_BASENAME=/demo/shards-dashboard-lite-react react-scripts build",
"test": "react-scripts test",
"scss": "node-sass --watch -include-path src/css -o css",
"eject": "react-scripts eject",
"gitty": "node g.js"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
],
"devDependencies": {
"sass-loader": "^7.1.0"
},
"repository": {
"type": "git",
"url": "git+ssh://git@bitbucket.org/rldev2/bidrl-app.git"
},
"keywords": [],
"author": "Stephanie Raymos <sraymos@rlliquidators.com>",
"license": "ISC"
}
在发生错误之前,我还全局安装了测试库和 fsevents,但卸载了这些并删除了我的 mac 上的文件夹。
我在安装测试库后尝试运行我的应用程序时收到此错误后安装了 fsevents:
错误:fsevents不可用(这个watcher只能在Darwin上使用)
我得到一个空白屏幕。这解决了这个问题。
然后我的身份验证系统出现错误记录。
我正在使用 rxjs。我不得不安装它。
收到 react-scripts 错误并将其更新到最新版本。
就在那时,一切都破裂了。
当我运行npm ls webpack 时,我得到了这个:
├─┬ css-loader@1.0.1
│ └─┬ webpack@4.46.0
│ └─┬ terser-webpack-plugin@1.4.5
│ └── webpack@4.46.0 deduped
├─┬ react-scripts@2.1.1
│ ├─┬ babel-loader@8.0.4
│ │ └── webpack@4.46.0 deduped
│ ├─┬ css-loader@1.0.0
│ │ └── webpack@4.19.1 deduped
│ ├─┬ eslint-loader@2.1.1
│ │ └── webpack@4.46.0 deduped
│ ├─┬ file-loader@2.0.0
│ │ └── webpack@4.46.0 deduped
│ ├─┬ fork-ts-checker-webpack-plugin-alt@0.4.14
│ │ └── webpack@4.46.0 deduped
│ ├─┬ html-webpack-plugin@4.0.0-alpha.2
│ │ └── webpack@4.46.0 deduped
│ ├─┬ mini-css-extract-plugin@0.4.3
│ │ └── webpack@4.46.0 deduped
│ ├─┬ optimize-css-assets-webpack-plugin@5.0.1
│ │ └── webpack@4.46.0 deduped
│ ├─┬ sass-loader@7.1.0
│ │ └── webpack@4.19.1 deduped
│ ├─┬ terser-webpack-plugin@1.1.0
│ │ └── webpack@4.46.0 deduped
│ ├─┬ url-loader@1.1.1
│ │ └── webpack@4.46.0 deduped
│ ├─┬ webpack-dev-server@3.1.9
│ │ ├─┬ webpack-dev-middleware@3.4.0
│ │ │ └── webpack@4.46.0 deduped
│ │ └── webpack@4.46.0 deduped
│ ├─┬ webpack-manifest-plugin@2.0.4
│ │ └── webpack@4.46.0 deduped
│ ├─┬ webpack@4.19.1
│ │ └─┬ uglifyjs-webpack-plugin@1.3.0
│ │ └── webpack@4.46.0 deduped
│ └─┬ workbox-webpack-plugin@3.6.3
│ └── webpack@4.46.0 deduped
└─┬ sass-loader@7.3.1
└── webpack@4.46.0 deduped