Skip to content

Commit 273b7cd

Browse files
committed
add troubleshooting section for pnpm
1 parent c90a5ee commit 273b7cd

File tree

1 file changed

+24
-0
lines changed
  • docs/platforms/javascript/common/troubleshooting

1 file changed

+24
-0
lines changed

docs/platforms/javascript/common/troubleshooting/index.mdx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,30 @@ Learn more about fixing these caching issues in the <PlatformLink to="/sourcemap
431431
432432
</Expandable>
433433
434+
434435
</PlatformSection>
435436
437+
<Expandable permalink title="pnpm: Resolving 'import-in-the-middle' external package errors">
438+
439+
When using pnpm, you might encounter errors related to packages that can't be external, particularly with packages like `import-in-the-middle` and `require-in-the-middle`. These errors typically occur due to pnpm's strict dependency management and hoisting behavior.
440+
441+
While adding these packages as direct dependencies might remove the warning messages, it often doesn't resolve the underlying functionality issues:
442+
443+
```bash
444+
pnpm add import-in-the-middle require-in-the-middle
445+
```
446+
447+
The actual fix requires modifying your `.npmrc` file by adding these lines:
448+
449+
```npmrc
450+
shamefully-hoist=true
451+
strict-peer-dependencies=false
452+
```
453+
<Alert level="warning">
454+
**Note**: While `shamefully-hoist=true` usually isn't the ideal solution from a dependency management perspective, it's sometimes necessary for compatibility with certain packages that expect Node.js module resolution behavior similar to npm or yarn.
455+
</Alert>
456+
457+
458+
</Expandable>
459+
436460
If you need additional help, you can [ask on GitHub](https://github.com/getsentry/sentry-javascript/issues/new/choose). Customers on a paid plan may also contact support.

0 commit comments

Comments
 (0)