Skip to content

Commit 55e0896

Browse files
committed
feature: nodejs environment.
1 parent 2831e1b commit 55e0896

File tree

3 files changed

+72
-0
lines changed

3 files changed

+72
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,9 @@
1212

1313
[打包并发布包到 PyPI](python/build-and-publish-package-to-pypi.md)
1414

15+
## JavaScript
16+
17+
[在 Ubuntu 上通过 PPA 安装 NodeJS](js/install-nodejs-through-ppa-on-ubuntu.md)
18+
19+
20+
[NPM 配置中国源](js/npm-china-source.md)
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# 在 Ubuntu 上通过 PPA 安装 NodeJS
2+
3+
## 问题来源
4+
5+
1. 通过 `apt-get` 所安装的软件包
6+
7+
## 植入 PPA 源
8+
9+
```bash
10+
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
11+
```
12+
13+
注意:您可以更改上面 URL 部分的版本号来植入您需要的 NodeJS 版本的 PPA。
14+
15+
## 安装 NodeJS
16+
17+
```bash
18+
sudo apt install nodejs
19+
```
20+
21+
安装完成
22+
23+
注意:NodeJS 的部分功能需要您有编译环境,请使用下面的命令在公库安装。
24+
25+
```bash
26+
sudo apt-get install gcc g++ make
27+
```
28+
29+
## 安装 Yarn
30+
31+
```bash
32+
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null
33+
34+
echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
35+
36+
sudo apt-get update && sudo apt-get install yarn
37+
```
38+
39+
## NPM 配置中国源
40+
41+
[链接](./npm-china-srouce.md)
42+
43+
## NPM 自升级
44+
45+
```bash
46+
npm install -g npm@latest
47+
```

js/npm-china-source.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# NPM 配置中国源
2+
3+
## 查看 npm 源
4+
5+
```bash
6+
npm config get registry
7+
```
8+
9+
## 设置 npm 源
10+
11+
```bash
12+
npm config set registry https://registry.npmmirror.com
13+
```
14+
15+
## 安装 cnpm(可选)
16+
17+
```bash
18+
npm install -g cnpm --registry=https://registry.npmmirror.com
19+
```

0 commit comments

Comments
 (0)