npm: exec in context? Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of npm: exec in context? without wasting too much if your time.

The question is published on by Tutorial Guruji team.

I would like to exec what can be executed by scripts in npm.

For example I have a vue-press installed and I would like to exec vuepress eject. In my scripts I can see vuepress is accessible, but I don’t have a script for eject:

  "scripts": {
    "dev": "vuepress dev docs",
    "build": "vuepress build docs"
  "license": "MIT",
  "devDependencies": {
    "vuepress": "^1.3.1",
    "@vuepress/plugin-back-to-top": "^1.3.1",
    "@vuepress/plugin-medium-zoom": "^1.3.1"

So I could create a script for one use or use whatever command npm exec. I am looking for the latter solution.


In the docs it states the following about executables:

Note: Bold emphasis added by me.

When in global mode, executables are linked into {prefix}/bin on Unix, or directly into {prefix} on Windows.

When in local mode, executables are linked into ./node_modules/.bin so that they can be made available to scripts run through npm. (For example, so that a test runner will be in the path when you run npm test.)

So, given your requirement you can:

  1. cd to your project directory.

  2. Then run the following command:

    ./node_modules/.bin/vuepress eject
We are here to answer your question about npm: exec in context? - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji