Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8365405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:38:58+00:00 2026-06-09T12:38:58+00:00

I think npm install|update works when requiring dependencies in source files, but when I

  • 0

I think npm install|update works when requiring dependencies in source files, but when I want to run an executable, like nodemon, it doesn’t appear to work. Is it trying to look for the file globally? How can I make these commands look in node_modules first?


I have a Cakefile that starts the dev server with nodemon. For example:

# **`procExec(procName)`**
# returns the path to executable in `node_`
procExec = (procName) -> 
    console.log "./node_modules/" + procName + "/bin/" + procName
    "./node_modules/.bin/" + procName

# **`cake startdev`**
# Starts the server with `nodemon`
# Watch and compile `.coffee` and `.styl` files in `/client`

task "startdev", "Starts server with nodemon and watch files for changes", ->
    # start nodemon server
    nodemon = spawn procExec("nodemon"), ["server.coffee"]
    processOutput nodemon

    # watch and compile CoffeeScript
    coffee = spawn procExec("coffee"), ["-o", "public/js/app", "-cw", "client/coffee"]
    processOutput coffee

    # watch and compile Stylus
    stylus = spawn procExec("stylus"), ["client/stylus", "-l", "-w", "-o", "public/css/app"]
    processOutput stylus

It works but with a few minor problems:

  • npm install|update doesn’t seem to install nodemon. I think it tries to install globally and fails. I manually did a npm install nodemon separately. Why is this? And how can I tell nodemon to install anyway?
  • Does "./node_modules/.bin/" + procName always resolve to the correct executable?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T12:39:00+00:00Added an answer on June 9, 2026 at 12:39 pm

    There’s a few questions in here, so I’ll try and keep them separated.

    npm install|update doesn’t seem to install nodemon. I think it tries to install globally and fails. I manually did a npm install nodemon separately. Why is this? And how can I tell nodemon to install anyway?

    Did you see a warning about “prefer global install”? If that’s the case it was just a warning and it would’ve been installed anyways. If it was a different error please include the output.

    Does “./node_modules/.bin/” + procName always resolve to the correct executable?

    Yes, any scripts listed in the package.json files of your dependencies will be installed to this folder. However, I much prefer using the npm bin command to always get the correct path.

    If you are spawning processes from node, you can also require('npm') and modify process.env.PATH to get the correct node_modules/.bin in place. E.g. at the top of your Cakefile:

    npm = require 'npm'
    npm.load (err) -> throw err # If config fails to load, bail out early
    process.env.PATH = npm.bin + ":" + process.env.PATH
    # Now you no longer need to use procExec in your tasks
    

    disclaimer I don’t know if modifying PATH like that will work on windows.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to install packages locally, but npm is always installing packages to the
Think I have an integer array like this: a[0]=60; a[1]=321; a[2]=5; now I want
Think of a small and basic affiliate system. I want an URL like www.myshop.com/mynewproduct.html?afid=123
I think I have a basic understanding of this, but am hoping that someone
I think everyone knows this site http://pinterest.com/ and I don't want to create site
I think this could be a very easy question for you. But I have
Think about the games like Spiral Knights and Minecraft(Which I believe both use LWJGL)
I think that asking this might be kind of silly but I'm still wondering
Think tic-tac-toe. You are creating the buttons in rows and columns and you want
Think that I have many activities,and all I want is this: I have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.