-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Fix npm install #1220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Fix npm install #1220
Conversation
There seems to have been a hiccup when refactoring the temp dir for NPM. See how [the tempDir variable](coreybutler@7de073e#diff-c4d480f687d74c39997fc58e33d300c73cfb458321c2ab26c765772db70a679eL498) was modified -- the line to unzip then proceeds to unzip from the wrong location. This should solve coreybutler#1209 -- untested.
hope review asap |
Can confirm this fixes the issue of npm not being downloaded because it doesn't recognize the temporary folder. Built the source myself with this code to confirm. Thank you kiwkwag. |
like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I've mentally followed the code paths up to Line 799. I also compared a3ce311 to 7de073e for good measure. See https://diffy.org/diff/a336cbca25d7f.
For reviewers' convenience, the filesystem structure of the root
directory:
> tree /F nvm-install-1862240460
Folder PATH listing for volume Blade 17
Volume serial number is B0CE-64DF
C:\USERS\NOAH\APPDATA\LOCAL\TEMP\NVM-INSTALL-1862240460
├───temp
│ npm-v6.14.11.zip
│
└───v14.16.0
│ node64.exe
│
└───node_modules
Points of interest in which filesystem paths matter:
- L671:
root
is assignedos.MkdirTemp("", "nvm-install-*")
.- Example:
%TEMP%\nvm-install-1862240460\
.
- Example:
- L741:
web.GetNpm(root, getNpmVersion(version))
downloads the NPM ZIP tofilepath.Join(root, "temp", "npm-v"+npmv+".zip")
- Example:
%TEMP%\nvm-install-1862240460\temp\npm-v6.14.11.zip
.
- Example:
- L746:
tempDir
is assignedos.MkdirTemp("", "nvm-npm-*")
.- Example:
%TEMP%\nvm-npm-0123456789\
- Example:
- L759:
tempNpmBin
is assignedfilepath.Join(tempDir, "nvm-npm", "cli-"+npmv, "bin")
, but "cli-" will be replaced with "npm-" for NPM <6.2.0 (at L763).- Examples:
- if NPM >= 6.2.0:
%TEMP%\nvm-npm-0123456789\nvm-npm\cli-6.2.0\bin\
- if NPM < 6.2.0:
%TEMP%\nvm-npm-0123456789\nvm-npm\npm-6.1.0\bin\
- if NPM >= 6.2.0:
- Examples:
- L772-L779: the
npm
,npm.cmd
,npx
, andnpx.cmd
files are moved fromtmpNpmBin
to${root}\v${version}
whereinversion
is the Node.js version` - L781-L785,
npmSourcePath
is assignedfilepath.Join(tempDir, "nvm-npm", "npm-"+npmv)
, wherein "npm-" may be replaced with "cli-". - L787:
npmSourcePath
is moved (renamed) tofilepath.Join(root, "v"+version, "node_modules", "npm")
- L800:
filepath.Join(root, "v"+version)
(Node.js + NPM) is moved toenv.root
and the installation is complete.
Just ran into this bug and it killed my vibe for nearly a whole day. Thanks for submitting the patch! |
Hey @BinToss, thanks for the review. Can you please instruct me how to proceed to get this merged? |
Now we wait for a maintainer to approve a review. Third parties can submit reviews, but cannot submit Approval reviews. |
🆘 |
Any update on this? The PR has been open since 5 months. |
This PR won't be used because the fix is more involved than a one-liner. I've already completed the work, but the release is held up by the arm64 build. GitHub recently added support for this in GitHub Actions, but I've exceeded the maximum GitHub Actions minutes with other projects over the last two months. I anticipate getting this build process complete this month, but my primary focus has been on Author/Runtime (the successor to this project). Please remember, I am the only person doing any reviews/support on this. My time is finite and my primary focus is on what's next (because I'm as tired of the slow update cycles as everyone else is). I appreciate everyone's understanding. |
There seems to have been a hiccup when refactoring the temp dir for NPM. See how the tempDir variable was modified -- the line to unzip then proceeds to unzip from the wrong location. This should solve #1209 -- untested. Need to make sure that the rest of the flow works...