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?

4

2 回答 2

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)

于 2015-03-05T01:28:28.333 回答
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
于 2015-06-24T02:42:45.190 回答