DutchKevv
DutchKevv

Reputation: 1699

NPM local module - dependencies are not installed when using npm install from 'host package.json'

Many of the same questions have been asked before link, but none give a solid answer or are very outdated, so just asking again.

I have a package.json with a local npm module:

{
  "dependencies": {
    "local_module": "file:..pathtomodule"
  }
}

when i run npm i for the host package, the local module is installed, but modules from the local_module are not installed. So I have to run a separate npm i for the local_module.

What am i doing wrong?? isn't it just a module??

p.s. why am i getting minus for the question? please explain so I can improve

thanks in advance

Upvotes: 5

Views: 1159

Answers (1)

Rodrigo Proença
Rodrigo Proença

Reputation: 43

What I use to do in that case is to "force" dependencies to be "npm installed" using preinstall script in the root module:

   {
      "dependencies": {
        "local_module": "file:..pathtomodule"
      },
      "scripts": {
        "preinstall": "npm install ..pathtomodule"
      }
    }

Upvotes: 1

Related Questions