-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Closed
Labels
Bugthing that needs fixingthing that needs fixingPriority 1high priority issuehigh priority issueRelease 7.xwork is associated with a specific npm 7 releasework is associated with a specific npm 7 release
Description
Current Behavior:
npm uninstall -g <package>
doesn't run the preuninstall
script
Also, npm install -g <package>
doesn't run the preuninstall
script from the previously installed version of the same package
Installing a newer version of a global package does trigger preuninstall
in v6
Expected Behavior:
npm uninstall -g <package>
should run the preuninstall
script
Steps To Reproduce:
Since npm7 removed console output for scripts during installation, so I echo something to a logfile instead.
- Create a package with these scripts:
{
"name": "testpackage",
"version":"0.0.1",
"scripts": {
"preinstall": "echo \"preinstall\" >> /logs/log.txt",
"preuninstall": "echo \"preuninstall\" >> /logs/log.txt"
}
}
- run
npm pack
- run
npm install -g ./testpackage-0.0.1.tgz
- run
npm install -g ./testpackage-0.0.1.tgz
again (this should have triggeredpreuninstall
for the previous installation) - run
npm uninstall -g testpackage
- confirm that the text file in /logs/log.txt does in fact not contain any 'preuninstall' lines
Environment:
- OS: Windows 10
- Node: 15.14.0
- npm: 7.7.6
RussCoder, NilsYseboodt, ryansonshine and githoniel
Metadata
Metadata
Assignees
Labels
Bugthing that needs fixingthing that needs fixingPriority 1high priority issuehigh priority issueRelease 7.xwork is associated with a specific npm 7 releasework is associated with a specific npm 7 release