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

The extend-node-path option does not appear to behave like false, on pnpm7 #5285

Closed
WhiteKiwi opened this issue Aug 31, 2022 · 4 comments · Fixed by #5290
Closed

The extend-node-path option does not appear to behave like false, on pnpm7 #5285

WhiteKiwi opened this issue Aug 31, 2022 · 4 comments · Fixed by #5290
Milestone

Comments

@WhiteKiwi
Copy link
Sponsor Contributor

WhiteKiwi commented Aug 31, 2022

I went through node-path issues at pnpm6.
It was solved by giving the extend-node-path option to false.
During the pnpm7 migration, we encountered the same issue.

pnpm version:

7.9.4

Code to reproduce the issue:

When I exec node_modules/.bin/jest, then NODE_PATH is exported

Expected behavior:

#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")

case `uname` in
    *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac

- if [ -z "$NODE_PATH" ]; then
-   export NODE_PATH="/Users/kiwi.jang/Desktop/toss/web-automation-batch/node_modules/.pnpm/node_modules"
- else
-   export NODE_PATH="$NODE_PATH:/Users/kiwi.jang/Desktop/toss/web-automation-batch/node_modules/.pnpm/node_modules"
- fi
if [ -x "$basedir/node" ]; then
  exec "$basedir/node"  "$basedir/../../../../node_modules/.pnpm/jest@29.0.0_@types+node@16.11.45/node_modules/jest/bin/jest.js" "$@"
else
  exec node  "$basedir/../../../../node_modules/.pnpm/jest@29.0.0_@types+node@16.11.45/node_modules/jest/bin/jest.js" "$@"
fi

Actual behavior:

#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")

case `uname` in
    *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac

+ if [ -z "$NODE_PATH" ]; then
+   export NODE_PATH="/Users/kiwi.jang/Desktop/toss/web-automation-batch/node_modules/.pnpm/node_modules"
+ else
+   export NODE_PATH="$NODE_PATH:/Users/kiwi.jang/Desktop/toss/web-automation-batch/node_modules/.pnpm/node_modules"
+ fi
if [ -x "$basedir/node" ]; then
  exec "$basedir/node"  "$basedir/../../../../node_modules/.pnpm/jest@29.0.0_@types+node@16.11.45/node_modules/jest/bin/jest.js" "$@"
else
  exec node  "$basedir/../../../../node_modules/.pnpm/jest@29.0.0_@types+node@16.11.45/node_modules/jest/bin/jest.js" "$@"
fi

Additional information:

  • node -v prints: v16.14.0
  • Windows, macOS, or Linux?: macOS

related pr: #4253

@WhiteKiwi
Copy link
Sponsor Contributor Author

WhiteKiwi commented Aug 31, 2022

Problem is ...

ex)
In bin, export NODE_PATH=".../node_modules/.pnpm/node_modules

/node_modules
  ㄴ /.pnpm
    ㄴ /node_nodules
      ㄴ jest-cli@26
/packages
  ㄴ /foo
    ㄴ jest@28
  ㄴ /bar
    ㄴ jest@26

I tried to run pnpm exec jest -v in /packages/foo, then jest-cli resolved as 26 not 28. 26 is printed

@WhiteKiwi
Copy link
Sponsor Contributor Author

#4513

@WhiteKiwi
Copy link
Sponsor Contributor Author

I can solved this issue by giving the hoist options to false.
Is this the right solution? 🙇

# .npmrc
hoist=false

@zkochan
Copy link
Member

zkochan commented Aug 31, 2022

This looks like a duplicate of #5176

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants