Conversation
|
I am not sure I follow the fix. Line 141 is used only on NPM >= 7. At this version, NPM has changed how it passes over Could you do more research on that? |
|
Thanks for your quick response.
According to the document from here, it seems that I will do some more research on this. I will update my result soon in this issue. |
|
After some experiments, this issue only occurs on Yarn v2. I built a repository to reproduce this issue, you can run the following command to check more details. $ docker ps # make sure that the docker is running
$ git clone https://github.com/ocavue/node-re2-cache-issue
$ cd node-re2-cache-issue
$ make run > result.log
$ cat result.logI test some package managers and the result is as below:
BTW, I also collect all environment variables for these four tools when they run To summarize, Yarn v2 needs to recompile This PR should be able to fix this issue since all four package manager provided the correct |
|
@uhop Hi. Is there anything I can do to push forward this PR? Thanks in advanced. |
|
yarn v2 is not released yet. My understanding is that it breaks the npm convention of using Your fix relies on yarn --cwd zzz node show.jsAnd it prints the name of the parent directory, which is normal behavior for a shell. My point is that npm solves this problem by setting environment variables. To read up on
PS: yarn v1 emulates npm <= 6. Interesting to see what yarn v2 does. |
|
That's what I see in my console with npm v7: $ npm run show
> show
> node show.js
npm_command run-script
npm_config_cache /home/eugene/.npm
npm_config_globalconfig /home/eugene/.nvm/versions/node/v15.5.0/etc/npmrc
npm_config_init_module /home/eugene/.npm-init.js
npm_config_metrics_registry https://registry.npmjs.org/
npm_config_node_gyp /home/eugene/.nvm/versions/node/v15.5.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js
npm_config_prefix /home/eugene/.nvm/versions/node/v15.5.0
npm_config_user_agent npm/7.3.0 node/v15.5.0 linux x64
npm_config_userconfig /home/eugene/.npmrc
npm_execpath /home/eugene/.nvm/versions/node/v15.5.0/lib/node_modules/npm/bin/npm-cli.js
npm_lifecycle_event show
npm_lifecycle_script node show.js
npm_node_execpath /home/eugene/.nvm/versions/node/v15.5.0/bin/node
npm_package_json /home/eugene/Work/temp/zzz/package.json
npm_package_name zzzyarn v2: $ yarn run show
npm_config_user_agent yarn/2.4.0 npm/? node/15.5.0 linux x64
npm_execpath /tmp/xfs-22a53eee/yarn
npm_lifecycle_event show
npm_node_execpath /tmp/xfs-22a53eee/nodeI would suggest to go to yarn v2 project and file a request to add |
yarn v2 is released. However, since it breaks so many things from v1 (this issue itself is an example 😂 ), the yarn teams encourage users to install yarn v1 globally and enable yarn v2 for each project.
I agree.
There is already an issue in the Yarn v2 repository about this: yarnpkg/berry#1659. It seems that the yarn team doesn't want to add these environment variables to yarn v2.
I agree with this view that I was wondering if there was some way to have |
|
I have two new proposals (or vague ideas) that don't depend on a special package manager or a special operating system. proposal 1Use Node'js It seems that this method is not affected by proposal 2Explicitly pass the version and github repository position to @uhop Do you have any ideas? |
Oops. 8-0 |
|
I am leaning towards the "proposal 2" direction + your PWD fix. The latter can generate false negatives, but it is okay because in the worst case we will rebuild. Let me meditate on that and do some experiments. |
|
this is the env for yarn v3.1 YARN_VERSION=3.1.0
HOME=/home/user
OLDPWD=/test
PATH=/tmp/xfs-c76d2d0c:/home/user/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/test/a/node_modules/re2
COREPACK_ROOT=/home/user/corepack/0.10.0/lib/node_modules/corepack
BERRY_BIN_FOLDER=/tmp/xfs-c76d2d0c
INIT_CWD=/test/a
PROJECT_CWD=/test/a
npm_execpath=/tmp/xfs-c76d2d0c/yarn
npm_node_execpath=/tmp/xfs-c76d2d0c/node
npm_package_name=re2
npm_package_version=1.0.0
npm_config_user_agent=yarn/3.1.0 npm/? node/16.15.0 linux x64
npm_lifecycle_event=installtrimed some unrelated env vars |
|
can we have this fix until yarn has a proper fix :-/ as this is blocking all our projects using re2, because we can't have (and don't want) python to rebuild |
|
It looks like Yarn has the fix. |
I'm using Yarn and I found that Yarn has to rebuild
node-re2every time in the CI pipeline. The reason is that Yarn doesn't provide the environment variablenpm_package_json. In this PR, I use the environment variablePWDto support Yarn (and also other package managers).