npm使用常见问题
npm
npm ERR! syscall rename
重命名,一般是因为npm缓存导致的
npm ERR! code EPERM
npm ERR! syscall rename
npm ERR! path e:\work\work-temp\node_modules\echarts5
npm ERR! dest e:\work\work-temp\node_modules\.echarts5.DELETE
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, rename 'xxxx' -> 'xxxx.DELETE'
- 方案一:重新执行npm install ,可能在运行时会报错
- 方案二:把node_modules删除,重新npm install
cmd命令行删除命令:rmdir /s/q node_modules - 方案三:npm cache clean --force清除缓存,重新npm install
npm ERR! code E401
npm ERR! Unable to authenticate, need: BASIC realm=“Sonatype Nexus Repository Manager”
nexus发布私包,没有认证信息
exp1:
npm login --registry=http://nexus-xg.paas.newcapec.cn/repository/npm-hosted
登录成功,但是报错
Unable to authenticate, need: BASIC realm="Sonatype Nexus Repository Manager"
需要在地址后边加上‘/’
npm login --registry=http://nexus-xg.paas.newcapec.cn/repository/npm-hosted/
WARN tar ENOENT: no such file or directory, open '/xxx/node_modules/.staging/xxx
npm WARN tar ENOENT: no such file or directory, open '/ui-project/node_modules/.staging/eslint-plugin-vue-a2c535fc/lib/configs/essential.js'
npm WARN tar ENOENT: no such file or directory, open '/ui-project/node_modules/.staging/better-scroll-2bffe172/dist/bscroll.min.js'
...
found xxx vulnerabilities
发现安装包有漏洞,可以根据提示更新或查看漏洞
found 7 vulnerabilities (6 moderate, 1 high)
run `npm audit fix` to fix them, or `npm audit` for details