先删除这些

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_13.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_13.x

2

xed ./nodejs_install.sh

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

  

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

加一行

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

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

形如

然后 保存退出

sudo bash  ./nodejs_install.sh

就可以 安装了

sudo apt-get install -y nodejs

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

  1. Make a directory for global installations:

     mkdir ~/.npm-global
  2. Configure npm to use the new directory path:

     npm config set prefix '~/.npm-global'
  3. xed ~/.profile
  4. Open or create a ~/.profile file and add this line:

     export PATH=~/.npm-global/bin:$PATH
  5. 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错误)

安装vscode https://code.visualstudio.com/docs/setup/linux

curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install code # or code-insiders

unbuntu安装Node.js的更多相关文章

  1. 在Linux Mint上安装node.js和npm

    1.安装Node.js 前端开发过程中,很多项目使用npm的http-server的模块来运行一个静态的服务器,我个人在Dell的笔记本上安装的是Linux Mint最新版本,所以想尝试一下在Linu ...

  2. ubuntu kylin 14.04安装Node.js和Famous

    默认使用软件中心安装node.js,然后参考https://famo.us/install进行安装 1.sudo apt-get install git 2.npm install -g yo gru ...

  3. centos 6.5安装node.js

    1.检查是否安装gcc编译器 rpm -q gcc rpm -q gcc-c++ 2.如果没有安装则通过以下代码安装gcc编译器 yum -y install gcc-c++ kernel-devel ...

  4. [译]How to Install Node.js on Ubuntu 14.04 如何在ubuntu14.04上安装node.js

    原文链接为 http://www.hostingadvice.com/how-to/install-nodejs-ubuntu-14-04/ 由作者Jacob Nicholson 发表于October ...

  5. Linux 安装node.js ---- 源码编译的方式

    一 : 普通用户: 安装前准备环境: 1.检查Linux 版本 命令: cat /etc/redhat-release 2.检查 gcc.gcc-c++ 是否安装过 命令: rpm -q gcc rp ...

  6. CentOS 6 中安装Node.js 4.0 版本或以上

    如果想在CentOS 6 中安装Node.js >4.0,如果通过以往的方式安装: wget http://nodejs.org/dist/v4.0.0/node-v4.0.0.tar.gz t ...

  7. Nodejs学习笔记(一)--- 简介及安装Node.js开发环境

    目录 学习资料 简介 安装Node.js npm简介 开发工具 Sublime Node.js开发环境配置 扩展:安装多版本管理器 学习资料 1.深入浅出Node.js http://www.info ...

  8. 1. windows环境安装Node.js

    1. 下载 地址: https://nodejs.org/en/ 2. 下载最新版本v6.1.0 Currrent

  9. 安装node.js+express for win7的Web开发环境配置

    1.安装 node.js. 进入官网的下载地址:http://www.nodejs.org/download/ . 选择Windows Installer或者选择Windows Installer ( ...

随机推荐

  1. Python3 离线安装TensorFlow包

    Python3 离线安装TensorFlow包 1,下载包 官网地址:https://pypi.org/project/tensorflow/1.1.0rc2/#files 清华镜像:https:// ...

  2. devexpress 10.0升级为 15

  3. windows2012R2标准版升级到数据中心版,不用重装系统

    windows2012R2标准版升级到数据中心版,不用重装系统 Windows Server 2012 R2是微软的服务器系统,是 Windows Server 2012 的升级版本. Windows ...

  4. oracle12c的日志查看

    查看GI日志:切换到grid用户 查看DB日志:切换到oracle的目录下 执行[oracle@swnode1 ~]$ adrci [oracle@swnode1 ~]$ adrci ADRCI: R ...

  5. PHP 重置数组为连续数字索引的几种方式

    原文链接:https://blog.csdn.net/zhang197093/article/details/78606916 推荐的方式  array_values 方法 这样方式无论对普通数组还是 ...

  6. topcoder srm 410 div1

    problem1 link 不包含$gridConnections$ 的联通块一定是连在所有包含$gridConnections$的联通块中最大的那一块上. import java.util.*; i ...

  7. Python 读写文件 中文乱码 错误TypeError: write() argument must be str, not bytes+

    今天写上传文件代码,如下 def uploadHandle(request): pic1=request.FILES['pic1'] picName=os.path.join(settings.MED ...

  8. 配置vim

    VundleVuldle是一个全自动的插件管理器,让我们通过维护插件列表的方式管理插件.它为安装.更新.删除插件提供了方便的命令.在安装Git的情况下(本文不赘述Git的安装),输入命令: git c ...

  9. 枚举+排序|神奇算式|2014年蓝桥杯A组题解析第三题-fishers

    标题:神奇算式 由4个不同的数字,组成的一个乘法算式,它们的乘积仍然由这4个数字组成. 比如: 210 x 6 = 1260 8 x 473 = 3784 27 x 81 = 2187 都符合要求. ...

  10. 记录一下 ajax的基础传送

    传数据 var json = $("#form").serializeObject(); $.ajax({ url: "/getUser", type: &qu ...