2

该命令npx -p @storybook/cli sb init --type vue用于安装 Storybook,现在当我运行时gridsome develop,我收到一堆关于core-js.

 ERROR  Failed to compile with 63 errors                                                                                                                                                                                                                  11:29:51 AM

These dependencies were not found:

* core-js/modules/es6.array.filter in ./node_modules/gridsome/app/router.js, ./node_modules/gridsome/app/components/Image.js and 2 others
* core-js/modules/es6.array.for-each in ./node_modules/gridsome/app/head.js, ./node_modules/gridsome/app/router.js and 5 others
* core-js/modules/es6.array.from in ./node_modules/gridsome/app/directives/image.js
* core-js/modules/es6.array.index-of in ./node_modules/gridsome/app/utils/class.js
* core-js/modules/es6.array.is-array in ./node_modules/gridsome/app/router.js, ./node_modules/gridsome/app/utils/class.js
* core-js/modules/es6.array.map in ./node_modules/gridsome/app/entry.client.js, ./node_modules/gridsome/app/router.js
* core-js/modules/es6.function.name in ./node_modules/gridsome/app/entry.client.js, ./node_modules/gridsome/app/fetchPath.js and 1 other
* core-js/modules/es6.number.constructor in ./node_modules/gridsome/app/components/Link.js
* core-js/modules/es6.object.define-properties in ./node_modules/gridsome/app/router.js, ./node_modules/gridsome/app/components/Link.js and 2 others
* core-js/modules/es6.object.define-property in ./node_modules/gridsome/app/router.js, ./node_modules/gridsome/app/components/Link.js and 2 others
* core-js/modules/es6.object.keys in ./node_modules/gridsome/app/router.js, ./node_modules/gridsome/app/components/Image.js and 2 others
* core-js/modules/es6.regexp.constructor in ./node_modules/gridsome/app/components/Link.js, ./node_modules/gridsome/app/utils/helpers.js
* core-js/modules/es6.regexp.replace in ./node_modules/gridsome/app/utils/class.js, ./node_modules/gridsome/app/utils/helpers.js
* core-js/modules/es6.regexp.search in ./node_modules/gridsome/app/entry.client.js
* core-js/modules/es6.regexp.split in ./node_modules/gridsome/app/utils/class.js, ./node_modules/gridsome/app/utils/helpers.js
* core-js/modules/es6.string.ends-with in ./node_modules/gridsome/app/directives/image.js
* core-js/modules/es6.string.iterator in ./node_modules/gridsome/app/entry.client.js, ./node_modules/gridsome/app/directives/image.js
* core-js/modules/es6.string.link in ./node_modules/gridsome/app/head.js
* core-js/modules/es6.string.starts-with in ./node_modules/gridsome/app/entry.client.js, ./node_modules/gridsome/app/components/Link.js and 1 other
* core-js/modules/es6.string.trim in ./node_modules/gridsome/app/utils/class.js
* core-js/modules/es6.symbol in ./node_modules/gridsome/app/app.js
* core-js/modules/es7.object.get-own-property-descriptors in ./node_modules/gridsome/app/router.js, ./node_modules/gridsome/app/components/Link.js and 2 others
* core-js/modules/es7.symbol.async-iterator in ./node_modules/gridsome/app/app.js
* core-js/modules/web.dom.iterable in ./node_modules/gridsome/app/router.js, ./node_modules/gridsome/app/app.js and 7 others

该错误确实提供了通过专门安装每个错误来修复它的选项,但我认为这不是必需的(并且安装命令无论如何都不起作用)

在创建新项目时,我没有任何来自 Gridsome 提供的自定义 babel 配置,但是在进行了一些搜索之后,我尝试添加babel.config.js具有以下内容的文件:

module.exports = {
  presets: [ [ "@vue/app", { useBuiltIns: "entry" } ] ]
};

然而,这似乎根本没有帮助这个问题。

我在 Github 上创建了一个复制问题的存储库:https ://github.com/denno020/storybookBreakingGridsome

谁能解释为什么 Storybook 会打破 Gridsome?

4

0 回答 0