Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yarn killed during build in alpine docker container #11

Closed
rash805115 opened this issue Dec 16, 2018 · 6 comments
Closed

yarn killed during build in alpine docker container #11

rash805115 opened this issue Dec 16, 2018 · 6 comments

Comments

@rash805115
Copy link

I was trying to run this project under an alpine image in docker. As soon as I run the yarn command, following output is produced, and the program is killed. In mac-OS the same command runs perfectly, so the issue might be that some dependencies may not be compatible with linux/alpine system? Or it maybe a yarn issue? I am not well versed in yarn or webpack, and was wondering if there is another way to build this project?

/var/www/localhost/code # ls
README.md          docs               node_modules       package-lock.json  package.json       src                webpack.config.js  yarn.lock
/var/www/localhost/code # yarn
yarn install v1.5.1
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.4: The platform "linux" is incompatible with this module.
info "fsevents@1.2.4" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
[1/1] ⡀ node-sass
[-/1] ⡀ waiting...
[-/1] ⡀ waiting...
[-/1] ⡀ waiting...
[-/1] ⢀ waiting...Killed
/var/www/localhost/code # 
@jibin2706
Copy link
Contributor

jibin2706 commented Dec 16, 2018

@rash805115 can you delete the node_modules folder and try again

@rash805115
Copy link
Author

Hello @jibin2706 . I tried it a couple of times, but I am constantly hitting this issue. Could this be an issue info fsevents@1.2.4: The platform "linux" is incompatible with this module.?

@jibin2706
Copy link
Contributor

I tried in ubuntu, got the info fsevents@1.2.4: The platform "linux" is incompatible with this module but everything is working fine.

yarn install v1.12.3 [1/4] Resolving packages... [2/4] Fetching packages... info fsevents@1.2.4: The platform "linux" is incompatible with this module. info "fsevents@1.2.4" is an optional dependency and failed compatibility check. Excluding it from installation. [3/4] Linking dependencies... [4/4] Building fresh packages... Done in 846.24s.

@rash805115
Copy link
Author

If you like I can try to create a Dockerfile with alpine image and try to reproduce this.

@rash805115
Copy link
Author

Actually, now that I make a Dockerfile, I cannot reproduce this issue. It only happens in my other environment. But I guess then something is wrong in my setup, not yours. I will keep on investigating, and will keep the issue open for a couple of days if you don't mind.

FROM node:8.10.0-alpine

# Installing:
# ===========
# node: 8.10.0
# npm: 5.6.0
# yarn: 1.5.1

RUN mkdir -p /server
WORKDIR /server

COPY ./ /server/
RUN npm install

EXPOSE 8080
ENTRYPOINT ["npm", "start"]

@rash805115
Copy link
Author

Hello @jibin2706 I found the issue :) It had nothing to do with this project, but I had a lot of fun figuring it out so I will share my results.

Background

I am working on this project - Plugins by Quadnix, where you can simply upload and share your web application. I thought your web application is very cool and I wanted to have this on my "Plugins" website. click here to see how it looks.

Problem

The flow of "Plugins" is quite simple. Build (e.g. npm install), Zip (to save the output for future run), and Run (e.g. npm start). In your web application instance, npm start is referring to webpack-dev-server program, which was throwing errors as shown in my issue.

Root Cause

I didn't know it then, but npm install creates a node_modules/.bin directory which contains symlinks to all the executables including webpack-dev-server. And the zip program (yazl) that I was using does not support copying of symlinks. So in step 2 of Plugins, the zip archive didn't have the symlinks that npm start was expecting to be.

Deleting and re-running npm install would work because then npm would create fresh symlinks. This is why it was running in local, and not in my test environment (where I was using zip library).

Fix

Instead of using webpack-dev-server, I started using the full path node_modules/webpack-dev-server/bin/webpack-dev-server.js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants