Are you required to use a virtual machine?
Since you are using windows I would recommend using Laragon unless you are otherwise required to use a virtual machine.
You avoid all the hassle of setting up machines
I can't seem to make Laravel Mix work out of the box. When I run npm run dev, I get the cross-env not found error.
My environment, all freshly installed:
Installed VirtualBox, then Vagrant. Ran vagrant box add laravel/homestead, ran git clone https://github.com/laravel/homestead.git homestead in my D:\Werk directory. cd'd into homestead, did git checkout v5.1.0, as per Laravel Docs, edited Homestead.yaml, as seen below, and booted up the VM with vagrant up.
---
box: laravel/homestead
ip: "192.168.111.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: C:\Users\xxxxxx\.ssh\id_rsa.pub
keys:
- C:\Users\xxxxxx\.ssh\id_rsa
folders:
- map: D:\Werk\projects
to: /home/vagrant/projects
sites:
- map: homestead.app
to: /home/vagrant/projects/homestead
- map: visitors.app
to: /home/vagrant/projects/visitors/public
databases:
- homestead
- visitors
SSH'd into box (127.0.0.1:2222), ran sudo apt-get upgrade for the latest server software, cd'd to /home/vagrant/projects in which I ran laravel new visitors. Once finished, I then cd'd into the visitors directory, where I ran npm install --no-bin-links. I get a Maximum call stack size exceeded error, and in accordance with GitHub issue answers, I ran the command again, this time successfully.
Now when I run npm run dev I get a sh: 1: cross-env: not found error. In accordance with what @JeffreyWay said here, I installed cross-env with npm: npm install cross-env -D --no-bin-links, to no avail.
I tried several "solutions" out there. from adding "bin": { "cross-env": "dist/bin/cross-env.js"}, to the package.json to babel related stuff in the same file. Nothing seems to work. When I replace cross-env with node node_modules/cross-env/dist/bin/cross-env.js in the package.json file, I get:
error in ./resources/assets/sass/app.scss
Module build failed: ModuleBuildError: Module build failed: Error: ENOENT: no such file or directory, scandir '/home/vagrant/projects/visitors/node_modules/node-sass/vendor'
When I make that directory (found a post somewhere that suggests that the vendor folder is not created during installation of node-sass), then i get the next error:
error in ./resources/assets/sass/app.scss
Module build failed: ModuleBuildError: Module build failed: Error: Missing binding /home/vagrant/projects/visitors/node_modules/node-sass/vendor/linux-x64-48/binding.node
Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 6.x
Found bindings for the following environments:
This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass --force` to build the binding for your current environment.
So I run `npm rebuild node-sass --force --no-bin-links', which downloads and compiles node-sass from source, it seems.
Then, and only then, does it work. But I don't believe that this developers are expected to run these steps every time they bring their vagrant machine up. So either I am missing something crucial or there is a bug. Any advice?
Please or to participate in this conversation.