0

I got Laravel Homestead up and running, except when I issue this ssh command:

gulp

I get this error:

Local gulp not found in ~/projects/laravel
Try running: npm install gulp

That's when I noticed there was no node_modules folder at all in this directory. Weird. Is this an issue where the paths were too long for Windows when I did a vagrant up? Since the host machine for this VM is Windows and I'm sharing folders with my VM (actually I'm not, but rather I'm using phpStorm's sync so that pages will load faster on the VM), when I do a npm install am I still going to encounter the problem? Hmm...I guess Taylor Otwell is using a Mac for development. Anybody have a solution to this?

prograhammer
  • 20,132
  • 13
  • 91
  • 118

2 Answers2

0

Solved it!

Yes it appears to be that some of these paths from these package installs are too long for Windows. This means you can only install the gulp package after your VM is up. Here's what I did: (I also include a step for use with phpStorm already (since it will keep server pages loading faster on the VM)

  1. SSH into the VM and create a folder called node_modules in your project's directory (the directory where package.json is).
  2. In phpStorm, go to File > Settings > Build, Execution, Deployment > Deployment and click on the Excluded Paths tab. Click the Add deployment path button and add the folder node_modules from step 1.
  3. SSH back into the VM and in your projects folder (should be directory folder with package.json) and run this command: npm install. This will install all packages listed in your package.json file locally to the directory you are in, and will put the necessary files into the folder node_modules.
  4. Now run the gulp command: gulp

UPDATE:

If you really prefer file-sharing through a mounted folder, then I've created a Gist that will guide someone through all the challenges I faced and had to resolve, including how to successfully run npm install in the guest environment:
Laravel Homestead for Windows (includes fixes)

prograhammer
  • 20,132
  • 13
  • 91
  • 118
0

You should first install node in your local machine.

Then, navigate to your project folder and delete node_modules directory.

Run on your local machine inside project directory:

npm install gulp --save-dev
Alex Kyriakidis
  • 2,861
  • 1
  • 19
  • 28
  • No this won't work. One reason is that the file paths are too long for Windows. Then you have to consider some installs use symlinks. – prograhammer Jun 24 '15 at 13:03
  • I had the same problem and this was the solution. – Alex Kyriakidis Jun 24 '15 at 13:08
  • I encountered issues like posted here: https://harvsworld.com/2015/how-to-fix-npm-install-errors-on-vagrant-on-windows-because-the-paths-are-too-long/. If you aren't having problems running `npm install` from your host environment then there's no fuss. But I do have a Gist I made (see my answer) that will help if you if you get to a point where you need it installing inside the guest. :-) – prograhammer Jun 24 '15 at 13:59