7:46:30 PM [vite] Internal server error: Preprocessor dependency "less" not found. Did you install it?
Plugin: vite:css
File: /home/vagrant/jscode/pear-admin-ant/node_modules/ant-design-vue/dist/antd.less
at loadPreprocessor (/home/vagrant/jscode/pear-admin-ant/node_modules/vite/dist/node/chunks/dep-874085d4.js:34385:15)
at less (/home/vagrant/jscode/pear-admin-ant/node_modules/vite/dist/node/chunks/dep-874085d4.js:34483:22)
at compileCSS (/home/vagrant/jscode/pear-admin-ant/node_modules/vite/dist/node/chunks/dep-874085d4.js:34127:40)
at async TransformContext.transform (/home/vagrant/jscode/pear-admin-ant/node_modules/vite/dist/node/chunks/dep-874085d4.js:33776:50)
at async Object.transform (/home/vagrant/jscode/pear-admin-ant/node_modules/vite/dist/node/chunks/dep-874085d4.js:50353:30)
at async transformRequest (/home/vagrant/jscode/pear-admin-ant/node_modules/vite/dist/node/chunks/dep-874085d4.js:65394:29)
at async viteTransformMiddleware (/home/vagrant/jscode/pear-admin-ant/node_modules/vite/dist/node/chunks/dep-874085d4.js:65522:32)
node: v16.9.0
配置信息
"dependencies": {
"@ant-design-vue/use": "^0.0.1-alpha.10",
"@ant-design/icons-vue": "^6.0.1",
"@antv/g2": "^4.1.20",
"@vitejs/plugin-vue": "^1.6.2",
"ant-design-vue": "^2.2.8",
"axios": "^0.21.1",
"core-js": "^3.6.5",
"lodash.get": "^4.4.2",
"moment": "^2.27.0",
"nprogress": "^0.2.0",
"path": "^0.12.7",
"rollup-plugin-visualizer": "^5.5.2",
"vue": "^3.2.21",
"vue-i18n": "^9.1.7",
"vue-router": "^4.0.10",
"vuex": "^4.0.2"
},
"devDependencies": {
"@babel/eslint-parser": "^7.15.8",
"@types/node": "^14.17.9",
"@vue/compiler-sfc": "^3.2.21",
"@zougt/vite-plugin-theme-preprocessor": "^1.3.12",
"babel-plugin-import": "^1.13.3",
"eslint": "^6.8.0",
"eslint-plugin-vue": "^7.18.0",
"less": "^4.1.2",
"less-loader": "^10.2.0",
"mockjs2": "^1.0.8",
"node-sass": "^6.0.0",
"rollup-plugin-analyzer": "^4.0.0",
"sass-loader": "^10.0.2",
"vite": "^2.5.8"
},
尝试的方案
npm install less less-loader
和 npm install less less-loader -D
都没有效果, 删除 node_modules, 在运行这些命令也一样
替换 registry, 在运行 1 的命令也没有效果
vagrant@ubuntu:~/jscode/pear-admin-ant$ npm get registry
http://registry.npmmirror.com/
所以到底怎么搞呢兄弟们?
1
lupkcd 2021-11-17 22:58:06 +08:00
vite 自带 loader 只需要装 less
|
3
lupkcd 2021-11-17 23:33:41 +08:00
|
4
codingBug 2021-11-17 23:46:35 +08:00 via Android 1
删掉 node_modules 和 package-lock.json ,再重新安装一遍试试
|
7
sam014 2021-11-18 09:47:53 +08:00
最近我也碰到了一些 npm 依赖装不上的问题,最后发现是淘宝源没有同步,换 npm 源没有问题了
|
9
CokeMine 2021-11-18 11:27:50 +08:00 via Android 1
|
10
null00 2021-11-19 10:03:29 +08:00
命令行翻墙
|