npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

Can't run executable script when installing local packages

In order to demonstrate my problem, i’ve created a minimal reproduction respository which you can clone from https://github.com/sqal/playground1 and here’s my issue

Steps to reproduce

What is expected?

I expect executable script from the package @project/service located in packages/service to run correctly

What is actually happening?

I get this error instead:

's' is not recognized as an internal or external command,

My understanding is that the script does not work currently not because there’s no executable script s in the apps/app1/node_modules/.bin, but why npm did not create this file during npm install? is it because @project/service is listed the root package.json and is hoisted in the root node_modules (which is what I want btw)? I also tried to run this script using a relative path to the root node_modules like this:

"serve": "../../node_modules/.bin/s"

But this time, I got another error

> ../../node_modules/.bin/s

'..' is not recognized as an internal or external command,

which is very weird, because path is correct and the script is definitely in root node_modules/.bin folder. I would appreciate if someone could give more details on why I can’t execute this serve command and what is the right way to fix it. Thanks.


If you’re using Windows, the path to the executable probably isn’t recognised as such due to Windows having a different path syntax (instead of / they use \). So instead of seeing a path it sees .. as a command because / probably isn’t allowed in command names.


The install at the parent level does not cause an install to run in the apps folders. When you run npm from ./apps/app1 it is in a folder with a package.json but the directory is bare, so s is not known.

(app1 has been installed to ./node_modules/@project/app1, but that is also different than running npm install in app1.)

This hopefully shows the issue, without guessing what you were intending to happen:

$ npm install
$ cd apps/app1
$ npm run --silent serve
sh: s: command not found
$ npm install
$ npm run --silent serve
Service /Users/john/Documents/Sandpits/playground1/apps/app1 []