Glavin001 / GitLab-Pages

:eyes: GitHub Pages, for GitLab.
MIT License
203 stars 30 forks source link

Cannot build the Docker image #29

Closed rabejens closed 8 years ago

rabejens commented 8 years ago

When I just check out the source and do a simple docker build, after a lengthy compilation I get:

npm ERR! Linux 3.19.0-39-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v5.2.0
npm ERR! npm  v3.3.12
npm ERR! path /app/node_modules/nodegit/node_modules/amdefine
npm ERR! code EXDEV
npm ERR! errno -18
npm ERR! syscall rename

npm ERR! EXDEV: cross-device link not permitted, rename '/app/node_modules/nodegit/node_modules/amdefine' -> '/app/node_modules/amdefine'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /app/npm-debug.log

I am using the official node image because the one from Google is deprecated.

It fails at step 9: RUN npm install -g bower && npm install && bower --allow-root install

r4j4h commented 8 years ago

I believe that npm install's --no-bin-links argument needs to be provided so that the ./node_modules/.bin/ symlink is not created.

I get this error all the time from npm inside Docker on some machines.

So step 9 should be npm install --no-bin-links. Since bower is installed globally I think this only needs to go on the middle part between the &&s, but I may be wrong.

Side effects:

The main downside to it is since the .bin symlink is avoided, if you need to use it you gotta manually go to it. For example with the jasmine testing framework ./node_modules/.bin/jasmine becomes ./node_modules/jasmine/bin/jasmine

Further reading:
ezekg commented 8 years ago

I hit this issue yesterday and I think that you can get around it by creating a symlink of your ./node_modules directory to an area outside of your shared folders, i.e. mkdir ~/tmp_node_modules && ln -s ~/tmp_node_modules ./node_modules, and then running npm install.

I created a small command line tool called sympm that automates those steps and acts as a replacement for npm install (without any arguments, of course) when inside of a virtual machine. You don't need to install with flags like --no-bin-links; everything should behave correctly.

Maybe it'll be helpful to somebody here.

ryan-shaw commented 8 years ago

Try my fork - improved Dockerfile

https://github.com/ryanshawty/GitLab-Pages

Glavin001 commented 8 years ago

If others find @ezekg @ryanshawty works for them, I will merge Pull Request #33. Let me know. Thanks!

ezekg commented 8 years ago

I think you mean @ryanshawty's solution, mine was the npm tool above his fork. 👌

ryan-shaw commented 8 years ago

@Glavin001 @rabejens this issue can be closed.

Glavin001 commented 8 years ago

Thanks!