node.md

简书迁移

Posted by thrfox on June 29, 2020

Centos7 安装nodejs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#1.下载node.js
#V12.x:
curl -sL https://rpm.nodesource.com/setup_12.x | bash -
#V10.x:
curl -sL https://rpm.nodesource.com/setup_10.x | bash -
#V8.x: 
curl --silent --location https://rpm.nodesource.com/setup_8.x | bash -
#V7.x:
curl --silent --location https://rpm.nodesource.com/setup_7.x | bash -
#V6.x:
curl --silent --location https://rpm.nodesource.com/setup_6.x | bash -
#V5.x:
curl --silent --location https://rpm.nodesource.com/setup_5.x | bash -
#2.yum安装node.js
sudo yum install -y nodejs

依赖

1
2
3
4
5
6
7
npm config set registry https://registry.npm.taobao.org --global
npm config set disturl https://npm.taobao.org/dist --global
npm config set sass-binary-site https://npm.taobao.org/mirrors/node-sass
npm install -g yarn
yarn config set registry https://registry.npm.taobao.org --global
yarn config set disturl https://npm.taobao.org/dist --global
yarn config set sass_binary_site http://cdn.npm.taobao.org/dist/node-sass -g

nodemon指令

https://www.cnblogs.com/JuFoFu/p/5140302.html

deb清华镜像

sudo vi /etc/apt/sources.list

1
2
3
4
5
6
7
8
9
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse

windows sub ubuntu安装nodejs

1
2
3
4
5
6
7
8
9
10
11
12
13
sudo apt-get update
sudo apt-get --purge remove node
("sudo apt autoremove node" if console is asking for)
sudo apt-get --purge remove nodejs

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

sudo apt-get install -y build-essential
npm install serialport

### yarn 设置config 

1.改变 yarn 全局安装位置

yarn config set global-folder “你的磁盘路径”

2.然后你会在你的用户目录找到 .yarnrc 的文件,打开它,找到 global-folder ,改为 --global-folder

#这里是我的路径

yarn config set global-folder “D:\Software\yarn\global”

2. 改变 yarn 缓存位置

yarn config set cache-folder “你的磁盘路径”

#这里是我的路径

yarn config set cache-folder “D:\Software\yarn\cache”

1
2
### yarn global add @vue/cli 报错 [yarn安装vue后,报“文件名、目录名或卷标语法不正确。”]

@”%~dp0\C:\Users\mzqth\AppData\Local\Yarn\Data\global\node_modules.bin\vue.cmd” %* 改成 @”C:\Users\mzqth\AppData\Local\Yarn\Data\global\node_modules.bin\vue.cmd” %* ```