question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] Failed to resolve import "global" with yarn PNP

See original GitHub issue

What version of vite are you using?

2.9.8

System info and storybook versions

System: OS: Windows 10 10.0.22000 CPU: (24) x64 AMD Ryzen 9 3900X 12-Core Processor Binaries: Node: 16.13.1 - C:\Program Files\nodejs\node.EXE Yarn: 3.2.0 - ~\AppData\Roaming\npm\yarn.CMD npm: 8.6.0 - C:\Program Files\nodejs\npm.CMD Browsers: Edge: Spartan (44.22000.120.0), Chromium (101.0.1210.32)

Describe the Bug

When using storybook and this build with Yarn P’n’P ‘global’ cannot be found.

Stack trace: [vite] Internal server error: Failed to resolve import "global" from "..\..\..\..\virtual:\@storybook\builder-vite\setup-addons.js". Does the file exist? Plugin: vite:import-analysis File: /virtual:/@storybook/builder-vite/setup-addons.js 1 | import global from 'global'; | ^ 2 | import createPostMessageChannel from '@storybook/channel-postmessage'; 3 | import createWebSocketChannel from '@storybook/channel-websocket';

Link to Minimal Reproducible Example

Repro

Participation

  • I am willing to submit a pull request for this issue.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Arnagoscommented, May 8, 2022
0reactions
IanVScommented, May 20, 2022

This is fixed by https://github.com/storybookjs/builder-vite/pull/383. Can you please try version 0.1.34? You may hit other problems, though, as detailed in https://github.com/storybookjs/builder-vite/issues/141

Read more comments on GitHub >

github_iconTop Results From Across the Web

yarn create vite error - You.com | The AI Search Engine ...
This error means that Vite has an @import declaration that is not at the top of their file. That was restricted in previous...
Read more >
Error Codes | Yarn - Package Manager
A list of Yarn's error codes with detailed explanations. ... this page so that it can be properly documented), so it should be...
Read more >
yarnpkg/doctor
Node allows you to import any package without having a version specified in your package.json. This can lead to subtle and hard to...
Read more >
Migration | Yarn - JavaScript 软件包管理器
A step-by-step and in-depth migration guide from Yarn 1 (Classic) to Yarn 2 (Berry).
Read more >
Advanced package manager features for npm, Yarn, and ...
Yarn Berry achieves this by generating a .pnp.cjs file instead of a nested node_modules folder. It contains lookup tables to inform Node ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found