D:\NodeDemo\simple>npm i element-ui -S
npm WARN ajv-keywords@3.5.2 requires a peer of ajv@^6.9.1 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\webpack-dev-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ element-ui@2.15.1
updated 1 package in 10.033s
47 packages are looking for funding
run `npm fund` for details
安装element-ui结果如上
npm 安装如下
D:\NodeDemo\simple>npm install
npm WARN ajv-keywords@3.5.2 requires a peer of ajv@^6.9.1 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\webpack-dev-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
up to date in 6.439s
47 packages are looking for funding
run `npm fund` for details
运行npm run dev 结果如下,
This dependency was not found:
* element-ui/lib/them-chalk/index.css in ./src/main.js
To install it, you can run: npm install --save element-ui/lib/them-chalk/index.css
经搜索使用了如下方法:
1、element-ui/lib/them-chalk/...换为element-ui/lib/them-default/...更何况我的文件本身就是chalk
2、版本号,如第一段所示element-ui版本和npm版本均为最新
3、更改webpack.config.js(此处心虚,因为我找的webpack文件是从node_modules/webpack-dev-server
(这里面的文件最后修改时间是1985年,我傻了)
里找到的,还有一个是xxhashjs,后者代码内容与答案
https://blog.csdn.net/weixin_42217154/article/details/103814548
的不相同,而且中间那段test没有(我怀疑是版本的问题),但我依然加了,最后也没有解决)代码内容如下:
{ test: /.(eot|woff|ttf)$/, loader: 'url-loader' }
没有解决
4、重新安装npm,或者cnpm,参考答案
https://blog.csdn.net/yang5726685/article/details/97153845
没有解决
5、删除node_modules重新安装npm,参考答案
https://ask.csdn.net/questions/6376897
没有解决
6、按照提示
npm install --save element-ui/lib/them-chalk/index.css
在simple文件夹下运行上述命令,结果:
D:\NodeDemo\simple>npm install --save element-ui/lib/them-chalk/index.css
npm ERR! code ENOLOCAL
npm ERR! Could not install from "element-ui\lib\them-chalk\index.css" as it does not contain a package.json file.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\lenovo\AppData\Roaming\npm-cache\_logs\2021-05-08T01_52_15_984Z-debug.log
D:\NodeDemo\simple>
现在翘首以盼