react-native-slider icon indicating copy to clipboard operation
react-native-slider copied to clipboard

Postinstall copy of readme should be removed

Open DomiR opened this issue 1 year ago • 2 comments

This will run on yarn install for consumers of this library. Instead of postinstall we should use prepack.

https://github.com/callstack/react-native-slider/blob/8619daf7518c24ff7fdcfced73111d7dd856f727/package/package.json#L22

I'm getting:

error PROJECT_DIR/node_modules/@react-native-community/slider: Command failed.
Exit code: 254
Command: npx copyfiles "./../README.md" ./README.md
Arguments: 
Directory: PROJECT_DIR/node_modules/@react-native-community/slider
Output:
npm ERR! code ENOENT
npm ERR! syscall lstat
npm ERR! path USER_DIR/.node_modules_global/lib
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, lstat 'USER_DIR/.node_modules_global/lib'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

DomiR avatar Sep 20 '22 08:09 DomiR

Okay, this is weired. I'm only having this issue with node@18 after switching via fnm. I guess the command usually silently fails/runs (as no Readme is there to be copied). I guess this issue can be closed, but probably using prepack instead of postinstall is still the better option in either case.

Dockerfile demonstates issue:

FROM node:18-alpine
WORKDIR /app
# disable npx
RUN mv /usr/local/bin/npx /usr/local/bin/npx.bak
RUN yarn add @react-native-community/slider

DomiR avatar Sep 20 '22 09:09 DomiR

Hello @DomiR, thanks for taking the time to report and summarize! 👍 Of course, having this as postinstall is not the best idea - let's have it any other way, and there are at least two of them: prepack or some simple custom step to be launched manually on demand. Let me keep this open so it won't be forgotten to be handled. Thanks again!

BartoszKlonowski avatar Sep 20 '22 09:09 BartoszKlonowski

👋 any way to overcome this? basically it prevents me to run yarn :( 🙏

rborn avatar Sep 27 '22 14:09 rborn