Skip to content

[BUG] npm install script not working when I run npm install as dependency #3056

@jfoclpf

Description

@jfoclpf

Current Behavior:

npm install script defined in package.json not running when I do npm install <packg> to install <packg> as dependency

Expected Behavior:

npm install command should run install script

Steps To Reproduce:

I created a npm package named cordova-import-npm with this script portion in package.json:

  "scripts": {
    "install": "echo \"HI THERE\""
  },

When I run npm install . inside the root of the package it works

$ npm i .

> cordova-import-npm@1.0.10 install
> echo "HI THERE"

HI THERE

up to date, audited 231 packages in 1s

48 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

But when I install as dependency on another package, the script is not run

$ mkdir test/ && cd test/
$ npm init
$ npm install cordova-import-npm

up to date, audited 11 packages in 2s

found 0 vulnerabilities

I'm using the latest version of npm 7.9.0

Environment:

  • OS: Ubuntu 18.04
  • Node: 14.6.1
  • npm: 7.9.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next stepsRelease 7.xwork is associated with a specific npm 7 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions