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.

Unable to install @storybook/angular to a new Angular project.

See original GitHub issue

Describe the bug Running npm install @storybook/angular --save-dev or npx -p @storybook/cli sb init --type angular in a new Angular application always fails.

To Reproduce Create a new Angular application using angular-cli and try to install @storybook/angular:

$ ng new test-storybook
$ cd test-storybook
$ npm install @storybook/angular --save-dev

npm WARN deprecated core-js@1.2.7: core-js@<2.6.5 is no longer maintained. Please, upgrade to core-js@3 or at least to actual version of core-js@2.
...
@babel/core@^7.0.0-0 but none is installed. You must install peer dependencies yourself.
npm WARN @babel/plugin-transform-unicode-regex@7.4.4 requires a peer of @babel/core@^7.0.0-0 but none is installed. You must install peer dependencies yourself.

npm ERR! path C:\Users\user\git\test-storybook\node_modules\array.prototype.flat
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\user\git\test-storybook\node_modules\array.prototype.flat' -> 'C:\Users\user\git\test-storybook\node_modules\.array.prototype.flat.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\user\AppData\Roaming\npm-cache\_logs\2019-05-16T19_55_34_727Z-debug.log

Expected behavior npm i should not fail and should install @storybook/angular.

Code snippets package.json generated by angular-cli:

{
  "name": "test-storybook",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~7.2.0",
    "@angular/common": "~7.2.0",
    "@angular/compiler": "~7.2.0",
    "@angular/core": "~7.2.0",
    "@angular/forms": "~7.2.0",
    "@angular/platform-browser": "~7.2.0",
    "@angular/platform-browser-dynamic": "~7.2.0",
    "@angular/router": "~7.2.0",
    "core-js": "^2.5.4",
    "rxjs": "~6.3.3",
    "tslib": "^1.9.0",
    "zone.js": "~0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.13.0",
    "@angular/cli": "~7.3.8",
    "@angular/compiler-cli": "~7.2.0",
    "@angular/language-service": "~7.2.0",
    "@types/node": "~8.9.4",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "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.2.2"
  }
}

System:

  • OS: Windows10
  • Device: ThinkPad T480s
  • Browser: N/A
  • Framework: angular
  • Addons: N/A
  • Version: latest

Additional context Node version: v11.15.0 NPM version: 6.7.0 The error was the same with Node 10.15.3. I also tried different versions of @storybook/angular including next but the result is always the same.

Angular CLI version:

Angular CLI: 7.3.9
Node: 11.15.0
OS: win32 x64
Angular: 7.2.15
... animations, common, compiler, compiler-cli, core, elements
... forms, language-service, platform-browser
... platform-browser-dynamic, router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.13.9
@angular-devkit/build-angular      0.13.9
@angular-devkit/build-ng-packagr   0.13.9
@angular-devkit/build-optimizer    0.13.9
@angular-devkit/build-webpack      0.13.9
@angular-devkit/core               7.3.9
@angular-devkit/schematics         7.3.9
@angular/cdk                       7.3.7
@angular/cli                       7.3.9
@angular/material                  7.3.7
@ngtools/json-schema               1.1.0
@ngtools/webpack                   7.3.9
@schematics/angular                7.3.9
@schematics/update                 0.13.9
ng-packagr                         4.7.1
rxjs                               6.5.2
typescript                         3.2.4
webpack                            4.29.0

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:24 (7 by maintainers)

github_iconTop GitHub Comments

13reactions
asinitsoncommented, Sep 9, 2019

@guillermoarellano : Thanks! That did the trick!

For others reading this, here are exact commands to downgrade:

npm install @angular/cli@8.2
npm install @angular-devkit/build-angular@0.802

…which currently results in this change in package.json

  "devDependencies": {
    "@angular-devkit/build-angular": "^0.802.2",
    "@angular/cli": "^8.2.2",

…and this happy picture: image

7reactions
guillermoarellanocommented, Sep 7, 2019

@asinitson @marchino21 I recently upgraded my version of Angular and it broke Storybook. I would recommend you downgrade your CLI version to 8.2.0 and the devkit 0.802.0. That fixed it for me. See this comment – https://github.com/storybookjs/storybook/issues/7877#issuecomment-525833864

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add Storybook to Angular v10 Project - Stack Overflow
As a test, I tried creating a quick angular project ( ng new ) at version 12, and then using npx sb init...
Read more >
storybook/angular - npm
Storybook for Angular is a UI development environment for your Angular components. With it, you can visualize different states of your UI ...
Read more >
Set up Storybook for Angular Projects - Nx
This guide will walk you through setting up Storybook for Angular projects in your Nx workspace. Set up Storybook in your workspace. You...
Read more >
Storybook for Angular
You may have tried to use our quick start guide to setup your project for Storybook. If you want to set up Storybook...
Read more >
Storybook for Angular tutorial
Storybook for Angular tutorial. Set up Angular Storybook in your development environment. Storybook runs alongside your app in development mode.
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