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>
现在翘首以盼
补充问题:我的webstorm为什么没有configuration呢?搞得代码都不报错。。。
补上main.js内容
import ElementUI from 'element-ui'
import 'element-ui/lib/them-chalk/index.css'
Vue.use(ElementUI);
Vue.config.productionTip = false
您好,我是有问必答小助手,您的问题已经有小伙伴解答了,您看下是否解决,可以追评进行沟通哦~
如果有您比较满意的答案 / 帮您提供解决思路的答案,可以点击【采纳】按钮,给回答的小伙伴一些鼓励哦~~
ps:问答VIP仅需29元,即可享受5次/月 有问必答服务,了解详情>>>https://vip.csdn.net/askvip?utm_source=1146287632
非常感谢您使用有问必答服务,为了后续更快速的帮您解决问题,现诚邀您参与有问必答体验反馈。您的建议将会运用到我们的产品优化中,希望能得到您的支持与协助!
速戳参与调研>>>https://t.csdnimg.cn/Kf0y
答案依旧未能解决,我在想,是不是我的安装路径出了问题?但是在此之前的步骤,即未进行引入element-ui时,vue网站是能够运行的
本人从头开始建这个项目,力求将此过程中所有报错修正
重新建立过程中终于成功,依旧没找到自认为的错误,唯一值得注意的可能就是npm install element-ui时报了一个错,于是我按照
https://blog.csdn.net/qq_37658401/article/details/107828341
此答案进行修正
最终成功运行,可能是我的关注点错了吧