Skip to content

[Bug] Cannot find module 'node:path' #452

Closed as not planned
Closed as not planned
@giusepetroso

Description

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(R) Core(TM) 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.

Metadata

Assignees

No one assigned

    Labels

    upstreamThis is an issue with another package

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions