Skip to content

Instantly share code, notes, and snippets.

@krayfaus
Last active May 3, 2021 00:16
Show Gist options
  • Save krayfaus/2a68fbc7386d3cdbcb45c577b1d4bae8 to your computer and use it in GitHub Desktop.
Save krayfaus/2a68fbc7386d3cdbcb45c577b1d4bae8 to your computer and use it in GitHub Desktop.
Using Chocolatey to Install Node.js and Yarn

Install Chocolatey

# Allow Execution of Foreign Scripts
> Set-ExecutionPolicy Bypass -Scope Process -Force;

# Use TLS 1.2
> [System.Net.ServicePointManager]::SecurityProtocol = 3072;

# Download and Execute Chocolatey's Install Script
> iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'));

# Disable Chocolatey's Confirmation Prompt
> choco feature enable -n allowGlobalConfirmation

Install Node.js and Yarn

# Install Node
> sudo choco install nodejs

# Install Yarn
> sudo choco install yarn

# Disable Yarn Telemetry on your Machine
> yarn config set --home enableTelemetry 0

Create Yarn 2 Project

# Init package.json File
> yarn init -y

# Use yarn 2 (aka Berry)
> yarn set version berry

Import Plugins

# Automatically adds @types packages
> yarn plugin import typescript
 
# Adds various interactive commands
> yarn plugin import interactive-tools
 
# Adds workspace-related commands
> yarn plugin import workspace-tools

Pnpify VSCode

# Make sure typescript is a root workspace dependency.
yarn add --dev typescript

# Setup workspace/environment.
> yarn dlx @yarnpkg/pnpify --sdk vscode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment