Skip to content
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

[BUG] Cannot work on FAT32 USB drive #4558

Open
2 tasks done
szatanjl opened this issue Mar 12, 2022 · 2 comments
Open
2 tasks done

[BUG] Cannot work on FAT32 USB drive #4558

szatanjl opened this issue Mar 12, 2022 · 2 comments
Labels
Enhancement new feature or improvement Release 8.x work is associated with a specific npm 8 release

Comments

@szatanjl
Copy link

szatanjl commented Mar 12, 2022

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

I have started a react-native project. But instead of keeping files on hard drive I wanted to keep everything on a USB drive. I have formated it to FAT32. And so problem starts.

npm install by default creates symlinks to binaries in node_modules/.bin/, but FAT32 does not support symlinks. So running npm install fails. Searching/googling around the internet the only thing I have found is to add --no-bin-links argument. Unfortunatelly that does not solve anything. Yes npm install works, but everything after that fails. Running npx react-native for example ends with error that command cannot be found. Which is to be expected - there is no node_modules/.bin/ because of --no-bin-links.

I decided to look around the code of npm for solutions. I have found that there is a special case made for Windows to create shims (shell, powershell, cmd files) instead of symlinks (look node_modules/bin-links/lib/link-bins.js line 4. And also I found that I can cheat this isWindows check using env variable __TESTING_BIN_LINKS_PLATFORM__ (look node_modules/bin-links/lib line 1).

And so for now I have added export __TESTING_BIN_LINKS_PLATFORM__=win32 to my env and this way I have tricked npm into creating shell scripts instead of symlinks, and it works perfectly. I can npm install onto FAT32 USB drive. I can run npx <commands> no problem.

But that is a hack/workaround, not a proper solution.

Expected Behavior

I would suggest to add new argument to npm install command. Something along the lines --prefer-bin-shims that would then make npm create shell scripts instead of symlinks on Linux systems. The code for making those shell scripts is already there, and it works perfectly on my setup. The only thing missing is a command line option.

Steps To Reproduce

  1. Format USB drive to FAT32
  2. Copy some react-native project into USB drive
  3. Run npm install
  4. Fail... Cannot create symlinks
  5. Run npm install --no-bin-links
  6. Success, but...
  7. Run npx react-native
  8. Fail... Command not found

Environment

  • npm: 8.5.4
  • Node.js: 17.7.1
  • OS Name: Arch Linux
  • System Model Name: -
  • npm config:
; "user" config from /home/szatan/.npmrc

cache = "/tmp/szatan/npm"
prefix = "/tmp/szatan/.npm"

; node bin location = /usr/bin/node
; cwd = /home/szatan
; HOME = /home/szatan
; Run `npm config ls -l` to show all defaults.
@szatanjl szatanjl added Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release labels Mar 12, 2022
@wraithgar wraithgar added Enhancement new feature or improvement Agenda will be discussed at the Open RFC call and removed Needs Triage needs review for next steps Bug thing that needs fixing labels Mar 14, 2022
@darcyclarke darcyclarke removed the Agenda will be discussed at the Open RFC call label Apr 20, 2022
@dreemurgithub
Copy link

dreemurgithub commented Feb 3, 2024

Hey, I have an external FAT32 HDD drive on my Ubuntu, and I have some similar problems. Npm install not work on FAT32
At first I find that npm install $Something --no-bin-links did work, but it seem to be kinda easy to forget.
And then I try to see if some sort of option of no-bin-links exist, so I type npm config ls -l
Then the option bin-links = true appear in the list, so I should just set it to false to test.
Now type npm config set bin-links false
And now npm Install in my external hard drive FAT32 work, but I'm still a novice so it would be nice if someone tell me if there is some source of consequences. But for now it work.

And before that I did set the globalconfig to "media/$MY_NAME/$HDD_Drive_name" , but i'm not sure if that is really neccessary, just document the stuff I did.

@GirishBhutiya
Copy link

I also faced the same issue on exFAT SSD. Is there any solution for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement new feature or improvement Release 8.x work is associated with a specific npm 8 release
Projects
None yet
Development

No branches or pull requests

5 participants