安装 @nuxtjs/apollo 时的 NPM 警告
Posted
技术标签:
【中文标题】安装 @nuxtjs/apollo 时的 NPM 警告【英文标题】:NPM warnings when installing @nuxtjs/apollo 【发布时间】:2021-09-07 02:23:10 【问题描述】:我对终端/CMD 不是很有信心,在通过npx create-nuxt-app
设置 Nuxt 项目后,我正在尝试安装 Nuxt 的 Apollo 模块。当我这样做时,通过我的 Nuxt 目录中的npm install @nuxtjs/apollo@latest
,我得到以下 gumf:
npm WARN tailwindcss@2.2.2 requires a peer of autoprefixer@^10.0.2 but none is installed. You must install peer dependencies yourself.
npm WARN vue-cli-plugin-apollo@0.22.2 requires a peer of @vue/cli-shared-utils@^3.0.0 || ^4.0.0-0 but none is installed. You must install peer dependencies yourself.
npm WARN apollo-link-persisted-queries@0.2.2 requires a peer of graphql@^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ts-node@8.10.2 requires a peer of typescript@>=2.7 but none is installed. You must install peer dependencies yourself.
npm WARN @apollographql/graphql-language-service-interface@2.0.2 requires a peer of graphql@^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @apollographql/graphql-language-service-utils@2.0.2 requires a peer of graphql@^0.12.0 || ^0.13.0 || ^14.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @apollographql/graphql-language-service-types@2.0.2 requires a peer of graphql@^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @apollographql/graphql-language-service-parser@2.0.2 requires a peer of graphql@^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted "os":"darwin","arch":"any" (current: "os":"win32","arch":"x64")
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted "os":"darwin","arch":"any" (current: "os":"win32","arch":"x64")
我不知道这是否重要。然后它邀请我运行npm audit fix
,我这样做了,然后它告诉我它能够修复 15 个问题中的 0 个,并且需要手动修复。
我做错了什么?
【问题讨论】:
【参考方案1】:如果你是:
对 CLI 命令没有信心 使用 NPM 而不是 yarn(仔细检查您的项目中是否没有任何yarn.lock
)
没有任何严重问题
然后您就可以安全地继续前进了。在这里,你只有警告,这是 JS 世界的日常。没什么好担心的。
此外,如果您能够在控制台(浏览器和 CLI)中运行项目而不会出现任何错误,那么您就可以开始了!
【讨论】:
谢谢。是的,我在 Yarn 上使用 NPM。当你按照教程所说的去做时,这有点令人生畏,而且你会遇到一堵 NPM 警告墙! 是的,JS 生态系统发展迅速,因此出现了所有警告。一开始确实可能有点令人惊讶。以上是关于安装 @nuxtjs/apollo 时的 NPM 警告的主要内容,如果未能解决你的问题,请参考以下文章
如何使用 NestJS GraphQL 实现 NuxtJS Apollo
NuxtJS Apollo 模块 TypeError:无法读取未定义的属性“$apolloHelpers”
@Nuxt/Apollo 如何从 gql 查询中删除“__typeName”
npm 错误!纤维@4.0.2 安装:`node build.js ||在 Nuxt 中安装 Vuetify 时的 nodejs build.js`