elementary / website

The elementary.io website
https://elementary.io
MIT License
1.24k stars 705 forks source link

Run website in vagrant #1442

Closed jzunigarce closed 5 years ago

jzunigarce commented 8 years ago

I try to mount the website in vagrant but after to run vagrant up and enter localhost:8000 in the browser the website not load the styles and script.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/38573777-run-website-in-vagrant?utm_campaign=plugin&utm_content=tracker%2F10548672&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F10548672&utm_medium=issues&utm_source=github).
btkostner commented 8 years ago

Would this happen to be on a window machine?

jzunigarce commented 8 years ago

Hi @btkostner I run vagrant in linux mint kde. The version of virtualbox is 4.3. I attached a picture so you can see how the site looks http://imagizer.imageshack.us/a/img923/9941/4EbFMb.png

btkostner commented 8 years ago

I updated the Vagrantfile in the vagrant branch. Would you mind trying it out to make sure it works before I submit a PR?

jzunigarce commented 8 years ago

@btkostner it does not work. The error message is: ==> default: npm ==> default:
==> default: WARN optional ==> default: Skipping failed optional dependency /chokidar/fsevents: ==> default: npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.14 ==> default: npm ==> default: ERR! Linux 4.4.0-45-generic ==> default: npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "--no-bin-links" ==> default: npm ERR! node v4.2.6 ==> default: npm ERR! npm v3.5.2 ==> default: npm ERR! path /home/ubuntu/website/node_modules ==> default: npm ERR! ==> default: code EEXIST ==> default: npm ERR! errno -17 ==> default: npm ERR! ==> default: syscall ==> default: mkdir ==> default: npm ERR! EEXIST: file already exists, mkdir '/home/ubuntu/website/node_modules' ==> default: npm ==> default: ERR! ==> default: File exists: /home/ubuntu/website/node_modules ==> default: npm ==> default: ERR! Move it away, and try again. ==> default: npm ERR! ==> default: Please include the following file with any support request: ==> default: npm ERR! /home/ubuntu/website/npm-debug.log ==> default: ==> default: > mvp@0.4.0 build /home/ubuntu/website ==> default: > NODE_ENV=production webpack --config webpack.config.babel.js ==> default: sh: 1: webpack: not found ==> default: npm ==> default:
==> default: ERR! ==> default: Linux 4.4.0-45-generic ==> default: npm ==> default: ERR! ==> default: argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "build" ==> default: npm ==> default:
==> default: ERR! ==> default: node ==> default: v4.2.6 ==> default: npm ==> default: ERR! ==> default: npm v3.5.2 ==> default: npm ERR! file sh ==> default: npm ERR! code ELIFECYCLE ==> default: npm ERR! errno ENOENT ==> default: npm ==> default:
==> default: ERR! ==> default: syscall ==> default: spawn ==> default: npm ERR! mvp@0.4.0 build: NODE_ENV=production webpack --config webpack.config.babel.js ==> default: npm ERR! ==> default: spawn ENOENT ==> default: npm ==> default: ERR! ==> default:
==> default: npm ==> default: ERR! ==> default: Failed at the mvp@0.4.0 build script 'NODE_ENV=production webpack --config webpack.config.babel.js'. ==> default: npm ==> default: ERR! ==> default: Make sure you have the latest version of node.js and npm installed. ==> default: npm ==> default:
==> default: ERR! ==> default: If you do, this is most likely a problem with the mvp package, ==> default: npm ==> default: ERR! ==> default: not with npm itself. ==> default: npm ==> default: ERR! Tell the author that this fails on your system: ==> default: npm ERR! NODE_ENV=production webpack --config webpack.config.babel.js ==> default: npm ERR! You can get information on how to open an issue for this project with: ==> default: npm ERR! npm bugs mvp ==> default: npm ERR! Or if that isn't available, you can get their info via: ==> default: npm ERR! npm owner ls mvp ==> default: npm ERR! There is likely additional logging output above. ==> default: npm ERR! ==> default: Please include the following file with any support request: ==> default: npm ERR! ==> default: /home/ubuntu/website/npm-debug.log ==> default: Created symlink from /etc/systemd/system/multi-user.target.wants/website.service to /etc/systemd/system/website.service. ➜ website git:(master) ✗

btkostner commented 8 years ago

Can you remove the node_modules folder then try vagrant provision. It looks like node failed to install because the folder already existed, but with weird permissions.

jzunigarce commented 8 years ago

Hi @btkostner

I delete node_modules and execute vagrant provision not show erros but the localhost:8000 show You can not access this site. I use localhost/website and can enter the site (the folder is mount in apache public_html folder). The script y styles folder was generated but when i modify any css rules not change I think it's because I'm not running from localhost:8000

cambiobtnguardar3

btkostner commented 8 years ago

The reason you are not seeing modified css rules is because all of our styles and scripts are built. You will need to run the build command in the vagrant box after you make changes.

vagrant ssh
cd /home/ubuntu/website
npm run build

As for not being able to access the website, that seems odd. If you could, please run the following commands and let me know the output.

vagrant ssh
sudo systemctl status website
jzunigarce commented 8 years ago

Hi @btkostner Thanks I could compile files. The output of command sudo systemctl status website was: **ubuntu@ubuntu-xenial:~/website$ sudo systemctl status website ● website.service - Runs PHP server for elementary website Loaded: loaded (/etc/systemd/system/website.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Wed 2016-10-26 18:28:27 UTC; 4h 56min ago Process: 1688 ExecStart=/home/ubuntu/website.sh (code=exited, status=203/EXEC) Main PID: 1688 (code=exited, status=203/EXEC)

Oct 26 18:28:27 ubuntu-xenial systemd[1]: Started Runs PHP server for elementary website. Oct 26 18:28:27 ubuntu-xenial systemd[1]: website.service: Main process exited, code=exited, status=203/EXEC Oct 26 18:28:27 ubuntu-xenial systemd[1]: website.service: Unit entered failed state. Oct 26 18:28:27 ubuntu-xenial systemd[1]: website.service: Failed with result 'exit-code'. ubuntu@ubuntu-xenial:~/website$ systemctl --user status flexget ● flexget.service Loaded: not-found (Reason: No such file or directory) Active: inactive (dead) ubuntu@ubuntu-xenial:~/website$\

yugarinn commented 7 years ago

I was experiencing this issue as well so I decided to do a bit of testing... After a while I realised that every problem I was stumbling upon was related to the installation of npm packages, so I decided to update npm and everything worked just fine.

Before that I tried to get up the box in the vagrant branch that @btkostner mentions on #1345 but the problem persisted.

My solution consisted in removing the symbolic link between /home/vagrant/node_modules and /home/vagrant/mvp/node_modules (I don't understand why it was there in the first place) and add an npm update after the node installation in the Vagrantfile.

I'll do another couple of tests and if I don't encounter more complications I'll submit a PR with the solution.

btkostner commented 7 years ago

@sergiouve Interesting. The reason that symbolic link was there is because of the way vagrant handles mounted folders on windows machines.

JamyGolden commented 6 years ago

It looks like https://github.com/elementary/website/pull/1501 fixed this issue, so it should be closed.

lewisgoddard commented 6 years ago

I don't think that was merged, we just ended up removing Vagrant.