【问题标题】:I was trying to integrate tailwind into React Js and I got this error我试图将顺风集成到 React Js 中,但出现此错误
【发布时间】:2021-05-06 15:39:57
【问题描述】:

我正在使用 Postcss 和 autoprefixer 将 tailwind 集成到 React Js 中。

这是我在运行 npm start 或 npm run start 后立即得到的错误

npm 错误!代码生命周期 npm 错误!错误号 1 npm 错误! ethniquecity@0.1.0 开始:npm run watch:css && react-scripts start npm 错误!退出状态 1 npm 错误! npm 错误! ethniquecity@0.1.0 启动脚本失败。 npm 错误!这可能不是 npm 的问题。上面可能还有额外的日志输出。

npm 错误!可以在以下位置找到此运行的完整日志:

【问题讨论】:

    标签: reactjs npm frontend tailwind-css


    【解决方案1】:

    问题可能是,您可能没有在 package.json 中添加用于编译 sass 文件的命令。这是解决方案
    在查看 package.json 文件之前

    "scripts": {
      "start": "react-scripts start",
      "build": "react-scripts build",
      "test": "react-scripts test",
      "eject": "react-scripts eject"
    },

    查看 package.json 文件后

    "scripts": {
      "start": "npm run watch:css && react-scripts start",
      "build": "npm run build:css && react-scripts build",
      "test": "react-scripts test",
      "eject": "react-scripts eject",
      "build:css": "postcss src/styles/global.css -o src/styles/main.css",
      "watch:css": "postcss src/styles/global.css -o src/styles/main.css"
    },

    参考 - Webomnizz

    【讨论】:

      猜你喜欢
      • 2021-07-14
      • 2023-01-10
      • 1970-01-01
      • 1970-01-01
      • 2019-02-27
      • 2021-02-05
      • 1970-01-01
      • 2019-07-01
      • 2022-01-25
      相关资源
      最近更新 更多