supporting installing node into an alpine based container
See original GitHub issueI 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:
- Created 4 years ago
- Reactions:4
- Comments:10 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
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.