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

.npmrc read fails and error is swallowed, confusing result #5065

Open
JonathanUsername opened this issue Jul 20, 2022 · 3 comments
Open

.npmrc read fails and error is swallowed, confusing result #5065

JonathanUsername opened this issue Jul 20, 2022 · 3 comments

Comments

@JonathanUsername
Copy link

pnpm version:

7.5.2

Code to reproduce the issue:

Create a .npmrc file that has an error, such as referencing a inexistent env variable:

hoist=false
public-hoist-pattern[]=react
//npm.pkg.github.com/:_authToken=${FOO_BAR} # Make sure FOO_BAR *isn't* in your env vars

then run pnpm install

Expected behavior:

An error to indicate to the user that their config file could not be read

Actual behavior:

The node_modules/.modules.yaml entry for publicHoistPattern does not contain react, and that package you wanted to be hoisted, isn't. There is no indication of why this is since the error is swallowed, so it becomes a very nasty bug to track down!
It may well be user error that the env var interpolation didn't work, but for all intents and purposes it seemed like pnpm was successfully proceeding, we only noticed due to the hoisting failing.

Additional information:

PR proposal to fix, or at least ameliorate the problem, here: pnpm/npm-conf#6

  • node -v prints: v16.15.1
  • Windows, macOS, or Linux?: Linux
@zkochan
Copy link
Member

zkochan commented Jul 31, 2022

A warning will be now printed #5127

but I guess the correct solution would be to read the config file and skip the broken settings.

@evelant
Copy link

evelant commented Sep 12, 2022

Hmm there's apparently still some issues with reading .npmrc and generating publicHoistPattern: correctly. I haven't figured out exactly why but when pnpm install is run via expo-build it fails to do public hoisting but it works fine when I jsut run pnpm install in my shell!

For example, I have this in my .npmrc

public-hoist-pattern[]='react-native-gradle-plugin*'
public-hoist-pattern[]='jsc-android*'

and after pnpm install those modules are public and .modules.yml contains:

publicHoistPattern:
  - react-native-gradle-plugin*
  - jsc-android*

however when I run eas build -p android --profile development --local and EAS runs pnpm install the packages are not public and .modules.yml contains

publicHoistPattern: |-
  react-native-gradle-plugin*

  jsc-android*

I'm guessing there's some parsing issue going on here. Thoughts @zkochan ?

@evelant
Copy link

evelant commented Sep 12, 2022

Hmm it seems that for whatever reason I cannot have more than one public-hoist-pattern[]= entry or it gets mangled during the expo build into a single string like above and nothing gets hoisted. Not sure how to track this down.

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

No branches or pull requests

3 participants