# 1. PostCSS 警告问题

# 错误原因

nuxt-2 版本^2.15.8 版本 需要PostCSS 版本

# 错误代码

WARN You did not set any plugins, parser, or stringifier. Right now, PostCSS does nothing. Pick plugins for your case on https://www.postcss.parts/ and use them in postcss.co

# 解决方案

下面两个方法都可以解决这个问题

  1. 安装 postcss8 插件
npm i -D @nuxt/postcss8 @nuxtjs/style-resources
1
  1. 在 nuxt.config.js 的 buildModules 下添加
export default {
...
    buildModules: [
      '@nuxtjs/style-resources',
      '@nuxt/postcss8',
    ],
...
}
1
2
3
4
5
6
7
8




# 2. generate 构建静态页面时报错: is not in cwd

# 错误原因

nuxt-2 Windows 路径引起的问题。

# 错误代码

nuxt.config.js is not in cwd

# 解决方案

在 node_modules 找到@nuxt 对应目录下的 cwd: rootDir, 把它替换为 cwd: upath.normalize ( rootDir ),

更新时间: 2024/7/30 17:14:28