zoukankan      html  css  js  c++  java
  • Manjaro配置nodejs环境

    参考

    https://blog.csdn.net/wsxwang/article/details/104706220

    环境

    1. manjaro 19.0 xfce版

    2. openjdk 1.8.0_241

    3. VsCode 1.42.1


    #nodejs安装
    sudo pacman -S nodejs
    #npm安装
    sudo pacman -S npm
    #设置npm源
    npm config set registry https://registry.npm.taobao.org
    #查看源是否更改成功
    npm config get registry

    nodejs设置

       vscode安装vetur插件。


     

    如果提示源有问题,可以更新

    sudo pacman-mirrors -i -c China -m rank
    sudo pacman-mirrors -g
    sudo pacman -Sy #仅同步源
    sudo pacman -S archlinuxcn-keyring
    sudo pacman -S antergos-keyring

    安装vue环境报错解决办法

    npm install -g vue
    

      报错如下:

    [xxx@manjaro ~]$ npm install vue -g
    npm WARN checkPermissions Missing write access to /usr/lib/node_modules
    npm ERR! code EACCES
    npm ERR! syscall access
    npm ERR! path /usr/lib/node_modules
    npm ERR! errno -13
    npm ERR! Error: EACCES: permission denied, access '/usr/lib/node_modules'
    npm ERR!  [Error: EACCES: permission denied, access '/usr/lib/node_modules'] {
    npm ERR!   errno: -13,
    npm ERR!   code: 'EACCES',
    npm ERR!   syscall: 'access',
    npm ERR!   path: '/usr/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!     /home/xxx/.npm/_logs/2021-01-16T18_24_19_878Z-debug.log
    

      解决办法

    2.改变npm默认的路径。
    步骤如下:
    进入终端,依次输入一下命令
    (1)创建global安装任务的目录
    mkdir ~/.npm-global
    (2)配置npm使用新的目录
    npm config set prefix '~/.npm-global'3)在~/.profile文件中增加配置
    export PATH=~/.npm-global/bin:$PATH
    (4)配置文件立即生效
    # source ~/.profile
    source ./.bash_profile #manjaro使用此命令 (
    5)重新执行命令 npm install -g xxxx
  • 相关阅读:
    Node_JS
    读JS高级——第五章-引用类型 _记录
    读JS高级(兼容&&BOM&&私有变量&&面向对象)
    JS高级设计第七章——复习知识点
    nodeJs抓取网页
    表单脚本api_contenteditable
    泛——复习js高级第三版
    nodeJS
    Eclipse布局问题小记
    再议负载均衡算法
  • 原文地址:https://www.cnblogs.com/kgtone/p/14288117.html
Copyright © 2011-2022 走看看