美文网首页
安装taro遇到的问题

安装taro遇到的问题

作者: NanNan | 来源:发表于2021-09-24 13:08 被阅读0次

    1、本次使用npm安装taro,首先安装node,因为Taro 项目基于 node(>=8.0.0),推荐使用 node 版本管理工具 nvm 来管理 node,这样可以很方便地切换 node 版本,而且全局安装时候也不用加 sudo

    2、node安装成功后,使用

    # 使用 npm 安装 CLI
    $ npm install -g @tarojs/cli
    

    ⚠️注意:报错

    npm ERR! code EACCES
    npm ERR! syscall access
    npm ERR! path /usr/local/lib/node_modules
    npm ERR! errno -13
    npm ERR! Error: EACCES: permission deni
    ed, access '/usr/local/lib/node_modules'
    npm ERR!  [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] {
    npm ERR!   errno: -13,
    npm ERR!   code: 'EACCES',
    npm ERR!   syscall: 'access',
    npm ERR!   path: '/usr/local/lib/node_modules'
    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!     /Users/lx/.npm/_logs/2021-09-23T01_39_18_477Z-debug.log
    
    原因:不是按照管理员身份运行,请求被拒绝
    解决办法:使用sudo命令:
    sudo npm install -g @tarojs/cli
    

    结果可以顺利安装。

    2、遇到的问题2
    使用npm 安装yarn 不成功;

    如果你已经安装了 Node,请检查其版本是否在 v12 以上。安装完 Node 后建议设置 npm 镜像(淘宝源)以加速后面的过程(或使用科学上网工具)。

    # 使用nrm工具切换淘宝源
    (sudo) npx nrm use taobao
    
    # 如果之后需要切换回官方源可使用
    npx nrm use npm
    

    相关文章

      网友评论

          本文标题:安装taro遇到的问题

          本文链接:https://www.haomeiwen.com/subject/lcingltx.html