storybook icon indicating copy to clipboard operation
storybook copied to clipboard

Upgrading with npx sb@next upgrade is failing with the error "Cannot read property 'matches' of undefined"

Open ophinjay opened this issue 4 years ago • 6 comments

My stories are currently running on storybook 6.0.20. On 6.0.20, my stories are working fine. When I start storybook, I get the following notification

A new version (6.1.1) is available! 
Upgrade now: npx sb@next upgrade

So I ran npx sb@next upgrade but it fails with the following error log

 • Checking for latest versions of '@storybook/*' packagesinfo ,Upgrading /Users/jophin/Documents/workspace/appx/package.json
info
info  @storybook/addon-actions  6.0.20  →  6.1.1
info  @storybook/react          6.0.20  →  6.1.1
info
info Run npm install to install new versions.
info
info ,
info
 • Installing upgrades • Preparing to install dependencies. ✓


 • Installing dependencies⸨░░░░░░░░░░░░░░░░░░⸩ ⠹ idealTree: timing arborist:ctor Completed in
npm ERR! Cannot read property 'matches' of undefined

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/jophin/.npm/_logs/2020-11-20T04_41_11_010Z-debug.log
. ✖

     An error occurred while installing dependencies.
npm ERR! code 1
npm ERR! path /Users/jophin/Documents/workspace/appx
npm ERR! command failed
npm ERR! command sh -c sb upgrade

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/jophin/.npm/_logs/2020-11-20T04_41_11_043Z-debug.log

I tried the following

  • Removed node_modules
  • Remove package-lock.json
  • Reinstalled with npm install Still getting the same error

Results of npx sb@next info

Environment Info:

  System:
    OS: macOS 10.15.7
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
  Binaries:
    Node: 13.12.0 - ~/.nvm/versions/node/v13.12.0/bin/node
    Yarn: 1.22.5 - /usr/local/bin/yarn
    npm: 7.0.5 - ~/.nvm/versions/node/v13.12.0/bin/npm
  Browsers:
    Chrome: 86.0.4240.198
    Firefox: 78.0.2
    Safari: 14.0.1
  npmPackages:
    @storybook/addon-actions: 6.0.20 => 6.0.20
    @storybook/react: 6.0.20 => 6.0.20
  npmGlobalPackages:
    @storybook/cli: 6.1.0

Content of npm debug log

0 verbose cli [
0 verbose cli   '/Users/jophin/.nvm/versions/node/v13.12.0/bin/node',
0 verbose cli   '/Users/jophin/.nvm/versions/node/v13.12.0/lib/node_modules/npm/bin/npm-cli.js',
0 verbose cli   'exec',
0 verbose cli   '--',
0 verbose cli   'sb@next',
0 verbose cli   'upgrade'
0 verbose cli ]
1 info using [email protected]
2 info using [email protected]
3 timing config:load:defaults Completed in 1ms
4 timing config:load:file:/Users/jophin/.nvm/versions/node/v13.12.0/lib/node_modules/npm/npmrc Completed in 1ms
5 timing config:load:builtin Completed in 1ms
6 timing config:load:cli Completed in 1ms
7 timing config:load:env Completed in 1ms
8 timing config:load:file:/Users/jophin/Documents/workspace/appx/.npmrc Completed in 1ms
9 timing config:load:project Completed in 1ms
10 timing config:load:file:/Users/jophin/.npmrc Completed in 0ms
11 timing config:load:user Completed in 0ms
12 timing config:load:file:/Users/jophin/.nvm/versions/node/v13.12.0/etc/npmrc Completed in 0ms
13 timing config:load:global Completed in 0ms
14 timing config:load:cafile Completed in 1ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:setUserAgent Completed in 0ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 7ms
19 verbose npm-session d25d3be7afcce819
20 timing npm:load Completed in 13ms
21 http fetch GET 304 https://registry.npmjs.org/sb 1254ms (from cache)
22 timing arborist:ctor Completed in 0ms
23 timing arborist:ctor Completed in 0ms
24 timing arborist:ctor Completed in 0ms
25 timing command:exec Completed in 16703ms
26 verbose stack Error: command failed
26 verbose stack     at ChildProcess.<anonymous> (/Users/jophin/.nvm/versions/node/v13.12.0/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/index.js:63:27)
26 verbose stack     at ChildProcess.emit (events.js:315:20)
26 verbose stack     at maybeClose (internal/child_process.js:1026:16)
26 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
27 verbose pkgid [email protected]
28 verbose cwd /Users/jophin/Documents/workspace/appx
29 verbose Darwin 19.6.0
30 verbose argv "/Users/jophin/.nvm/versions/node/v13.12.0/bin/node" "/Users/jophin/.nvm/versions/node/v13.12.0/lib/node_modules/npm/bin/npm-cli.js" "exec" "--" "sb@next" "upgrade"
31 verbose node v13.12.0
32 verbose npm  v7.0.5
33 error code 1
34 error path /Users/jophin/Documents/workspace/appx
35 error command failed
36 error command sh -c sb upgrade
37 verbose exit 1

ophinjay avatar Nov 20 '20 05:11 ophinjay

@ophinjay Do you have a repro repo you can share?

shilman avatar Nov 20 '20 08:11 shilman

@ophinjay Do you have a repro repo you can share?

@shilman I'm trying this on a private repo. So I cannot share that with you. I will try to see if I can reproduce the issue in a shareable repo

ophinjay avatar Nov 20 '20 09:11 ophinjay

Thanks @ophinjay 🙏 much appreciated

shilman avatar Nov 20 '20 09:11 shilman

I am also trying this from a private repo and mine is hanging at Checking for latest versions of '@storybook/*' packages

erosenberg avatar Nov 24 '20 17:11 erosenberg

I have the same issue on the following repo when using node version 15. I tried using node 12 and it worked. Here is the repo: https://github.com/vogelino/vogelui

vogelino avatar Nov 26 '20 21:11 vogelino

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

stale[bot] avatar Dec 25 '20 15:12 stale[bot]

We’re cleaning house! Storybook has changed a lot since this issue was created and we don’t know if it’s still valid. Please open a new issue referencing this one if:

  • this is still a problem in SB 7.x
  • you can provide a consistent reproduction in 7.x (at https://storybook.new/ or per repro docs).

shilman avatar Jun 08 '23 03:06 shilman

I can confirm this is still a problem even in SB 8.x.

npx storybook@latest upgrade
Need to install the following packages:
[email protected]
Ok to proceed? (y) y

npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
Error: Unable to find versions of @storybook/cli using npm
    at NPMProxy.runGetVersions (/Users/connexo/.npm/_npx/bc7e1e37fcb46ffc/node_modules/@storybook/core-common/dist/index.js:37:639)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Promise.all (index 0)
    at async doUpgrade (/Users/connexo/.npm/_npx/bc7e1e37fcb46ffc/node_modules/@storybook/cli/dist/generate.js:643:2214)
    at async withTelemetry (/Users/connexo/.npm/_npx/bc7e1e37fcb46ffc/node_modules/@storybook/core-server/dist/index.js:28:3599)
    at async upgrade (/Users/connexo/.npm/_npx/bc7e1e37fcb46ffc/node_modules/@storybook/cli/dist/generate.js:650:2097)

using Node 20.13.1 and npm 10.8.0 on an Intel Mac running the latest MacOS Ventura.

Trying to upgrade from Storybook 8.0.9.

frank-topel-dbi avatar May 25 '24 13:05 frank-topel-dbi