question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

supporting installing node into an alpine based container

See original GitHub issue

I use alpine linux for my container.

jobs:
  build:
    runs-on: ubuntu-latest
    container:
      image: php:7.3-fpm-alpine

    steps:
    - uses: actions/checkout@v1

    - name: use Node
      uses: actions/setup-node@v1
      with:
        node-version: 12.x

    - name: npm install
      run: npm install

actions/setup-node succeeds, but npm install fails.

Run npm install
  npm install
  shell: sh -e {0}
env: can't execute 'node': No such file or directory
##[error]Process completed with exit code 127.

Is there a way to work with alpine linux?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dmitry-shibanovcommented, Nov 22, 2021

Hello @fagai. I’ve tried to investigate the issue deeper and it looks like the action won’t be able to configure nodejs from source code for alpine images, because it requires extra tools and libs (for example python) which could not persist on the docker image.

I think the most suitable solution for this will be installing unofficial builds. We have issue with adding mirrors. But you still can have problems with node because alpine does not contain all necessary libs, that is why possibly you’ll need to execute apk add --no-cache libstdc++.

For now I’m closing the issue. If you have any concerns or questions feel free to ping us.

1reaction
dmitry-shibanovcommented, Nov 19, 2021

Hello @fagai. Actually setup-node sets up a volume to the toolcache directory where nodejs versions persist. I think node installed to docker image was not compatible with used alpine image.

As @adabru mentioned for alpine images unofficial-builds.nodejs.org builds are used or nodejs is built from source code. For now I think the error is expected because setup-node installs nodejs binaries from https://nodejs.org/dist.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to install npm in alpine linux - Super User
For the recent versions of Alpine (v3.8+) the correct way to install nodejs with npm is: apk add --update nodejs npm.
Read more >
How to install a specific Node.js version in an alpine Docker ...
1, Use a binary. This isn't as easy as it sounds. Simply using the official Node binary of your platform will fail and...
Read more >
Making Our Own Alpine Node.js Container
As an exercise to understand what goes into making a container from scratch, Brian shows how to create a Node.js container from the...
Read more >
Install node.js from source on alpine - docker - Stack Overflow
Installing node via apk : node is available at alpine's official package manager apk, and you can install it by simply running apk...
Read more >
How to Install Node.JS and NPM on Alpine Linux
This installs Node.JS, NPM, and all the additional packages and libraries, and dependencies from the Alpine Linux repositories.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found