Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix running npm package forever in chapter 4 #573

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Lukas-dev-threads
Copy link

This change was also done in the manuscript repo geerlingguy/ansible-for-devops-manuscript#6

On some systems the path to the binary of the npm package 'forever' might not be /usr/local/bin/forever.

I am currently using a virtual machine running Debian 12.
I installed nodejs 20 with this role https://github.com/geerlingguy/ansible-role-nodejs
and forever based on the example from the book:

  - name: Ensure Forever is installed.
    npm:
      name: forever
      global: yes
      state: present

The examples in the book for running "forever" did not work because it seems that in my case the binary is not located at /usr/local/bin/forever.

I think this can be solved by using npx to run the command instead.
It should work on any system regardless where npm chooses to install the binary.

I verified the change in my setup and I can access the nodejs app and am seeing "Hello World!" as expected.

Happy New Year !

This addresses an issue in the nodejs example of chapter 4.
On some systems the path to the binary of the npm package 'forever'
might not be `/usr/local/bin/forever`.
Fixed by instead using `npx` to run it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant