storybook: Unable to install @storybook/angular to a new Angular project.
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
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 24 (7 by maintainers)
@guillermoarellano : Thanks! That did the trick!
For others reading this, here are exact commands to downgrade:
…which currently results in this change in package.json
…and this happy picture:
@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
Can confirm the above error.
This seems to be fixed in
@nextalthough there’s another error in
nextA workaround for
nextis to setskibLibCheck: truein.storybook/tsconfig.jsonWe need to figure out the changes in5.2.0that might have solved this issueWe also need to figure out why
webpack-envmakes trouble in5.2.0-betaI think the problem is the new version of zone.js in Angular 8. I get this error when I try to upgrade my existing project from 7 to 8
Did anyone get this to work? By work I mean did anyone manage to do something useful with the tool beyond compiling a sample?
This is what I did:
"skipLibCheck": trueto.storybook/tsconfig.json@Input/@OutputAnd this is sad result I get (Chrome and Firefox):
This is what seems to be the most meaningful part of the error message:
Any hints how to get further? I would really like to start examining my components, but each time I try Storybook with Angular I cannot get far.
@bzkny Maybe you already caught this, but:
skibLibCheckevidently had a typo and should’ve beenskipLibCheckskipLibCheckgoes in thecompilerOptionsnot directly in the top level oftsconfig.jsonI put
"skipLibCheck": trueincompilerOptionsand the build stopped failing.Seems to be broken again somewhere after Angular
8.0.1.Steps to reproduce:
After this running
npm startandnpm run storybookyou can see this:If you substitute first two envrionment variables to:
…then you get to the happy end:
Not sure what to do with this one. I really wanted to try the tool out, but I don’t feel like downgrading my Angular project. Any workaround for Angular
8.2.0?Hello,
I’m facing an issue while trying to add storybook to an existing project.
The project runs:
Trying to install using:
npx sb initbut I’m getting the following error:Hello, I’ve got same issue as @asinitson and also if I remove styleUrls for component I get The template specified for componen is not a string
I force upgraded to Angular 8 and had no issues with storybook.
Sorry, I just realized I was replying to a subthread about upgrading, but this issue is about new installs. I created a separate issue for upgrading: https://github.com/storybookjs/storybook/issues/6951
I couldn’t reproduce it
Storybook version
5.1.0-rc.3
Angular version
I’m going to upgrade our companies storybook in the next couple of days and check if it fails The only bug I encountered was https://github.com/storybookjs/storybook/issues/6934