Code Monkey home page Code Monkey logo

Comments (5)

geerlingguy avatar geerlingguy commented on May 17, 2024

Oops! I'll have to fix that. The best way to get it installed in the mean time is with:

nodejs_npm_global_packages:
  - forever

Or with a version:

nodejs_npm_global_packages:
  - name: forever
    version: 0.15.3

from ansible-for-devops.

mattjmcnaughton avatar mattjmcnaughton commented on May 17, 2024

Thanks for the quick response! Unfortunately, I tried adding this variable to provision.yml, and I'm still getting the same error message. When I ssh'd to the vagrant machine with vagrant ssh, I noticed that forever was available when I was running as the vagrant user, but not when I was root. And if I'm understanding correctly, the ansible playbook runs as root. But I thought that installing the package globally would have also installed it for root?

Thanks for your help :)

from ansible-for-devops.

geerlingguy avatar geerlingguy commented on May 17, 2024

@mattjmcnaughton - I'm taking a look at this now.

from ansible-for-devops.

geerlingguy avatar geerlingguy commented on May 17, 2024

Yeah, in this case it looks like there's some extra trickery going on to get forever into the path /usr/local/lib/npm/bin/forever, and when I use sudo it's not in my path.

Two options are to:

  1. Doubly ensure that global packages are installed under the sudo user (in which case it goes to /usr/bin/forever and is accessible everywhere) (maybe there's a bug in my role?)
  2. Run the app deployment as the ansible_ssh_user instead of using sudo/become.

from ansible-for-devops.

geerlingguy avatar geerlingguy commented on May 17, 2024

@mattjmcnaughton - Aha! It looks like I had to set the following vars:

    nodejs_install_npm_user: root
    npm_config_prefix: "/usr"
    nodejs_npm_global_packages:
      - forever

Because that new config prefix is the parent directory inside which Node.js' global installs will be in the bin. Pushing up a fix soon, and I'll fix it in the book as well.

from ansible-for-devops.

Related Issues (20)

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.