[BUG] Prepare script not running on global install from repo
Is there an existing issue for this?
- [X] I have searched the existing issues
This issue exists in the latest npm version
- [X] I am using the latest npm
Current Behavior
Installing globally -g from repo results in link to deleted temp folder and no installation files.
npm install -g github:ssffnet/npm-global-install-bug.git
# check for install files but find link instead
ls -la ~/.nvm/versions/node/v16.13.1/lib/node_modules
lrwxrwxrwx 1 ......51 Dec 9 18:20 global-prepare-bug -> ../../../../../../.npm/_cacache/tmp/git-clonepo3KRt
# check for this temp folder - nothing
ls ~/.npm/_cacache/tmp
<nothing>
Really simple package.json that only creates a text file when prepare runs - no dependencies
{
"name": "global-prepare-bug",
"version": "1.0.0",
"description": "Global npm install from repo fails to run prepare script.",
"main": "hello.js",
"scripts": {
"prepare": "echo prepare > prepare.executed.txt"
},
"license": "ISC"
}
Expected Behavior
prepare script to run as with npm 6.x:
After install:
ls ~/.nvm/versions/node/v14.18.2/lib/node_modules/global-prepare-bug
hello.js package.json prepare.executed.txt
Steps To Reproduce
on node 16.13.1, npm 8.2.0, Ubuntu 18.04 LTS
- install simple package globally from repo
npm install -g github:ssffnet/npm-global-install-bug.git
- check install folder
ls -la ~/.nvm/versions/node/v16.13.1/lib/node_modules
- expect to see
hello.js package.json prepare.executed.txt
- instead see broken link and no files
global-prepare-bug -> ../../../../../../.npm/_cacache/tmp/git-clonepo3KRt
Environment
- npm: 8.2.0
- Node: 16.13.1
- OS: Ubuntu 18
- platform: Linux 5.4.0-1064-azure 67~18.04.1-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux
- npm config:
; node bin location = /home/foo/.nvm/versions/node/v16.13.1/bin/node
; cwd = /home/foo/.nvm/versions/node/v16.13.1/lib/node_modules
; HOME = /home/foo
; Run `npm config ls -l` to show all defaults.
any updats, it's a long time bug!
Can you try npm 8 latest?
Can you try npm 8 latest?
I tried the latest npm 8.16.0, the bug still exists.
From my invetigation (a while ago), this bug was introduced in v8.5.2. Sorry I don't recall the specifics. I've been instructing my users to roll back to [email protected] before installing my package.
EDIT: Possibly related: https://github.com/npm/cli/issues/3692