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
  • 相关阅读:
    凸包学习笔记
    2019ICPC南昌网络赛总结
    结对编程作业
    实验 6 :OpenDaylight 实验 ——OpenDaylight 及 Postman 实现流表下发
    实验 5:OpenFlow 协议分析和 OpenDaylight 安装
    实验 3:Mininet 实验——测量路径的损耗率
    实验 4 : Open vSwitch 实验——Mininet 中使用 OVS 命令
    第一次个人编程作业
    实验 2 :Mininet 实验 —— 拓扑的命令脚本生成
    实验 1 :Mininet 源码安装和可视化拓扑
  • 原文地址:https://www.cnblogs.com/kgtone/p/14288117.html
Copyright © 2011-2022 走看看