Nuxtjs/google-fonts 包出现“未知文件扩展名”错误

问题描述 投票:0回答:1

按照docs,我通过

npm install -D @nuxtjs/google-fonts
安装了软件包(因为我正在使用
Nuxt v2.14.7
),然后将“@nuxtjs/google-fonts”添加到
buildModules
中的
nuxt.config.js
数组中。

只要这样做,我立即收到此错误:

致命的未知文件扩展名: D:\项目... ode_modules\pathe\dist\index.cjs

错误 [ERR_UNKNOWN_FILE_EXTENSION]:未知的文件扩展名: node_modules\pathe\dist\index.cjs 位于 /D:/projects/.../node_modules/@nuxtjs/google-fonts/dist/module.mjs:1 在 Generator.next ()

知道这里出了什么问题吗?

nuxt.js file-extension
1个回答
0
投票
  1. 删除
    node_modules
    文件夹,
  2. 删除
    package.lock.json
    ,
  3. 通过运行
    npm cache clean --force
    ,
  4. 清理 NPM 缓存
  5. 最后,你可以尝试
    npm install

如果这不起作用,请尝试使用

@nuxtjs/google-fonts
删除
npm remove @nuxtjs/google-fonts
并重新安装
npm install -D @nuxtjs/google-fonts

我希望这能成功

© www.soinside.com 2019 - 2024. All rights reserved.