npm无法全局安装本地包的解决方法

今天想动手写一个脚手架工具,本地安装的时候遇到了一点问题

npm install -g my-cli

但是这样安装会报错

$ npm install -g xcx-cli
npm WARN notice Due to a recent security incident, all user tokens have been invalidated. Please see https://status.npmjs.org/incidents/dn7c1fgrr7ng for more details. To generate a new token, visit https://www.npmjs.com/settings/~/tokens or run "npm login".
npm ERR! code E404
npm ERR! 404 Not Found: xcx-cli@latest

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2018-07-23T01_02_21_506Z-debug.log

上面当做是线上包来处理了,所以我们需要离线安装或者使用npx安装(需要注意一下的是npx安装是最方便快捷的)

小技巧:如果你安装的 npm 是 5.2 或更高版本,可以使用 npx 运行全局安装的包

 

猜你喜欢

转载自blog.csdn.net/qq_25842063/article/details/81161909
今日推荐