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

npm run build-storybook gives SyntaxError: Invalid regular expression: /%npm_config_"errors" : [ {%/: Unterminated character class ... #19371

Closed
koolksh opened this issue Oct 6, 2022 · 1 comment

Comments

@koolksh
Copy link

koolksh commented Oct 6, 2022

Describe the bug
Using storybook for the first time and does not work on my mac. The same repo works for other colleagues. But for some reason gives
ERR! SyntaxError: Invalid regular expression: /%npm_config_"errors" : [ {%/: Unterminated character class
ERR! at new RegExp ()
ERR! at test-story-book/node_modules/@storybook/core-common/dist/cjs/utils/template.js:22:24

See details below.

test-story-book git:(master) ✗ npm run build-storybook

test-story-book@0.1.0 build-storybook
build-storybook -s public

info @storybook/react v6.5.12
info
info => Cleaning outputDir: test-story-book/storybook-static
(node:21182) DeprecationWarning: --static-dir CLI flag is deprecated, see:

https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#deprecated---static-dir-cli-flag
(Use node --trace-deprecation ... to show where the warning was created)
info => Loading presets
info => Copying static files: ./public => ./
info => Compiling manager..
info => Compiling preview..
info Addon-docs: using MDX1
info => Loading Webpack configuration from node_modules/react-scripts
info => Removing existing JavaScript and TypeScript rules.
info => Modifying Create React App rules.
info => Using default Webpack5 setup
ERR! SyntaxError: Invalid regular expression: /%npm_config_"errors" : [ {%/: Unterminated character class
ERR! at new RegExp ()
ERR! at test-story-book/node_modules/@storybook/core-common/dist/cjs/utils/template.js:22:24
ERR! at Array.reduce ()
ERR! at interpolate (test-story-book/node_modules/@storybook/core-common/dist/cjs/utils/template.js:21:31)
ERR! at getManagerHeadTemplate (test-story-book/node_modules/@storybook/core-common/dist/cjs/utils/template.js:65:10)
ERR! at _callee$ (test-story-book/node_modules/@storybook/manager-webpack5/dist/cjs/presets/manager-preset.js:116:88)
ERR! at tryCatch (test-story-book/node_modules/regenerator-runtime/runtime.js:63:40)
ERR! at Generator.invoke [as invoke] (test-story-book/node_modules/regenerator-runtime/runtime.js:294:22)
ERR! at Generator.next (test-story-book/node_modules/regenerator-runtime/runtime.js:119:21)
ERR! at asyncGeneratorStep (test-story-book/node_modules/@storybook/manager-webpack5/dist/cjs/presets/manager-preset.js:83:103)
ERR! SyntaxError: Invalid regular expression: /%npm_config
"errors" : [ {%/: Unterminated character class
ERR! at new RegExp ()
ERR! at test-story-book/node_modules/@storybook/core-common/dist/cjs/utils/template.js:22:24
ERR! at Array.reduce ()
ERR! at interpolate (test-story-book/node_modules/@storybook/core-common/dist/cjs/utils/template.js:21:31)
ERR! at getManagerHeadTemplate (test-story-book/node_modules/@storybook/core-common/dist/cjs/utils/template.js:65:10)
ERR! at _callee$ (test-story-book/node_modules/@storybook/manager-webpack5/dist/cjs/presets/manager-preset.js:116:88)
ERR! at tryCatch (test-story-book/node_modules/regenerator-runtime/runtime.js:63:40)
ERR! at Generator.invoke [as _invoke] (test-story-book/node_modules/regenerator-runtime/runtime.js:294:22)
ERR! at Generator.next (test-story-book/node_modules/regenerator-runtime/runtime.js:119:21)
ERR! at asyncGeneratorStep (test-story-book/node_modules/@storybook/manager-webpack5/dist/cjs/presets/manager-preset.js:83:103)
info => Loading presets

To Reproduce
An error occurred while executing: yarn set version berry && yarn config set enableGlobalCache true && yarn config set nodeLinker node-modules
🚨 Installing Yarn 2 failed
🚨 Failed to create repro
ERR! Error: command exited with code: 1:
ERR! at ChildProcess. (.npm/_npx/eebb2d3a7d26a7f1/node_modules/@storybook/cli/dist/generate.js:201:264)
ERR! at ChildProcess.emit (node:events:527:28)
ERR! at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
ERR! Error: command exited with code: 1:
ERR! at ChildProcess. (.npm/_npx/eebb2d3a7d26a7f1/node_modules/@storybook/cli/dist/generate.js:201:264)
ERR! at ChildProcess.emit (node:events:527:28)
ERR! at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)

System
Environment Info:

System:
OS: macOS 12.6
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Binaries:
Node: 17.9.0 - /usr/local/bin/node
Yarn: 1.22.19 - ~/Documents/Learning/test-story-book/node_modules/.bin/yarn
npm: 8.5.5 - /usr/local/bin/npm
Browsers:
Chrome: 106.0.5249.61
Safari: 16.0
npmPackages:
@storybook/addon-actions: ^6.5.12 => 6.5.12
@storybook/addon-essentials: ^6.5.12 => 6.5.12
@storybook/addon-interactions: ^6.5.12 => 6.5.12
@storybook/addon-links: ^6.5.12 => 6.5.12
@storybook/builder-webpack5: ^6.5.12 => 6.5.12
@storybook/manager-webpack5: ^6.5.12 => 6.5.12
@storybook/node-logger: ^6.5.12 => 6.5.12
@storybook/preset-create-react-app: ^4.1.2 => 4.1.2
@storybook/react: ^6.5.12 => 6.5.12
@storybook/testing-library: ^0.0.13 => 0.0.13

Additional context
Add any other context about the problem here.

@koolksh
Copy link
Author

koolksh commented Oct 7, 2022

This is fixed now. Not sure how but npm_config had some unexpected entries. After removing those storybook didn't complain. Not sure how the entries got in npm_config and also why it only bothered storybook

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

1 participant