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] Cannot find module 'node:path'

See original GitHub issue

What version of vite are you using?

^2.9.9

System info and storybook versions

System: OS: Windows 10 10.0.22000 CPU: (16) x64 Intel® Core™ i9-9900K CPU @ 3.60GHz Binaries: Node: 14.16.0 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.4 - C:\Program Files (x86)\Yarn\bin\yarn.CMD npm: 6.14.11 - C:\Program Files\nodejs\npm.CMD Browsers: Edge: Spartan (44.22000.120.0), Chromium (103.0.1264.62) npmPackages: @storybook/addon-actions: ^6.5.9 => 6.5.9 @storybook/addon-essentials: ^6.5.9 => 6.5.9 @storybook/addon-interactions: ^6.5.9 => 6.5.9 @storybook/addon-links: ^6.5.9 => 6.5.9 @storybook/builder-vite: ^0.2.0 => 0.2.0 @storybook/testing-library: 0.0.13 => 0.0.13 @storybook/vue3: ^6.5.9 => 6.5.9

Describe the Bug

I installed storybook on a package project I am working on.

Just ran npx storybook init

Since the first run of npm run storybook there was this error:

$ npm run storybook

> bitboss-ui@0.0.1 storybook D:\Workspaces\MyProjects\test-storybook
> start-storybook -p 6006

info @storybook/vue3 v6.5.9
info 
ERR! Error: Cannot find module 'node:path'
ERR! Require stack:
ERR! - D:\Workspaces\MyProjects\test-storybook\node_modules\@vitejs\plugin-react\dist\index.cjs
ERR! - D:\Workspaces\MyProjects\test-storybook\node_modules\@storybook\builder-vite\dist\vite-config.js
ERR! - D:\Workspaces\MyProjects\test-storybook\node_modules\@storybook\builder-vite\dist\vite-server.js
ERR! - D:\Workspaces\MyProjects\test-storybook\node_modules\@storybook\builder-vite\dist\index.js
ERR! - D:\Workspaces\MyProjects\test-storybook\node_modules\@storybook\core-server\dist\cjs\utils\get-preview-builder.js
ERR! - D:\Workspaces\MyProjects\test-storybook\node_modules\@storybook\core-server\dist\cjs\build-static.js
ERR! - D:\Workspaces\MyProjects\test-storybook\node_modules\@storybook\core-server\dist\cjs\index.js
ERR! - D:\Workspaces\MyProjects\test-storybook\node_modules\@storybook\core\dist\cjs\server.js
ERR! - D:\Workspaces\MyProjects\test-storybook\node_modules\@storybook\core\server.js
ERR! - D:\Workspaces\MyProjects\test-storybook\node_modules\@storybook\vue3\dist\cjs\server\index.js
ERR! - D:\Workspaces\MyProjects\test-storybook\node_modules\@storybook\vue3\bin\index.js
ERR!     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
ERR!     at Function.Module._load (internal/modules/cjs/loader.js:725:27)
ERR!     at Module.require (internal/modules/cjs/loader.js:952:19)
ERR!     at require (internal/modules/cjs/helpers.js:88:18)
ERR!     at Object.<anonymous> (D:\Workspaces\MyProjects\test-storybook\node_modules\@vitejs\plugin-react\dist\index.cjs:3:14)
ERR!     at Module._compile (internal/modules/cjs/loader.js:1063:30)
ERR!     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
ERR!     at Module.load (internal/modules/cjs/loader.js:928:32)
ERR!     at Function.Module._load (internal/modules/cjs/loader.js:769:14)
ERR!     at Module.require (internal/modules/cjs/loader.js:952:19)
ERR!  Error: Cannot find module 'node:path'
ERR! Require stack:
ERR! - D:\Workspaces\MyProjects\test-storybook\node_modules\@vitejs\plugin-react\dist\index.cjs
ERR! - D:\Workspaces\MyProjects\test-storybook\node_modules\@storybook\builder-vite\dist\vite-config.js
ERR! - D:\Workspaces\MyProjects\test-storybook\node_modules\@storybook\builder-vite\dist\vite-server.js
ERR! - D:\Workspaces\MyProjects\test-storybook\node_modules\@storybook\builder-vite\dist\index.js
ERR! - D:\Workspaces\MyProjects\test-storybook\node_modules\@storybook\core-server\dist\cjs\utils\get-preview-builder.js
ERR! - D:\Workspaces\MyProjects\test-storybook\node_modules\@storybook\core-server\dist\cjs\build-static.js
ERR! - D:\Workspaces\MyProjects\test-storybook\node_modules\@storybook\core-server\dist\cjs\index.js
ERR! - D:\Workspaces\MyProjects\test-storybook\node_modules\@storybook\core\dist\cjs\server.js
ERR! - D:\Workspaces\MyProjects\test-storybook\node_modules\@storybook\core\server.js
ERR! - D:\Workspaces\MyProjects\test-storybook\node_modules\@storybook\vue3\dist\cjs\server\index.js
ERR! - D:\Workspaces\MyProjects\test-storybook\node_modules\@storybook\vue3\bin\index.js
ERR!     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
ERR!     at Function.Module._load (internal/modules/cjs/loader.js:725:27)
ERR!     at Module.require (internal/modules/cjs/loader.js:952:19)
ERR!     at require (internal/modules/cjs/helpers.js:88:18)
ERR!     at Object.<anonymous> (D:\Workspaces\MyProjects\test-storybook\node_modules\@vitejs\plugin-react\dist\index.cjs:3:14)
ERR!     at Module._compile (internal/modules/cjs/loader.js:1063:30)
ERR!     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
ERR!     at Module.load (internal/modules/cjs/loader.js:928:32)
ERR!     at Function.Module._load (internal/modules/cjs/loader.js:769:14)
ERR!     at Module.require (internal/modules/cjs/loader.js:952:19) {
ERR!   code: 'MODULE_NOT_FOUND',
ERR!   requireStack: [
ERR!     'D:\\Workspaces\\MyProjects\\test-storybook\\node_modules\\@vitejs\\plugin-react\\dist\\index.cjs',
ERR!     'D:\\Workspaces\\MyProjects\\test-storybook\\node_modules\\@storybook\\builder-vite\\dist\\vite-config.js',
ERR!     'D:\\Workspaces\\MyProjects\\test-storybook\\node_modules\\@storybook\\builder-vite\\dist\\vite-server.js',
ERR!     'D:\\Workspaces\\MyProjects\\test-storybook\\node_modules\\@storybook\\builder-vite\\dist\\index.js',
ERR!     'D:\\Workspaces\\MyProjects\\test-storybook\\node_modules\\@storybook\\core-server\\dist\\cjs\\utils\\get-preview-builder.js',
ERR!     'D:\\Workspaces\\MyProjects\\test-storybook\\node_modules\\@storybook\\core-server\\dist\\cjs\\build-static.js',
ERR!     'D:\\Workspaces\\MyProjects\\test-storybook\\node_modules\\@storybook\\core-server\\dist\\cjs\\index.js',
ERR!     'D:\\Workspaces\\MyProjects\\test-storybook\\node_modules\\@storybook\\core\\dist\\cjs\\server.js',
ERR!     'D:\\Workspaces\\MyProjects\\test-storybook\\node_modules\\@storybook\\core\\server.js',
ERR!     'D:\\Workspaces\\MyProjects\\test-storybook\\node_modules\\@storybook\\vue3\\dist\\cjs\\server\\index.js',
ERR!     'D:\\Workspaces\\MyProjects\\test-storybook\\node_modules\\@storybook\\vue3\\bin\\index.js'
ERR!   ]
ERR! }

WARN Broken build, fix the error above.
WARN You may need to refresh the browser.

info => Loading presets
√ Would you like to send crash reports to Storybook? ... yes

attention => Storybook now collects completely anonymous telemetry regarding usage.
This information is used to shape Storybook's roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://storybook.js.org/telemetry

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bitboss-ui@0.0.1 storybook: `start-storybook -p 6006`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bitboss-ui@0.0.1 storybook script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\gpetr\AppData\Roaming\npm-cache\_logs\2022-07-20T09_30_24_812Z-debug.log

Link to Minimal Reproducible Example

https://github.com/giusepetroso/test-storybook

Participation

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

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
sourabh129commented, Sep 19, 2022

@IanVS, You are right, but it somehow fixes the error. Please try adding it in this repo. Vite 3 works fine with node v14 when “type”: “module” is present in package.json

2reactions
sourabh129commented, Sep 17, 2022

You need to add “type”: “module” in package.json to fix this in node v14

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot find module 'node:path' in vite.config.ts · Issue #9113 ...
Describe the bug As Vite v3 is released, I've updated my project to use it. However, I am getting a new error when...
Read more >
Laravel 9 fix Error: Cannot find module 'node:path' - YouTube
In this video I will show how to fix Error: Cannot find module ' node:path ' in LaravelSubscribe our channel for videos like...
Read more >
How do I resolve "Cannot find module" error using Node.js?
Using npm install installs the module into the current directory only (in a subdirectory called node_modules ). Is app.js located under ...
Read more >
I got error Cannot find module 'node:path' when installing ...
npm - I got error Cannot find module 'node:path' when installing laravel/vite app - Ask Ubuntu.
Read more >
cannot find module [Node npm Error Solved] - freeCodeCamp
In this article, I'm going to show you how to fix the error. Why the "Error: cannot find module" Occurs. This error occurs...
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