Setup Node.js environment on macOS
Setup Node.js environment on macOS
First install Homebrew.
Then install fnm.
brew install fnm
Install a specific version of Node.js.
fnm install 22
Then install pnpm.
brew install pnpm
pnpm setup
Install packages globally
pnpm -g install neovim
pnpm -g install appium
# list the packages
pnpm -g list --dept=0
If wanna to use the appium.webdriver.appium_service.AppiumService
to start the appium
automatically, you should install the appium
with npm
globally.
npm -g install appium
Check the versions
alias nodeversions="echo node: $(node -v); echo corepack: $(corepack -v); echo npm: $(npm -v); echo fnm: $(fnm --version); echo pnpm: $(pnpm -v)"
nodeversions
OR
pnpm version
Create a project
Created a playwright project
cd ~/ws/github/demos/playwright-demos/
mkdir nodejs
cd nodejs
pnpm create playwright
Run test in the project
pnpm exec playwright test
Open the test report
pnpm exec playwright show-report