首页 > 其他分享 >vue3+vite npm run build报错TypeError: (0 , import_vite_plugin_svg_icons.createSvgIconsPlugin) is not a

vue3+vite npm run build报错TypeError: (0 , import_vite_plugin_svg_icons.createSvgIconsPlugin) is not a

时间:2023-02-01 09:36:08浏览次数:57  
标签:npm node app js 报错 front home vite

报错内容如下:

failed to load config from /home/app/git_repos/customer-visit-front/vite.config.js

error during build:
TypeError: (0 , import_vite_plugin_svg_icons.createSvgIconsPlugin) is not a function
at createSvgIcon (/home/app/git_repos/customer-visit-front/vite.config.js:54:64)
at createVitePlugins (/home/app/git_repos/customer-visit-front/vite.config.js:100:20)
at /home/app/git_repos/customer-visit-front/vite.config.js:111:14
at loadConfigFromFile (/home/app/git_repos/customer-visit-front/node_modules/vite/dist/node/chunks/dep-c9998dc6.js:61929:15)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async resolveConfig (/home/app/git_repos/customer-visit-front/node_modules/vite/dist/node/chunks/dep-c9998dc6.js:61450:28)
at async doBuild (/home/app/git_repos/customer-visit-front/node_modules/vite/dist/node/chunks/dep-c9998dc6.js:41564:20)
at async build (/home/app/git_repos/customer-visit-front/node_modules/vite/dist/node/chunks/dep-c9998dc6.js:41552:16)
at async CAC.<anonymous> (/home/app/git_repos/customer-visit-front/node_modules/vite/dist/node/cli.js:738:9)

本地运行并打包成功,在服务器上报错,打开package.json查看依赖的版本号:

 

 vite-plugin-svg-icons版本号被修改了,此版本过低导致报错。

原因是服务器上的npm没有装淘宝镜像。

解决:

安装淘宝npm(cnpm)

npm install -g cnpm --registry=https: //registry.npm.taobao.org

 

 

再重新安装依赖,成功啦~

标签:npm,node,app,js,报错,front,home,vite
From: https://www.cnblogs.com/yehx/p/17081436.html

相关文章