VUE组件库Vant,npm i vant -S失败和局部组件Unknown custom element错误

10 篇文章 0 订阅

Part1:npm i vant -S安装失败

官网:https://youzan.github.io/vant/#/zh-CN/quickstart
由于依赖环境使用的是cnpm install 所以更换成 cnpm i vant -S 即可!

npm i vant -S:

npm WARN checkPermissions Missing write access to F:\VUE\myproject\node_modules\cssnano\node_modules\autoprefixer
npm ERR! path F:\VUE\myproject\node_modules\csso\node_modules\source-map
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall access
npm ERR! enoent ENOENT: no such file or directory, access 'F:\VUE\myproject\node_modules\csso\node_modules\source-map'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

Part2:局部组件Unknown custom element错误

文档:https://youzan.github.io/vant/#/zh-CN/form
以Vant Form 表单为例,全局引用的时候没问题,局部的时候就报下面错误,这是由于表单里面还有van-field组件,所以需要把van-field也引入

[Vue warn]: Unknown custom element: <van-field> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
import { Form } from 'vant';
Vue.use(Form);
import 'vant/lib/form/style';

import { Field } from 'vant';
Vue.use(Field);
import 'vant/lib/field/style';
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值