使用 PowerShell 运行如下命令,在默认目录(C:\Users
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
# 或者简写
iwr -useb get.scoop.sh | iex
也可以在运行上面的安装命令之前,先运行如下命令,通过修改 SCOOP 环境变量,将 scoop 安装到自定义目录
$env:SCOOP='D:\Applications\Scoop'
[Environment]::SetEnvironmentVariable('SCOOP', $env:SCOOP, 'User')
# run the installer
还可以通过修改 SCOOP_GLOBAL 环境变量,将 scoop 安装为全局程序到自定义目录
$env:SCOOP_GLOBAL='F:\GlobalScoopApps'
[Environment]::SetEnvironmentVariable('SCOOP_GLOBAL', $env:SCOOP_GLOBAL, 'Machine')
# run the installer
安装时报错如下
使用“1”个参数调用“DownloadString”时发生异常:“未能解析此远程名称: 'raw.githubusercontent.com'”
所在位置 行:1 字符: 1
+ Invoke-Expression (New-Object System.Net.WebClient).DownloadString('h ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : WebException
处理方法
通过浏览器访问 https://get.scoop.sh,会自动跳转到 https://raw.githubusercontent.com/lukesampson/scoop/master/bin/install.ps1,而该跳转地址在本地无法访问
运行 ping 命令
ping raw.githubusercontent.com
Ping 请求找不到主机 raw.githubusercontent.com。请检查该名称,然后重试。
可以看到 DNS 无法解析域名,于是直接修改本地的 hosts 文件
151.101.108.133 raw.githubusercontent.com
再次运行 scoop 安装命令,则安装安装
PS C:\WINDOWS\system32> Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
Initializing...
Downloading scoop...
Extracting...
Creating shim...
Downloading main bucket...
Extracting...
Adding ~\scoop\shims to your path.
'lastupdate' has been set to '2020-09-27T14:53:53.4667896+08:00'
Scoop was installed successfully!
Type 'scoop help' for instructions.
nvm 即 Node Version Manager
运行 scoop install nvm
PS C:\WINDOWS\system32> scoop install nvm
Installing 'nvm' (1.1.7) [64bit]
nvm-noinstall.zip (2.3 MB) [==================================================================================] 100%
Checking hash of nvm-noinstall.zip ... ok.
Extracting nvm-noinstall.zip ... done.
Running pre-install script...
Linking ~\scoop\apps\nvm\current => ~\scoop\apps\nvm\1.1.7
Creating shim for 'nvm'.
Persisting nodejs
Persisting elevate.cmd
Persisting elevate.vbs
Persisting settings.txt
'nvm' (1.1.7) was installed successfully!
Notes
-----
You'll need to restart powershell/cmd to have it reload Environment Variables so nvm will work correctly
安装 node.js 并指定版本
PS C:\WINDOWS\system32> nvm install 12.14.1
Downloading node.js version 12.14.1 (64-bit)...
Complete
Creating C:\Users\haoqipeng\scoop\persist\nvm\nodejs\temp
Downloading npm version 6.13.4... Complete
Installing npm v6.13.4...
Installation complete. If you want to use this version, type
nvm use 12.14.1
PS C:\WINDOWS\system32> nvm use 12.14.1
Now using node v12.14.1 (64-bit)
还可以使用 nvm list available 查看所有可用版本
PS C:\WINDOWS\system32> nvm list available
| CURRENT | LTS | OLD STABLE | OLD UNSTABLE |
|--------------|--------------|--------------|--------------|
| 14.12.0 | 12.18.4 | 0.12.18 | 0.11.16 |
| 14.11.0 | 12.18.3 | 0.12.17 | 0.11.15 |
| 14.10.1 | 12.18.2 | 0.12.16 | 0.11.14 |
| 14.10.0 | 12.18.1 | 0.12.15 | 0.11.13 |
| 14.9.0 | 12.18.0 | 0.12.14 | 0.11.12 |
| 14.8.0 | 12.17.0 | 0.12.13 | 0.11.11 |
| 14.7.0 | 12.16.3 | 0.12.12 | 0.11.10 |
| 14.6.0 | 12.16.2 | 0.12.11 | 0.11.9 |
| 14.5.0 | 12.16.1 | 0.12.10 | 0.11.8 |
| 14.4.0 | 12.16.0 | 0.12.9 | 0.11.7 |
| 14.3.0 | 12.15.0 | 0.12.8 | 0.11.6 |
| 14.2.0 | 12.14.1 | 0.12.7 | 0.11.5 |
| 14.1.0 | 12.14.0 | 0.12.6 | 0.11.4 |
| 14.0.0 | 12.13.1 | 0.12.5 | 0.11.3 |
| 13.14.0 | 12.13.0 | 0.12.4 | 0.11.2 |
| 13.13.0 | 10.22.1 | 0.12.3 | 0.11.1 |
| 13.12.0 | 10.22.0 | 0.12.2 | 0.11.0 |
| 13.11.0 | 10.21.0 | 0.12.1 | 0.9.12 |
| 13.10.1 | 10.20.1 | 0.12.0 | 0.9.11 |
| 13.10.0 | 10.20.0 | 0.10.48 | 0.9.10 |
This is a partial list. For a complete list, visit https://nodejs.org/download/release
运行安装命令安装 yarn
PS C:\WINDOWS\system32> scoop install yarn
Installing 'yarn' (1.22.5) [64bit]
yarn-1.22.5.msi (1.6 MB) [====================================================================================] 100%
Checking hash of yarn-1.22.5.msi ... ok.
Extracting yarn-1.22.5.msi ... done.
Linking ~\scoop\apps\yarn\current => ~\scoop\apps\yarn\1.22.5
Persisting cache
Persisting global
Persisting mirror
Running post-install script...
yarn config v1.22.5
success Set "cache-folder" to "C:\\Users\\haoqipeng\\scoop\\apps\\yarn\\current\\cache".
Done in 0.09s.
yarn config v1.22.5
success Set "yarn-offline-mirror" to "C:\\Users\\haoqipeng\\scoop\\apps\\yarn\\current\\mirror".
Done in 0.08s.
yarn config v1.22.5
success Set "global-folder" to "C:\\Users\\haoqipeng\\scoop\\apps\\yarn\\current\\global".
Done in 0.11s.
yarn config v1.22.5
success Set "prefix" to "C:\\Users\\haoqipeng\\scoop\\apps\\yarn\\current\\global".
Done in 0.10s.
'yarn' (1.22.5) was installed successfully!
安装过程中有下载请求,等了大半天才完成(3161.746s)
PS C:\WINDOWS\system32> npm --add-python-to-path install --global --production windows-build-tools
--- 以下是最后的日志输出 ---
---------- Visual Studio Build Tools ----------
Successfully installed Visual Studio Build Tools.
------------------- Python --------------------
Successfully installed Python 2.7
Now configuring the Visual Studio Build Tools and Python...
All done!
+ [email protected]
added 144 packages from 99 contributors in 3161.746s
git clone https://github.com/eclipse-theia/theia.git && cd theia && yarn && yarn --cwd examples\browser start
如果你的系统上没有安装 Git Bash,先安装 Git Bash,可以选择使用 scoop 安装:scoop install git 。
不知道是不是国内支持的还不太好,安装过程中坑太多了,git 之后,走到 执行 yarn 命令,死活是进行不下去了,等等看后面有没有更新还完善吧