Is there an existing issue for this?
This issue exists in the latest npm version
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
- Format USB drive to FAT32
- Copy some react-native project into USB drive
- Run
npm install
- Fail... Cannot create symlinks
- Run
npm install --no-bin-links
- Success, but...
- Run
npx react-native
- 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.
Is there an existing issue for this?
This issue exists in the latest npm version
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 installby default creates symlinks to binaries innode_modules/.bin/, but FAT32 does not support symlinks. So runningnpm installfails. Searching/googling around the internet the only thing I have found is to add--no-bin-linksargument. Unfortunatelly that does not solve anything. Yesnpm installworks, but everything after that fails. Runningnpx react-nativefor example ends with error that command cannot be found. Which is to be expected - there is nonode_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__(looknode_modules/bin-links/libline 1).And so for now I have added
export __TESTING_BIN_LINKS_PLATFORM__=win32to my env and this way I have tricked npm into creating shell scripts instead of symlinks, and it works perfectly. I cannpm installonto FAT32 USB drive. I can runnpx <commands>no problem.But that is a hack/workaround, not a proper solution.
Expected Behavior
I would suggest to add new argument to
npm installcommand. Something along the lines--prefer-bin-shimsthat 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
npm installnpm install --no-bin-linksnpx react-nativeEnvironment