You need to start virtualbox like an admin and the bash or shell too.
Thanks, but where in the Vagrantfile do I need to put the line config.vm.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"] ?
I'm still getting errors like above
You don't put it in the Vagrantfile, but in scripts/homestead.rb like so:
config.vm.provider "virtualbox" do |vb|
vb.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]
...
end
Also, for NPM, keep in mind that the max length for folder names on Windows is still applicable if you're in a shared folder, which your application will be. This restriction will most likely be reached when installing your node modules in your application root. A workaround is to install your dependencies outside a shared folder and then symlink that folder to node_modules in your application root.
Node is normally a pain to work with on Windows, but this little trick works great. Here's a little bash function that automates all of this:
donpm()
{
SITE=${1:-"default"}
if [ ! -d "/usr/local/npm/$SITE" ]; then
sudo mkdir -p /usr/local/npm/$SITE
fi
if [ ! -f "/usr/local/npm/$SITE/package.json" ]; then
sudo cp -f /var/www/$SITE/package.json /usr/local/npm/$SITE/
fi
cd /usr/local/npm/$SITE
sudo npm install
if [ ! -L "/var/www/$SITE.com/node_modules" ]; then
sudo ln -s /usr/local/npm/$SITE/node_modules /var/www/$SITE/node_modules
fi
}
You can stick this function into your .bash_aliases file in /home/vagrant and then alias it with this at the end of .bash_aliases:
alias winpm=donpm
You can then call it like so on the command line:
winpm homestead.app
This assumes that your application root is at /var/www/homestead.app/, so you might have to adjust the paths in the bash function for it all to work smoothly.
Thanks very much for that, shabushabu.
I think I'm out of my depth, after the bit about homestead.rb most of your post went over my head. I know nothing about node, grunt, bower, npm, bash scripts etc. Using your info and bits of info gleaned from various places I did the following:
ln -s /usr/local/npm/angular-phonecat/node_modules Code/angular-phonecat/node_modules
angular-phonecat is the tutorial project on the angularJS website (on a whim I thought I'd learn angularjs, which has lead me to here...) and it comes with stuff that "npm install" is meant to set up for you. After running "sudo npm install --no-bin-links" in home/vagrant/Code/angular-phonecat I got the following error:
npm ERR! EEXIST, mkdir '/home/vagrant/Code/angular-phonecat/node_modules'
File exists: /home/vagrant/Code/angular-phonecat/node_modules
Move it away, and try again.
How do I get the npm install command to put the stuff over in the /usr/local/npm/angular-phonecat/node_modules directory?
This maybe more unhelpful than helpful to anyone as confused as me but just in case here are the steps I took to get this working on homestead & windows 7. I'm sure shabushabu's method is more sensible but I didn't understand it!
create a directory inside homestead rather than in the shared folders where you can have another directory for any app you want to run. In my case I'm trying to use the AngularJS tutorial project so I copied that into this new directory.
** sudo npm install ** will create a node_modules in /usr/local/npm/angular-phonecat/. I think it uses the packages.json file provided with the tutorial for this purpose.
Bower wasn't installed for me, I had to do it separately afterwards. It will create /usr/local/npm/angular-phonecat/app/bower_components
The new node_modules directory can then be linked to the other application in the shared directory and /usr/local/npm/angular-phonecat/app/bower_components can be copied to Code/angular-phonecat/app/
Now everything seems to be working now...
Looks like you copied your whole application into the /usr/local/npm/angular-phonecat folder. All you really need is the package.json file, so you can then run npm install in there, but essentially you did everything my little function does. Just manually. The function is just a convenient shortcut.
Also, cause Bower doesn't generate this huge nested folder structure, it's not normally necessary to install Bower packages outside your application.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community