uses: actions/setup-node
(Redirected from Actions/setup-node)
Jump to navigation
Jump to search
https://github.com/actions/setup-node
- Optionally downloading and caching distribution of the requested Node.js version, and adding it to the
PATH - Optionally caching npm/yarn/pnpm dependencies
- Registering problem matchers for error output
- Configuring authentication for GPR or npm
actions/setup-node@v4 actions/setup[email protected]
Run actions/setup-node@v3 Found in cache @ /opt/hostedtoolcache/node/14.21.3/x64 Environment details node: v14.21.3 npm: 6.14.18 yarn: 1.22.19 /opt/hostedtoolcache/node/14.21.3/x64/bin/npm config get cache /home/runner/.npm npm cache is not found
Official example[edit]
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs name: Node.js CI on: push: branches: [ "main" ] pull_request: branches: [ "main" ] jobs: build: runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build --if-present
- run: npm test
Related[edit]
- yarn
- Error: Cache folder path is retrieved for npm but doesn't exist on disk: /home/runner/.npm
- Error: Dependencies lock file is not found in
uses: actions/setup-go
See also[edit]
npm,npx,npm [ init|audit|install|link | config | token|start | publish | run start|update | rebuild|ci|run build].env/,list|ls | --version,package.json,$HOME/.npmrc,npm help, NPM Registry, npm ERR!,package-lock.jsonuses:, docker/, 1password/, actions/, aws-actions/- Node.js,
FROM node,node (command)node inspect,nvm,wait-on,node -v,node --help,brew install node.js,node-config
Advertising: