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.

core-js modules not found when using load all stories glob

See original GitHub issue

Describe the bug Multiple Can’t resolve ‘core-js/modules/’ errors, but only when using the .storybook/config.js to load all stories matching a glob method.

To Reproduce Steps to reproduce the behavior:

  1. Fresh install of Angular 8
  2. Fresh install of @storybook/angular following the guide at https://storybook.js.org/docs/guides/guide-angular/
  3. Create config.js file (see below)
  4. npm run storybook
  5. Errors.

Expected behavior Storybook to load just like it does if I specify individual file import without trying to match /.stories.ts$/

Screenshots image

Code snippets .storybook/config.js: `import { configure } from ‘@storybook/angular’; import requireContext from ‘require-context.macro’;

const req = requireContext(‘…/src/app/modules’, true, /.stories.ts$/);

function loadStories() { req.keys().forEach(filename => req(filename)); }

configure(loadStories, module);`

package.json: { "name": "one-equality", "version": "0.0.0", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e", "storybook": "start-storybook" }, "private": true, "dependencies": { "@angular/animations": "^8.0.0", "@angular/cdk": "^8.0.0", "@angular/common": "~8.0.0", "@angular/compiler": "~8.0.0", "@angular/core": "~8.0.0", "@angular/flex-layout": "^8.0.0-beta.26", "@angular/forms": "~8.0.0", "@angular/material": "^8.0.0", "@angular/platform-browser": "~8.0.0", "@angular/platform-browser-dynamic": "~8.0.0", "@angular/router": "~8.0.0", "core-js": "^2.5.4", "hammerjs": "^2.0.8", "require-context.macro": "^1.0.4", "rxjs": "~6.5.2", "tslib": "^1.9.0", "zone.js": "~0.9.1" }, "devDependencies": { "@angular-devkit/build-angular": "~0.800.0", "@angular/cli": "~8.0.0", "@angular/compiler-cli": "~8.0.0", "@angular/language-service": "~8.0.0", "@babel/core": "^7.4.5", "@storybook/angular": "^5.1.3", "@types/jasmine": "~2.8.8", "@types/jasminewd2": "~2.0.3", "@types/node": "~8.9.4", "babel-loader": "^8.0.6", "codelyzer": "~4.5.0", "jasmine-core": "~2.99.1", "jasmine-spec-reporter": "~4.2.1", "karma": "~4.0.0", "karma-chrome-launcher": "~2.2.0", "karma-coverage-istanbul-reporter": "~2.0.1", "karma-jasmine": "~1.1.2", "karma-jasmine-html-reporter": "^0.2.2", "protractor": "~5.4.0", "ts-node": "~7.0.0", "tslint": "~5.11.0", "typescript": "~3.4.5" } }

System:

  • OS: Ubuntu via WSL on Windows 10
  • Device: Dell Inspiron
  • Browser: Chrome/Firefox latest for both
  • Framework: Angular
  • Addons: None
  • Version: Storybook - ^5.1.3 Angular - ~8.0.0 core-js - ^2.5.4

Additional context I have tried upgrading core-js to 3, to various specific versions of 2… nothing seems to work. As long as I use the load all stories method, I get those errors.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
emilio-martinezcommented, Jun 13, 2019

This is fixed for me with storybook 5.1.5

1reaction
kroedercommented, Jun 7, 2019

Angular 8 dropped core-js as a dependency. You said

I have tried upgrading core-js to 3, to various specific versions of 2…

I did a fresh setup myself and it has worked - have you tried to follow the manual steps or have you used the CLI?

Can you try a fresh installation with

  • npx @angular/cli new angular8-project
  • cd angular8-project
  • npx @storybook/cli init
  • npm run storybook

Or try https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#angular-7 but this was originally a fix for Angular 7 with core-js 3

Read more comments on GitHub >

github_iconTop Results From Across the Web

Storybook - no stories showing up in typescript project with ...
When trying to create a story from my components, I get the error: Module not found: Error: Can't resolve 'esri/Basemap' in '/.../GitHub/20-maps ...
Read more >
How To Work with Files using the fs Module in Node.js
Change your working directory to the newly created folder with the cd command: cd node-files. In this folder, you'll create two files. The...
Read more >
Using node modules with njs - Nginx.org
In this guide, we use njs cli in all examples for the sake of simplicity. In real life, you will be using nginx...
Read more >
JavaScript modules - MDN Web Docs
This guide gives you all you need to get started with JavaScript module syntax. A background on modules. JavaScript programs started off pretty ......
Read more >
Npm install command failing with message "could not find ...
But then, suddenly, it stops with the error: npm ERR! code 1 npm ERR! path C:\Users\ricar\Desktop\mflix-js\node_modules\weak-napi npm ERR!
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