Code Monkey home page Code Monkey logo

vagrant-node's Introduction

learning-nodejs-passport

A MEAN (Mongo, Express, Angular and Node) stack development box for Vagrant.

Vagrant

The Vagrant file and associated scripts create a dev environment for creating and running MEAN stack applications. The bootstrap and bootstrap-npm scripts are run during provisioning and install required packages (mongo, node etc) as well as configure npm (installing packages and fixing permissions problems).

Npm's node_modules folder is a problem for Vagrant running in a cygwin host: it requires symbolic links and also very long full path names. To circumvent this problem, we create the node_modules folder in the guest os user folder (/home/vagrant) and link to it from the web app folder. This requires symbolic links to be enabled for VirtualBox - acheived with a configuration option in the Vagrantfile. However, this requires the 'vagrant up' command to be executed from an administrator-level shell instance on the host machine.

To launch the cygwin or cmd shell as administrator under Windows, right click on the shell executable or shortcut and select "Run as Administrator".

Presumably 'sudo vagrant up' would be sufficient on a Linux host OS.

To prepare a folder for use with npm under a Windows host OS, run the script 'npm-prepare' from within that folder. (npm-prepare is installed to /usr/local/bin during provisioning.) npm-prepare will create a node_modules folder in a unique subfolder of ~/node_modules_share and create a symlink from the current folder. Subsequent execution of 'yo' or 'npm install' will write to that folder, circumventing the host filesystem limitation on path lengths. npm-prepare should not be necessary for a Linux host OS.

Other configuration

Note that Grunt needs to be configured to run the server on 0.0.0.0 instead of localhost. This configuration option will be put in Gruntfile.js of each web apps folder. Eg.

express: {
    options: {
      port: process.env.PORT || 8000,
      ip: '0.0.0.0',
    },
    ...

or

connect: {
  options: {
    port: 8000,
    hostname: '0.0.0.0'
    ...

depending on the type of app.

Mongo DB

One may want to start mongo db with a command like:

vagrant-node's People

Contributors

adamarthurryan avatar

Stargazers

Vitali M. avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.