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

[Bug]: Cannot find module 'jsonfile/utils' #22682

Open
Fydon opened this issue May 22, 2023 · 1 comment
Open

[Bug]: Cannot find module 'jsonfile/utils' #22682

Fydon opened this issue May 22, 2023 · 1 comment

Comments

@Fydon
Copy link

Fydon commented May 22, 2023

Describe the bug

I tried to update using npx storybook@latest upgrade but it failed with the following

node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module 'jsonfile/utils'
Require stack:
- my-project\node_modules\@storybook\core-server\node_modules\fs-extra\lib\json\output-json.js
- my-project\node_modules\@storybook\core-server\node_modules\fs-extra\lib\json\index.js
- my-project\node_modules\@storybook\core-server\node_modules\fs-extra\lib\index.js
- my-project\node_modules\@storybook\core-server\dist\index.js
- my-project\node_modules\@storybook\cli\dist\generate.js
- my-project\node_modules\@storybook\cli\bin\index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (my-project\node_modules\@storybook\core-server\node_modules\fs-extra\lib\json\output-json.js:3:23)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'my-project\\node_modules\\@storybook\\core-server\\node_modules\\fs-extra\\lib\\json\\output-json.js',
    'my-project\\node_modules\\@storybook\\core-server\\node_modules\\fs-extra\\lib\\json\\index.js',
    'my-project\\node_modules\\@storybook\\core-server\\node_modules\\fs-extra\\lib\\index.js',
    'my-project\\node_modules\\@storybook\\core-server\\dist\\index.js',
    'my-project\\node_modules\\@storybook\\cli\\dist\\generate.js',
    'my-project\\node_modules\\@storybook\\cli\\bin\\index.js'
  ]
}

To Reproduce

Run npx storybook@latest upgrade on a project that doesn't already include jsonfile. Looking at the Angular project on storybook.new, the package-json.lock already includes jsonfile due to multiple dependencies including it as a dependency, e.g. node_modules/@compodoc/ngd-transformer/node_modules/fs-extra so I'm not sure if I can reproduce it there.

System

Environment Info:

  System:
    OS: Windows 10 10.0.22621
    CPU: (32) x64 AMD Ryzen 9 5950X 16-Core Processor
  Binaries:
    Node: 16.15.0 - C:\Program Files\nodejs\node.EXE
    npm: 8.6.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22621.1702.0), Chromium (113.0.1774.42)
  npmPackages:
    @storybook/addon-actions: ~7.0.12 => 7.0.12
    @storybook/addon-essentials: ~7.0.12 => 7.0.12
    @storybook/addon-links: ~7.0.12 => 7.0.12
    @storybook/angular: ~7.0.12 => 7.0.12

Additional context

Running npm install --save-dev jsonfile/utils resolved the error. The above info was generated after I successfully updated from 7.0.0-beta.34.

@lamualfa
Copy link

lamualfa commented Aug 5, 2023

Just delete the package-lock.json and run the npm install again.

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

2 participants