安装
cnpm i lodash -S
引用

import _ from 'lodash';
Vue.prototype._ = _;
使用


出现的报错:
1.

PS C:\Users\EDZ\Desktop\vue_sly\exercise\slytestpro> npm i lodash -S
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ lodash@4.17.11
updated 1 package and audited 30458 packages in 10.514s
found 8 vulnerabilities (1 low, 1 moderate, 5 high, 1 critical)
run `npm audit fix` to fix them, or `npm audit` for details
这个出现的原因我百度了下 大概的意思是可以忽略它。但是你真的运行不起来lodash啊!而且就是装不进去呀!!! 于是 我运行了它建议的npm audit fix 发现... 没卵用!真的!相信我!
这个问题 可以参考这个blog哦~ https://cloud.tencent.com/developer/ask/150215
2.

× Install fail! Error: EPERM: operation not permitted, symlink 'C:\Users\EDZ\Desktop\vue_sly\exercise\slytestpro\node_modules\_lodash@4.17.11@lodash' -> 'C:\Users\EDZ\Desktop\vue_sly\exercise\slytestpro\node_modules\lodash'
Error: EPERM: operation not permitted, symlink 'C:\Users\EDZ\Desktop\vue_sly\exercise\slytestpro\node_modules\_lodash@4.17.11@lodash' -> 'C:\Users\EDZ\Desktop\vue_sly\exercise\slytestpro\node_modules\lodash'
npminstall version: 3.16.0
npminstall args: C:\Program Files\nodejs\node.exe C:\Users\EDZ\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\bin\install.js --fix-bug-versions --china --userconfig=C:\Users\EDZ\.cnpmrc --disturl=https://npm.taobao.org/mirrors/node --registry=https://registry.npm.taobao.org lodash -s
因为报错一不死心的我转而去试了试cnpm i lodash -s 燃鹅 也报了错。
经过实验我们还是用git bash 吧!
网友评论