Giter Club home page Giter Club logo

setup-node's Introduction

setup-node

basic-validation versions e2e-cache proxy

This action provides the following functionality for GitHub Actions users:

  • 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

Usage

See action.yml

- uses: actions/setup-node@v4
  with:
    # Version Spec of the version to use in SemVer notation.
    # It also emits such aliases as lts, latest, nightly and canary builds
    # Examples: 12.x, 10.15.1, >=10.15.0, lts/Hydrogen, 16-nightly, latest, node
    node-version: ''

    # File containing the version Spec of the version to use.  Examples: package.json, .nvmrc, .node-version, .tool-versions.
    # If node-version and node-version-file are both provided the action will use version from node-version. 
    node-version-file: ''

    # Set this option if you want the action to check for the latest available version 
    # that satisfies the version spec.
    # It will only get affect for lts Nodejs versions (12.x, >=10.15.0, lts/Hydrogen). 
    # Default: false
    check-latest: false

    # Target architecture for Node to use. Examples: x86, x64. Will use system architecture by default.
    # Default: ''. The action use system architecture by default 
    architecture: ''

    # Used to pull node distributions from https://github.com/actions/node-versions. 
    # Since there's a default, this is typically not supplied by the user. 
    # When running this action on github.com, the default value is sufficient. 
    # When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting.
    #
    # We recommend using a service account with the least permissions necessary. Also
    # when generating a new PAT, select the least scopes necessary.
    #
    # [Learn more about creating and using encrypted secrets](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets)
    #
    # Default: ${{ github.server_url == 'https://github.com' && github.token || '' }}
    token: ''

    # Used to specify a package manager for caching in the default directory. Supported values: npm, yarn, pnpm.
    # Package manager should be pre-installed
    # Default: ''
    cache: ''

    # Used to specify the path to a dependency file: package-lock.json, yarn.lock, etc. 
    # It will generate hash from the target file for primary key. It works only If cache is specified.  
    # Supports wildcards or a list of file names for caching multiple dependencies.
    # Default: ''
    cache-dependency-path: ''

    # Optional registry to set up for auth. Will set the registry in a project level .npmrc and .yarnrc file, 
    # and set up auth to read in from env.NODE_AUTH_TOKEN.
    # Default: ''
    registry-url: ''

    # Optional scope for authenticating against scoped registries. 
    # Will fall back to the repository owner when using the GitHub Packages registry (https://npm.pkg.github.com/).
    # Default: ''
    scope: ''

    # Set always-auth option in npmrc file.
    # Default: ''
    always-auth: ''

Basic:

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
  with:
    node-version: 18
- run: npm ci
- run: npm test

The node-version input is optional. If not supplied, the node version from PATH will be used. However, it is recommended to always specify Node.js version and don't rely on the system one.

The action will first check the local cache for a semver match. If unable to find a specific version in the cache, the action will attempt to download a version of Node.js. It will pull LTS versions from node-versions releases and on miss or failure will fall back to the previous behavior of downloading directly from node dist.

For information regarding locally cached versions of Node.js on GitHub hosted runners, check out GitHub Actions Runner Images.

Supported version syntax

The node-version input supports the Semantic Versioning Specification, for more detailed examples please refer to the semver package documentation.

Examples:

  • Major versions: 18, 20
  • More specific versions: 10.15, 16.15.1 , 18.4.0
  • NVM LTS syntax: lts/erbium, lts/fermium, lts/*, lts/-n
  • Latest release: * or latest/current/node

Note: Like the other values, * will get the latest locally-cached Node.js version, or the latest version from actions/node-versions, depending on the check-latest input.

current/latest/node always resolve to the latest dist version. That version is then downloaded from actions/node-versions if possible, or directly from Node.js if not. Since it will not be cached always, there is possibility of hitting rate limit when downloading from dist

Checking in lockfiles

It's always recommended to commit the lockfile of your package manager for security and performance reasons. For more information consult the "Working with lockfiles" section of the Advanced usage guide.

Caching global packages data

The action has a built-in functionality for caching and restoring dependencies. It uses actions/cache under the hood for caching global packages data but requires less configuration settings. Supported package managers are npm, yarn, pnpm (v6.10+). The cache input is optional, and caching is turned off by default.

The action defaults to search for the dependency file (package-lock.json, npm-shrinkwrap.json or yarn.lock) in the repository root, and uses its hash as a part of the cache key. Use cache-dependency-path for cases when multiple dependency files are used, or they are located in different subdirectories.

Note: The action does not cache node_modules

See the examples of using cache for yarn/pnpm and cache-dependency-path input in the Advanced usage guide.

Caching npm dependencies:

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
  with:
    node-version: 20
    cache: 'npm'
- run: npm ci
- run: npm test

Caching npm dependencies in monorepos:

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
  with:
    node-version: 20
    cache: 'npm'
    cache-dependency-path: subdir/package-lock.json
- run: npm ci
- run: npm test

Matrix Testing

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node: [ 14, 16, 18 ]
    name: Node ${{ matrix.node }} sample
    steps:
      - uses: actions/checkout@v4
      - name: Setup node
        uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node }}
      - run: npm ci
      - run: npm test

Using setup-node on GHES

setup-node comes pre-installed on the appliance with GHES if Actions is enabled. When dynamically downloading Nodejs distributions, setup-node downloads distributions from actions/node-versions on github.com (outside of the appliance). These calls to actions/node-versions are made via unauthenticated requests, which are limited to 60 requests per hour per IP. If more requests are made within the time frame, then you will start to see rate-limit errors during downloading that looks like: ##[error]API rate limit exceeded for.... After that error the action will try to download versions directly from the official site, but it also can have rate limit so it's better to put token.

To get a higher rate limit, you can generate a personal access token on github.com and pass it as the token input for the action:

uses: actions/setup-node@v4
with:
  token: ${{ secrets.GH_DOTCOM_TOKEN }}
  node-version: 20

If the runner is not able to access github.com, any Nodejs versions requested during a workflow run must come from the runner's tool cache. See "Setting up the tool cache on self-hosted runners without internet access" for more information.

Advanced usage

License

The scripts and documentation in this project are released under the MIT License

Contributions

Contributions are welcome! See Contributor's Guide

Code of Conduct

👋 Be nice. See our code of conduct

setup-node's People

Contributors

alenasviridenko avatar aminya avatar brcrista avatar bryanmacfarlane avatar chrispat avatar dependabot[bot] avatar dmitry-shibanov avatar dsame avatar e-korolevskii avatar ericsciple avatar github-actions[bot] avatar gordey4doronin avatar ivanzosimov avatar jablko avatar jacobwgillespie avatar jamesmgreene avatar jamesottaway avatar jef avatar joshmgross avatar jwalton avatar magnetikonline avatar maksimzhukov avatar marko-zivic-93 avatar maxim-lobanov avatar nikolai-laevskii avatar nschonni avatar panticmilos avatar panva avatar thboop avatar zodman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

setup-node's Issues

with:-parameters not taken in account?

Excuse me, I am pretty much of a newbie but do not understand why my job does not use the parameters I supply.

I want to publish to gpr, but it does not use the supplied registry url:

name: npm Package
on: [push]

jobs:
  publish-gpr:
    runs-on: ubuntu-16.04
    steps:
    - uses: actions/checkout@v1
    - uses: actions/setup-node@v1
      with:
        registry-url: https://npm.pkg.github.com/
        scope: '@ramp106'
    - run: npm publish
      env:
        NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

Error:

...
npm ERR! 401 Unauthorized - PUT https://registry.npmjs.org/vue-components - You must be logged in to publish packages.

I literally used the example action and it does not run?

How to turn off problem matcher?

Hi, I want to disable problem matcher like eslint-stylish.json.

console.log(`##[add-matcher]${path.join(matchersPath, 'tsc.json')}`);
console.log(
`##[add-matcher]${path.join(matchersPath, 'eslint-stylish.json')}`
);
console.log(
`##[add-matcher]${path.join(matchersPath, 'eslint-compact.json')}`
);

Because, I've created textlint that is similar with ESLint and It support same format with eslint-stylish.

I've noticed that output formatted log in GitHub Actions, problem matcher report it as error.
But, It is just console log for testing and it is not actual error.

image

https://github.com/textlint/textlint/runs/267131582

Is there any chance setup-node provide an option to disable problem matcher?

Related

Add documentation for GET of private NPM packages

Getting a 404 error when trying to fetch a private NPM package. The NPM_TOKEN is included and used as a secret. Locally I also have this problem sometimes but the issue is resolved by doing a npm login.

workflow:

name: Node CI

on: [push]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@master
    - name: Use Node.js v10.x
      uses: actions/setup-node@v1
      with:
        version: 10.x
    - name: npm install, build, and test
      env:
        NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
      run: |
        npm install
        npm run build --if-present
        npm test

TSC problem matcher doesn't handle line & column in errors

I have a build at xt0rted/slash-command-action#71 that's failing and the typescript problem matcher is picking up the error, but it's not associating the annotation with the correct line as seen here. This looks to be due to line value also containing the column (107,11).

This can be seen using https://regex101.com/ with the values:

^(?:\s+\d+\>)?([^\s].*)\((\d+|\d+,\d+|\d+,\d+,\d+,\d+)\)\s*:\s+(error|warning|info)\s+(\w{1,2}\d+)\s*:\s*(.*)$
src/commandHandler.ts(107,11): error TS2322: Type 'Response<ReposGetCollaboratorPermissionLevelResponse>' is not assignable to type 'Response<CollaboratorPermissionLevel>'.

Example correction

The example suggests that you can use name: Use Node.js ${{ matrix.node }} but that does not work and gets turned into ${{ format('Use Node.js {0}', matrix.node) }} by GitHub

npm auth doesn't work with .npmrc placed in repo

How to use the ESLint annotations?

It's my first time using the annotations feature, so please forgive me if this issue is irrelevant.

I'm trying to have annotations in the PR, however all I can get is a simple annotation in the actions screen with irrelevant information. I'm guessing that's a problem of mine, and since there's not a lot documentation (that I could find) about this might as well ask.

Screenshot 2019-12-18 at 09 39 49

That's the output of a failing eslint job. The current configuration is:

  quality:
    needs: [build]

    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v1

      - uses: actions/setup-node@v1
        with:
          node-version: "12.x"

      - name: Cache node modules
        id: cache
        uses: actions/cache@v1
        with:
          path: node_modules # npm cache files are stored in `~/.npm` on Linux/macOS
          key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
          restore-keys: |
            ${{ runner.os }}-build-${{ env.cache-name }}-
            ${{ runner.os }}-build-
            ${{ runner.os }}-

      - name: Install Dependencies
        if: steps.cache.outputs.cache-hit != 'true'
        run: npm ci

      - name: Prettier
        run: npm run fmt:check

      - name: ESlint
        run: npm run eslint:github-action

where my package.json looks like:

  "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^2.12.0",
    "@typescript-eslint/parser": "^2.12.0",
    "eslint": "^6.7.2",
    "eslint-config-prettier": "^6.7.0",
    "prettier": "^1.19.1",
    "serverless-dynamodb-local": "^0.2.38",
    "serverless-offline": "^5.12.1",
    "serverless-plugin-typescript": "^1.1.9",
    "typescript": "^3.7.3"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "lint": "eslint functions/**.ts",
    "eslint:github-action": "eslint functions/**",
    "fmt": "prettier --write ./**.{json,js,ts,yml,md}",
    "fmt:check": "prettier --check ./**.{json,js,ts,yml,md}"
  },

I expected that the following error would actually appear in the annotation, and hopefully in the PR too.

 /home/runner/work/utom.is/utom.is/functions/a.ts
  1:0  error  Parsing error: Declaration or statement expected

but as you can get the from screenshot, all I have is that the process completed with error 1.

Is my expectation wrong? Or do I have something misconfigured?

Thanks

Unable to publish to GitHub Package Registry

I use the workflow you suggest, but the npm publish action on GitHub Package Registry doesn't work. On npmjs it works.

Workflow

name: publish

on: release

jobs:
  test:
    name: Test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - uses: actions/setup-node@v1
        with:
          node-version: 12
      - run: npm ci
      - run: npm test

  # works
  publish-npm:
    name: Publish NPM
    needs: test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - uses: actions/setup-node@v1
        with:
          node-version: 12
          registry-url: https://registry.npmjs.org/
      - run: npm publish
        env:
          NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

  # doesn't work: tries to publish on https://registry.npmjs.org
  publish-gpr:
    name: Publish GitHub Packages
    needs: test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - uses: actions/setup-node@v1
        with:
          registry-url: 'https://npm.pkg.github.com'
      - run: npm publish
        env:
          NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

npm publish on npmjs works. On gpr doesn't. Follows the GitHub Action output of the publish-gpr job.

Run actions/setup-node@v1
   with:
    registry-url: https://npm.pkg.github.com
    node-version: 10.x
in/tar xzC /home/runner/work/_temp/bc5bc42b-b229-41ac-b8a0-e554467f0c90 -f /home/runner/work/_temp/5cda4e3f-6051-4aaa-b41f-c4761c6cac12
##[add-path]/opt/hostedtoolcache/node/10.16.3/x64/bin
##[set-env name=NPM_CONFIG_USERCONFIG;]/home/runner/work/_temp/.npmrc
##[set-env name=NODE_AUTH_TOKEN;]XXXXX-XXXXX-XXXXX-XXXXX
Added matchers: 'tsc'. Problem matchers scan action output for known warning or error strings and report these inline.
##[add-matcher]/home/runner/work/_actions/actions/setup-node/v1/.github/tsc.json
Added matchers: 'eslint-stylish'. Problem matchers scan action output for known warning or error strings and report these inline.
##[add-matcher]/home/runner/work/_actions/actions/setup-node/v1/.github/eslint-stylish.json
Added matchers: 'eslint-compact'. Problem matchers scan action output for known warning or error strings and report these inline.
##[add-matcher]/home/runner/work/_actions/actions/setup-node/v1/.github/eslint-compact.json
Run npm publish
  npm publish
  shell: /bin/bash -e {0}
  env:
    NPM_CONFIG_USERCONFIG: /home/runner/work/_temp/.npmrc
    NODE_AUTH_TOKEN: ***

npm notice [...]
npm notice total files:   18                                      
npm notice 
npm ERR! code E401
npm ERR! 401 Unauthorized - PUT https://registry.npmjs.org/https-localhost - You must be logged in to publish packages.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/runner/.npm/_logs/2019-09-04T13_02_57_793Z-debug.log
##[error]Process completed with exit code 1.

As you can see in Run actions/setup-node@v1 the registry-url is right, in Run npm publish is not.

Unable to find dockerfile

Using old syntax, trying to run a simple job when an issue is created. Getting the following:

### STARTED Setup Node.js for use with actions 23:08:37Z

Pulling image: gcr.io/github-actions-images/action-runner:latest
latest: Pulling from github-actions-images/action-runner
169185f82c45: Pulling fs layer
0ccde4b6b241: Pulling fs layer
d0372f57daa2: Pulling fs layer
165911d108d6: Pulling fs layer
54996bce1de5: Pulling fs layer
165911d108d6: Waiting
54996bce1de5: Waiting
d0372f57daa2: Verifying Checksum
d0372f57daa2: Download complete
169185f82c45: Verifying Checksum
169185f82c45: Download complete
0ccde4b6b241: Verifying Checksum
0ccde4b6b241: Download complete
54996bce1de5: Verifying Checksum
54996bce1de5: Download complete
165911d108d6: Verifying Checksum
165911d108d6: Download complete
169185f82c45: Pull complete
0ccde4b6b241: Pull complete
d0372f57daa2: Pull complete
165911d108d6: Pull complete
54996bce1de5: Pull complete
Digest: sha256:c9bb432ec5ec08ee08b040a9fccacebbbf8a91444dac4721600cf5dca9dae57e
Status: Downloaded newer image for gcr.io/github-actions-images/action-runner:latest
gcr.io/github-actions-images/action-runner:latest
Error response from daemon: Cannot locate specified Dockerfile: Dockerfile

### FAILED Setup Node.js for use with actions 23:08:47Z (10.623s)

Caching npm install

Are there plans to add caching for GitHub Actions? For example, in CircleCI we can greatly reduce the number of VM minutes spent with something like this:

- save_cache:
    key: v1-npm-dependency-cache-{{ checksum "package-lock.json" }}
    paths:
      - node_modules

(and the corresponding restore_cache).

I saw a tools cache for caching the Node.js download, but I'm not sure if that should be used for this.

How do I choose the latest node version?

I'm sorry if this turns out to be a stupid question, but how do I choose the latest Node version available?
When generating stuff like code coverage(for example), it doesn't matter to me which Node version is used and I rather use the latest one.

Support .nvmrc

It would be nice if setup-node understood an .nvmrc file (even if it does not use nvm under the hood, the idea is the node-version is just the contents of the file).

If GitHub Actions as a whole could read the contents of a file as part of an expression, I could do something like

uses: setup-node@v1
with:
  node-version: {{ contents(.nvmrc) }}

But I don't know where to log that type of feature request!

Perhaps '.nvmrc' could be used as a special placeholder, so that:

uses: setup-node@v1
with:
  node-version: '.nvmrc'

Instructs this action to read the contents and treat the contents as the desired version?

Workflow fails to publish to GitHub Package Registry if repo owner login casing does not match scope casing

I've been testing out an Action I was building today and having issues when verifying a step to publish the package to the GitHub Package Registry, which instead attempts to publish the package to the original NPM Registry:

https://github.com/JamesMGreene/test-repo/runs/199833215

After trying to track down the issue for longer than I care to mention as I went down a few incorrect rabbit holes, I believe the root cause is pretty simple: my GitHub username has uppercase letters in it but my NPM scoped package name, by necessity for validation, is all lowercased.

This creates a casing mismatch between the .npmrc file contents that get generated by the setup-node@v1 Action and the scope used by npm publish in a later Step. Some highlights from the Workflow Run logs:

Screen Shot 2019-08-21 at 5 43 09 PM

Luckily, the fix for this should also be pretty simple: to lowercase the repo owner's login scope that gets written to the .npmrc file. 👌

npm syscall lchown can not found lock file: /home/runner/.npm/_locks/staging-fe5488d9a90a0e17.lock

CI failed when running command lerna bootstrap -- --ignore-engines

Shot log:

2019-10-25T09:35:05.2608624Z lerna ERR! npm ERR! code ENOENT
2019-10-25T09:35:05.2608800Z lerna ERR! npm ERR! syscall lchown
2019-10-25T09:35:05.2609375Z lerna ERR! npm ERR! path /home/runner/.npm/_locks/staging-fe5488d9a90a0e17.lock
2019-10-25T09:35:05.2609713Z lerna ERR! npm ERR! errno -2
2019-10-25T09:35:05.2610421Z lerna ERR! npm ERR! enoent ENOENT: no such file or directory, lchown '/home/runner/.npm/_locks/staging-fe5488d9a90a0e17.lock'
2019-10-25T09:35:05.2615806Z lerna ERR! npm ERR! enoent This is related to npm not being able to find a file.

Action workflow config:

name: Node CI

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [8.x, 10.x, 12.x]
    steps:
    - uses: actions/checkout@v1
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}
    - name: npm install, build, and test
      run: |
        npm install
        npm run bootstrap
        npm run build
        npm test
      env:
        CI: true
2019-10-25T09:34:14.9052736Z > lerna bootstrap -- --ignore-engines
2019-10-25T09:34:14.9052843Z 
2019-10-25T09:34:15.1980909Z lerna info version 2.11.0
2019-10-25T09:34:15.2245709Z lerna WARN ECYCLE Encountered a cycle in the dependency graph.This may cause instability! Packages in cycle are: "@tarojs/components", "@tarojs/taro-h5", "@tarojs/redux-h5", "@tarojs/router", "@tarojs/webpack-runner", "babel-plugin-transform-taroapi", "@tarojs/mobx-h5"
2019-10-25T09:34:15.2256819Z lerna info Bootstrapping 47 packages
2019-10-25T09:34:15.2264574Z lerna info lifecycle preinstall
2019-10-25T09:34:15.3551139Z lerna info Installing external dependencies
2019-10-25T09:35:05.2545817Z lerna ERR! execute callback with error
2019-10-25T09:35:05.2557470Z lerna ERR! Error: Command failed: npm install --ignore-engines
2019-10-25T09:35:05.2572634Z lerna ERR! npm WARN deprecated [email protected]: core-js@<2.6.8 is no longer maintained. Please, upgrade to core-js@3 or at least to actual version of core-js@2.
2019-10-25T09:35:05.2573788Z lerna ERR! npm WARN deprecated [email protected]: use String.prototype.padStart()
2019-10-25T09:35:05.2604402Z lerna ERR! npm WARN deprecated [email protected]: Please upgrade to kleur@3 or migrate to 'ansi-colors' if you prefer the old syntax. Visit <https://github.com/lukeed/kleur/releases/tag/v3.0.0\> for migration path(s).
2019-10-25T09:35:05.2605673Z lerna ERR! npm WARN [email protected] requires a peer of eslint@^3.17.0 || ^4 || ^5 but none is installed. You must install peer dependencies yourself.
2019-10-25T09:35:05.2606374Z lerna ERR! npm WARN taro-rn No description
2019-10-25T09:35:05.2607319Z lerna ERR! npm WARN taro-rn No repository field.
2019-10-25T09:35:05.2608032Z lerna ERR! npm WARN taro-rn No license field.
2019-10-25T09:35:05.2608300Z lerna ERR! 
2019-10-25T09:35:05.2608624Z lerna ERR! npm ERR! code ENOENT
2019-10-25T09:35:05.2608800Z lerna ERR! npm ERR! syscall lchown
2019-10-25T09:35:05.2609375Z lerna ERR! npm ERR! path /home/runner/.npm/_locks/staging-fe5488d9a90a0e17.lock
2019-10-25T09:35:05.2609713Z lerna ERR! npm ERR! errno -2
2019-10-25T09:35:05.2610421Z lerna ERR! npm ERR! enoent ENOENT: no such file or directory, lchown '/home/runner/.npm/_locks/staging-fe5488d9a90a0e17.lock'
2019-10-25T09:35:05.2615806Z lerna ERR! npm ERR! enoent This is related to npm not being able to find a file.
2019-10-25T09:35:05.2616183Z lerna ERR! npm ERR! enoent 
2019-10-25T09:35:05.2616821Z lerna ERR! 
2019-10-25T09:35:05.2617305Z lerna ERR! npm ERR! A complete log of this run can be found in:
2019-10-25T09:35:05.2617965Z lerna ERR! npm ERR!     /home/runner/.npm/_logs/2019-10-25T09_35_05_188Z-debug.log
2019-10-25T09:35:05.2618267Z lerna ERR! 
2019-10-25T09:35:05.2618824Z lerna ERR!     at /home/runner/work/taro/taro/node_modules/lerna/node_modules/execa/index.js:236:11
2019-10-25T09:35:05.3052939Z lerna WARN complete Waiting for 2 child processes to exit. CTRL-C to exit immediately.
2019-10-25T09:36:06.9408206Z Error: Command failed: npm install --ignore-engines
2019-10-25T09:36:06.9409704Z npm WARN deprecated [email protected]: core-js@<2.6.8 is no longer maintained. Please, upgrade to core-js@3 or at least to actual version of core-js@2.
2019-10-25T09:36:06.9411648Z npm WARN deprecated [email protected]: use String.prototype.padStart()
2019-10-25T09:36:06.9412768Z npm WARN deprecated [email protected]: Please upgrade to kleur@3 or migrate to 'ansi-colors' if you prefer the old syntax. Visit <https://github.com/lukeed/kleur/releases/tag/v3.0.0\> for migration path(s).
2019-10-25T09:36:06.9413565Z npm WARN [email protected] requires a peer of eslint@^3.17.0 || ^4 || ^5 but none is installed. You must install peer dependencies yourself.
2019-10-25T09:36:06.9414483Z npm WARN taro-rn No description
2019-10-25T09:36:06.9414896Z npm WARN taro-rn No repository field.
2019-10-25T09:36:06.9415285Z npm WARN taro-rn No license field.
2019-10-25T09:36:06.9415358Z 
2019-10-25T09:36:06.9415540Z npm ERR! code ENOENT
2019-10-25T09:36:06.9415724Z npm ERR! syscall lchown
2019-10-25T09:36:06.9416213Z npm ERR! path /home/runner/.npm/_locks/staging-fe5488d9a90a0e17.lock
2019-10-25T09:36:06.9416568Z npm ERR! errno -2
2019-10-25T09:36:06.9417156Z npm ERR! enoent ENOENT: no such file or directory, lchown '/home/runner/.npm/_locks/staging-fe5488d9a90a0e17.lock'
2019-10-25T09:36:06.9417799Z npm ERR! enoent This is related to npm not being able to find a file.
2019-10-25T09:36:06.9418124Z npm ERR! enoent

Is the yarn version installed configurable?

Heya!

Thanks for your wonderful action 🤗

I'm using it to power the GitHub Action that runs tests on ts-loader. We recently bumped on an issue with yarn: yarnpkg/yarn#7584

That was fixed in yarn v1.19.1 and I was left pondering how to upgrade the version of yarn that this action seems to install. See my ponderings here:

TypeStrong/ts-loader#1026 (comment)

I was able to resolve the issue by introducing this:

      - name: upgrade yarn
        run: npm install yarn -g

which upgrades to the latest and greatest yarn. You see... success!:

https://github.com/TypeStrong/ts-loader/pull/1027/checks?check_run_id=270427331

My question is, how is yarn installed by this action? And assuming I'm correct that it is, is it configurable to ensure that it's the latest and greatest? I'm wondering whether the course of action I've followed is the "best way". Or if there's another?

Thanks again for your wonderful action!

No token found and can't prompt for login when running with --non-interactive.

In my repo I have the workflow like this:

- run: yarn publish
  env:
    NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

I've added NPM_AUTH_TOKEN to secrets, but got this error:

image

Run yarn publish
  yarn publish
  shell: /bin/bash -e {0}
  env:
    NODE_AUTH_TOKEN: ***
yarn publish v1.19.1
[1/4] Bumping version...
info Current version: 0.1.22
[2/4] Logging in...
error No token found and can't prompt for login when running with --non-interactive.
info Visit https://yarnpkg.com/en/docs/cli/publish for documentation about this command.
##[error]Process completed with exit code 1.

I have tried many times and can't figure it out. My repo is https://github.com/leadream/juuust-icon.
Can anyone help me? Thanks!

Missing Code of Conduct

This repository does not currently have a Code of Conduct. It would be nice to add one that the maintainers are committed to enforcing to ensure that contributors are able to know that they'll be safe when engaging with the project.

Typo in README

On line 99:

npm rebuild will run all those post-install scritps for us.

Should be scripts instead.

What is default `registry-url`?

The action.yml documents registry-url as optional but doesn't specify what the default is. Is it npm or github?

More interestingly... will this action properly respect publishConfig from package.json? Typically, tag and registry and access are things that should be configured at the project level and so they should be configured in the package.json, not .npmrc (which is a user-specific file). If the registry is specified this way (package.json#publishConfig.registry), will that be used properly when the workflow omits the registry param?

How to install/publish packages from multiple `@scope` and multiple registers?

How to install packages from multiple @scope and multiple registers?
I have settings .npmrc in the root of the project:

@scope1:registry=https://npm.pkg.github.com
@scope2:registry=https://npm.pkg.github.com
@scope3:registry=https://npm.anysite.org
@scope4:registry=https://registry.npmjs.org

and npmjs.com by default for a public

I need to create something like this settings .npmrc in the home folder before installing:

//npm.pkg.github.com/:_authToken=<TOKEN_A>
//nnpm.anysite.org/:_authToken=<TOKEN_B>
//registry.npmjs.org/@scope4/:_authToken=<TOKEN_C>

or

//npm.pkg.github.com/@scope1/:_authToken=<TOKEN_A1>
//npm.pkg.github.com/@scope2/:_authToken=<TOKEN_A2>
//nnpm.anysite.org/:_authToken=<TOKEN_B>
//registry.npmjs.org/@scope4/:_authToken=<TOKEN_C>

node-setup@v1 permission denied, mkdir '/home/actions' when checking cach

What is this?

I added Actions to my repo using the node-setup@v1 (added by clicking the template) to my repo and received the below error message.

##[debug]checking cache: /home/actions/cache/node/10.16.1/x64
##[debug]not found
##[error]EACCES: permission denied, mkdir '/home/actions'
##[error]Node run failed with exit code 1

Reverting to node-setup@master, which is currently 2 commits behind the v1 release works without an issue. Those commits seem trivial as well, just removing node_modules.

thought

My guess is that it has to do with the current failure on the v1-release but it doesn't seem to be related. I am not sure what PR #21 is related to but it doesn't seem to anything to do with this as well.

details

repo/pr in question: https://github.com/github/newsletter-bot/pull/8/files
failing check: https://github.com/github/newsletter-bot/pull/8/checks?check_run_id=185763954

// nodejs.yml

on: [push]

name: Node.js

jobs:

  build:
    name: Build
    runs-on: ubuntu-latest
    steps:

    - uses: actions/checkout@master

    - name: Use Node.js 10.x
      uses: actions/setup-node@v1
      with:
        version: 10.x

    - name: npm install, build, and test
      run: |
        npm install
        npm run build --if-present
        npm test

Multiple scoped npm repositories with different urls

I'm trying to use the actions/setup-node step but in my specific case I have multiple scoped npm repositories with different registry urls,
According to your docs, it seems that there can only be a single registry url per setup-node step so I basically can't use it for my project.
Am I getting something wrong here or is it still not supported?

Thanks.

How is yarn getting installed?

I cannot determine by what mechanism yarn is getting installed by this action. I was hoping to find something explicit in the code that is downloading and installing it, but I found no mention of yarn.

Could you please clarify how setup-node is ensuring that yarn gets installed?

Default/Reccomended Matrix

The Node Package Maintenance WG has been working on a set of guidelines for package maintainers. This includes some testing recommendations for which node versions to test in based on your support goals. Some progress was being made on getting Travis to support tags like all, lts, active, etc. It would be great if we could get the default matrix (and other common ones) setup here before most users even get started with it to set a good precedence.

Here is the ongoing conversation for that group: nodejs/package-maintenance#205

If there is anything I can do to help move this forward (like working on a PR) I am happy to do that. If you just want to have a conversation with the PM WG team and then implement it yourself that would also be great!

Log Node.js version using

Couple of things.

First if you specify node-version of 10, does that use the absoute latest version of Node.js v10 (both minor and patch versions)?

Second, does node-version of 10.x use the latest version when taking account patch versions? Or does .x just mean the minor version?

Finally, it'd be great if this action printed the Node.js version it decided to use in the logs of GitHub Actions so developers can determine which Node.js version it decided to use, which would make debugging SO much easier.

Screen Shot 2019-11-22 at 3 49 46 PM

Step name not displayed correctly in log viewer when using node-version

Hi there! I have a basic workflow defined as below but within the Actions log viewer the step name is not correctly formatted when trying to substitute the node-version into it.

If this isn't the correct place to post such issues feel free to point me in the right direction. Really liking GitHub Actions so far though!!

Screenshot 2019-09-14 at 11 16 38 am

name: continuous-integration

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [10.x]

    steps:
      - name: Checkout source code
        uses: actions/checkout@v1

      - name: Setup Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}

Use recommended release strategy

We should be using the release strategy specified by https://github.com/actions/toolkit/blob/master/docs/action-versioning.md#recommendations

To get there, we need to:

  1. Create a releases/v1 branch and move the v1 tag and future releases there
  2. Warn that we will deprecate the master branch and that you should attach to v1 instead. We will support master in a warned but deprecated state for ~1 month.
  3. Switch the warning to an error on master. Remove node_modules from the master branch. We will stay in this state for ~1 month.
  4. Remove the error on master.

During steps 2 and 3, we need to be extra careful to not check the warning/error into the releases branch.

Problem Matcher for testing/CI

How can we enable problem matchers for various testing tools like https://github.com/mochajs/mocha? Is there a reporting format that we should use for it to be matched by the runner when errors occur in the test cases? I saw the problem matchers for eslint like estlint-stylish but didn't see anything else.

If anyone can point me in the right direction, I'm happy to create the matcher if it doesn't already exist.

Bundle distribution to remove 'node_modules' folder in repo

Currently, the repo requires that the node_modules folder with production dependencies should be included in VCS (Git).

This can be eliminated if the distribution code gets bundled.

Please let me know if this idea is of interest. If so I could provide a PR. I'm familiar with webpack but roolupjs is also a choice.

Support aliases like LTS

Right now, we're thinking it makes sense to support lts, latest, current, and LTS version names (e.g. dubinium)

Support specifying alternate node mirrors

I have a use case where I test against latest node LTS, latest node stable and latest node on V8 lkgr, with the latter requiring to use a different than the hardcoded dataUrl (this one to be precise).

Noticed that the latest tags are being in the works already, which is great, so I thought I mention the mirror as well since that would allow me to replace my custom and hopefully temporary solution with proper setup-node that works on all platforms :)

Node 8 installs different versions depending on system

When setting up Node with the next strategy matrix and action from v1 or master:

strategy:
      matrix:
        node_version: [8, 10, 12]
        os: [ubuntu-latest, windows-latest, macOS-latest]

# ...

    - name: Use Node ${{ matrix.node_version }}
      uses: actions/setup-node@master
      with:
        version: ${{ matrix.node_version }}

With Node 10 and 12, it works like a charm, installing 10.16.2 and 12.8.0 respectively, using 10 or '10.x' and 12 or '12.x', but with Node 8 using 8 or 8.x it will not install the latest version in Windows. I made a table with the versions installed depending on the base system and the value in the node_version array specified:

System specified Node specified Node installed
ubuntu-latest 8 8.16.0
macOS-latest 8 8.16.0
windows-latest 8 8.10.0
ubuntu-latest 8.x 8.16.0
macOS-latest 8.x 8.16.0
windows-latest 8.x 8.10.0
ubuntu-latest 8.16 8.16.0
macOS-latest 8.16 8.16.0
windows-latest 8.16 8.16.0

Windows is installing 8.10 when Ubuntu and MacOS install 8.16. If we force 8.16 it will install it, but this is not scaling.

Downloading from nodejs.org failing

I'm not sure this is the best repo to report the issue, if it's the wrong place please close this :)

We've been using Github Actions successfully for a few days but starting today all our builds have started to fail at the setup-node step with this error:


4m 57s
##[error]Node run failed with exit code 1
Run actions/setup-node@v1
  with:
    node-version: 12.x
    always-auth: false
/bin/tar xzC /home/runner/work/_temp/83341e1a-c86d-4ddb-9963-ef01607f6e1e -f /home/runner/work/_temp/58fc8365-fe95-474e-ad3c-c5511594abdd

gzip: stdin: unexpected end of file
/bin/tar: Unexpected EOF in archive
/bin/tar: Unexpected EOF in archive
/bin/tar: Error is not recoverable: exiting now
##[error]The process '/bin/tar' failed with exit code 2
##[error]Node run failed with exit code 1

Attaching a screenshot for more clarity
Schermata 2019-10-23 alle 16 22 25

You can see an example of a failed build here https://github.com/HabitRPG/habitica/pull/11474/checks?check_run_id=271716057.

The code of the workflow is the standard one that can be seen in the official docs

steps:
.....
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}
....

publishing to npm fails after publishing to GPR

I have a workflow like this that's supposed to publish to npm once I publish to GPR:

name: Publish to npm
on: registry_package
jobs:
  publish-npm:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - uses: actions/setup-node@v1
        with:
          node-version: 12
          registry-url: https://registry.npmjs.org/
      - run: npm install && npm publish
        env:
          NODE_AUTH_TOKEN: ${{secrets.npm_token}}

I have the npm_token secret added to this repository.

When I just published to GPR, it kicked off this workflow job, but it failed at the last step of publishing to npm. The error was from npm saying:

npm ERR! code E401
npm ERR! Unable to authenticate, need: Basic realm="GitHub Package Registry"

What does this error mean, and how do I fix it? I don't see anything about setting "basic realm" in the recipes for this setup-node action.

GITHUB_TOKEN does not have access to other private packages

Based on the documentation, I have my workflow set up to install from my GitHub Package Registry:

    steps:
    - uses: actions/checkout@v1
    - uses: actions/setup-node@v1
      with:
        node-version: 10.x
        registry-url: 'https://npm.pkg.github.com'
    - run: npm ci
      env:
        NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

However, I get a 404 when trying to install any private packages scoped to my account with this configuration. Just to clarify these are private packages within the same account that this repo and workflow exists.

Using the exact same configuration, if I replace with a personal access token I've created, I am able to install private packages without issue.

Unable to build binary modules on windows-latest

I think this is just a path issue. As part of node serialport's test process I need to ensure we can build the binary. I run node-gyp rebuild on the binary package and I get the following error.

gyp ERR! stack Error: spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\15.0\Bin\MSBuild.exe ENOENT

full stack below

D:\a\node-serialport\node-serialport\packages\bindings>if not defined npm_config_node_gyp (node "C:\hostedtoolcache\windows\node\8.10.0\x64\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\hostedtoolcache\windows\node\8.10.0\x64\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild ) 

lerna ERR! npm install stderr:
gyp ERR! UNCAUGHT EXCEPTION 
gyp ERR! stack Error: spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\15.0\Bin\MSBuild.exe ENOENT
gyp ERR! stack     at _errnoException (util.js:1022:11)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
gyp ERR! stack     at onErrorNT (internal/child_process.js:372:16)
gyp ERR! stack     at _combinedTickCallback (internal/process/next_tick.js:138:11)
gyp ERR! stack     at process._tickCallback (internal/process/next_tick.js:180:9)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\\hostedtoolcache\\windows\\node\\8.10.0\\x64\\node.exe" "C:\\hostedtoolcache\\windows\\node\\8.10.0\\x64\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\a\node-serialport\node-serialport\packages\bindings
gyp ERR! node -v v8.10.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! This is a bug in `node-gyp`.

https://github.com/serialport/node-serialport/runs/240073493

engines support

Hello,
It would be great if setup-node would automatically pick the correct version specified in our package.json engines property.

We're using github actions for 7 packages now and while all have an .nvmrc & specified engines still have to use the workaround provided in: #32 (comment)

Related to: #32, #26

Doesn't work properly with modern JS code

See this run: https://github.com/paulmillr/readdirp/runs/204881542

It says “unexpected token (“ — this error is usually printed when async functions aren’t supported by the engine.

It errors only on Macos, which means something is wrong with your macos-node installation.

GitHub uses node 12.x (or 10.x or 8.x) which all support async functions. See travis-ci: the same build ran there without issues https://travis-ci.org/paulmillr/readdirp/builds/571845859

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.