Search code examples
jsonnode.jsvagrantvagrantfilesalt-project

Vagrant (Saltstack) how to install package.json with salt state?


I want to install my environment with vagrant "vagrant up". I made code to install modules but I want to install package.json files and how? my modules installer code looks like that:

mongodb:
  pkg:
    - installed
  service:
    - running

nodejs:
  pkg:
    - installed

npm:
  pkg:
    - installed

git:
  pkg:
    - installed

build-essential:
  pkg:
    - installed

bower:
  npm:
    - installed

nodemon:
  npm:
    - installed

Solution

  • There is a state for that npm.bootstrap

    Ex:

    my-deps:
      npm.bootstrap:
        - name: /vagrant
        - user: vagrant
        - require:
          - pkg: nodejs
    

    this

    will execute npm install --json on the specified directory