Is there a way to run npm scripts that have only been installed using --save-dev
using the terminal? Currently, I add a script to the scripts
section within the package.json
and then run npm run myscriptname
. This works, but is there a more direct way without the entry in package.json
?
EDIT:
In my example I use lerna
to multiple packaging. To initialize the lerna repository
the following steps are necessary:
mkdir LernaProject
cd LernaProject
git init
npm init
npm install lerna --save-dev
Now I want to run lerna init
, but I don't know how or if it is possible to run that directly due to my local install with --save-dev
and not with -g
. Hence, I add an entry in the package.json
:
{
...
"scripts": {
"lerna:init": "lerna init"
}
...
}
And then I run that entry:
npm run lerna:init