• mint安装Node.js


    先删除这些

    rm -rf ~/.npm

    rm -rf ~/.npm-global

    rm -rf ~/.npmrc
    rm -rf ~/.node-gyp

    https://github.com/nodesource/distributions/blob/master/README.md#debinstall

    安装

    curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
    sudo apt-get install -y nodejs

     npm uninstall -g @angular/cli

    npm cache clean --force

     sudo apt remove nodejs

     如果新安装的mint新版本,比如19.2 19.3... node会提示操作系统不支持

    形如:

    ,那么参考https://github.com/nodesource/distributions/issues/881

    1 下载nodejs_install.sh

    wget -O nodejs_install.sh  https://deb.nodesource.com/setup_14.x

    2

    xed ./nodejs_install.sh 

    在文件靠后的地方,找到mint

      

    check_alt "Linux Mint"    "tara"     "Ubuntu" "bionic"
    check_alt "Linux Mint"    "tessa"    "Ubuntu" "bionic"

    加一行

    mint19:

    check_alt "Linux Mint"    "tricia"     "Ubuntu" "bionic"

    mint20:

    check_alt "Linux Mint"    "ulyana"   "Ubuntu" "focal"

    形如

    然后 保存退出

    sudo bash  ./nodejs_install.sh

    就可以 安装了

    sudo apt-get install -y nodejs

    参考这个修改npm路径,以便用-g安装包的时候不报错

    Make a directory for global installations:

     mkdir ~/.npm-global

    Configure npm to use the new directory path:

     npm config set prefix '~/.npm-global'

    Open or create a ~/.profile file

    xed ~/.profile

    and add this line:

     export PATH=~/.npm-global/bin:$PATH

    Back on the command line, update your system variables:

     source ~/.profile

    添加 PATH="$HOME/.npm-global/bin:$PATH"

    再安装angular就不用sudo了 

    先确认安装了

    sudo apt install build-essential

    如果不行,就

    sudo -i
    aptitude install g++

    否则sass编译不过,提示没有g++

    npm install -g -f @angular/cli
    

    应对被墙, 装nrm

    npm i nrm -g

    然后用

    nrm ls 列出代理

    nrm use XXX 切换代理

    安装phantomjs

    sudo apt-get install phantomjs

    安装typescript 

    npm i -g typescript

     查看版本 

    ng --version

    看见Angular: ...应该是安装正确的.

    否则会看见error (8.x的node如果没卸载干净安装9  会提示 ts错误)

    —————————————
  • 相关阅读:
    NHibernate介绍
    dwr配置文件dwr.xml详解
    架构设计师与SOA
    SOA是什么
    JDK常用命令
    在WPF的WebBrowser控件中抑制脚本错误
    通过编程计算一个游戏的胜率
    在C#中模拟大数乘法
    解决HttpWebRequest首次连接特别慢的问题
    布隆过滤器(Bloom Filter)
  • 原文地址:https://www.cnblogs.com/xuanmanstein/p/7595462.html
Copyright © 2020-2023  润新知