npm install @wepy/cli -g 报错的解决措施

npm install @wepy/cli -g 报错:

Error: EACCES: permission denied, access ‘/usr/lib/node_modules/@wepy/cli’

vagrant@homestead:~/Code/larabbs$ npm install @wepy/cli -g
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated request@2.88.0: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
npm WARN deprecated smartwrap@1.2.5: Backported compatibility to node > 6
npm WARN checkPermissions Missing write access to /usr/lib/node_modules/@wepy/cli
npm WARN checkPermissions Missing write access to /usr/lib/node_modules/@wepy/cli/node_modules
npm WARN checkPermissions Missing write access to /usr/lib/node_modules/@wepy
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/lib/node_modules/@wepy/cli
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/lib/node_modules/@wepy/cli'
npm ERR!  [Error: EACCES: permission denied, access '/usr/lib/node_modules/@wepy/cli'] {
npm ERR!   stack: "Error: EACCES: permission denied, access '/usr/lib/node_modules/@wepy/cli'",
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/lib/node_modules/@wepy/cli'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/vagrant/.npm/_logs/2020-07-20T09_04_17_257Z-debug.log

解决措施:

$ sudo npm install @wepy/cli -g –unsafe-perm=true –allow-root

vagrant@homestead:~/Code/larabbs$  sudo npm install @wepy/cli -g --unsafe-perm=true --allow-root
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated request@2.88.0: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
npm WARN deprecated smartwrap@1.2.5: Backported compatibility to node > 6
/usr/bin/wepy -> /usr/lib/node_modules/@wepy/cli/bin/wepy.js
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/@wepy/cli/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ @wepy/cli@2.1.0
updated 1 package in 36.674s
《L04 微信小程序从零到发布》
从小程序个人账户申请开始,带你一步步进行开发一个微信小程序,直到提交微信控制台上线发布。
《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!