0

执行 npm run storybook 后,该过程失败并出现以下错误:

ERR! => Could not get angular cli webpack config
4

2 回答 2

2

我有同样的问题。对我来说,解决方法是在 angular.json 文件中专门命名“root”和“sourceRoot”的路径。

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "storybook": {
      "projectType": "application",
      "sourceRoot": "projects/my-lib/src/lib",
      "root": "projects/my-lib",
      "architect": {
         ...
      },
    ...
    },
  ...
  },
}
于 2021-10-25T09:25:08.260 回答
-1

此错误通常发生在为 angular.json 文件中的资产添加其他源时。

使固定:

  1. 从 angular.json 下的资产中删除其他来源

  2. 打开 package.json 并编辑 storybook 脚本,如下所示:

    "storybook": "npm run docs:json && start-storybook -p 6006 -s projects/"

于 2021-09-03T09:06:06.543 回答