将 create-react-app 转换为 Gatsby 后出错。 WEBPACK:浏览器查询必须是数组或字符串。得到对象
Error after converting create-react-app to Gatsby. WEBPACK: Browser queries must be an array or string. Got object
我正在将我的 create-react-app 转换为 Gatsby。为此,我采用了我现有的项目并执行了 npm install gatsby,安装了 gatsby-cli
,然后从一个新的 Gatsby 站点复制了项目结构的变化。然后,我将 App.js 移动到 src/pages/index.js。我最终删除了从 gatsby new
创建的站点复制的 gatsby-config.js,因为我不知道如何安装 gatsby-plugin-react-helmet
插件。我不知道是否需要 gatsby-config.js 指定的插件才能使网站正常工作。
本项目使用react-circular-progressbar实现了一个循环进度条。尝试使用 gatsby build
构建我的应用程序时,出现此错误:
Unknown error from PostCSS plugin. Your current PostCSS version is 6.0.23, but autoprefixer uses 7.0.26. Perhaps this is the source of the error below.
ERROR #98123 WEBPACK
Generating development JavaScript bundle failed
Browser queries must be an array or string. Got object.
File: node_modules/react-circular-progressbar/dist/styles.css
我使用 npm i postcss
将 PostCSS 更新到 7.0.26,但它仍然说我使用的是旧版本。
如果你检查这个 link,你会看到这个错误。
我不确定浏览器查询是什么,但我检查了错误中引用的 styles.css 文件,我看到的唯一内容是 class 样式,然后是浏览器特定样式:
-webkit-transition: stroke-dashoffset 0.5s ease 0s;
删除此行并不能解决问题。
gatsby-config.js
是必不可少的Gatsby configuration files之一。不把这个文件加回来调试肯定是没希望的
从 official documentation and add the PostCSS plugin as described in the documentation 复制空的 gatsby-config.js
。重新运行 npm 或 yarn。 运行 gatsby clean
然后 gatsby develop
.
该错误很可能是由于缺少 POSTCSS 插件应该提供并可以轻松解决的源或配置文件造成的。
您的网站现在可以使用了吗?
我正在将我的 create-react-app 转换为 Gatsby。为此,我采用了我现有的项目并执行了 npm install gatsby,安装了 gatsby-cli
,然后从一个新的 Gatsby 站点复制了项目结构的变化。然后,我将 App.js 移动到 src/pages/index.js。我最终删除了从 gatsby new
创建的站点复制的 gatsby-config.js,因为我不知道如何安装 gatsby-plugin-react-helmet
插件。我不知道是否需要 gatsby-config.js 指定的插件才能使网站正常工作。
本项目使用react-circular-progressbar实现了一个循环进度条。尝试使用 gatsby build
构建我的应用程序时,出现此错误:
Unknown error from PostCSS plugin. Your current PostCSS version is 6.0.23, but autoprefixer uses 7.0.26. Perhaps this is the source of the error below.
ERROR #98123 WEBPACK
Generating development JavaScript bundle failed
Browser queries must be an array or string. Got object.
File: node_modules/react-circular-progressbar/dist/styles.css
我使用 npm i postcss
将 PostCSS 更新到 7.0.26,但它仍然说我使用的是旧版本。
如果你检查这个 link,你会看到这个错误。
我不确定浏览器查询是什么,但我检查了错误中引用的 styles.css 文件,我看到的唯一内容是 class 样式,然后是浏览器特定样式:
-webkit-transition: stroke-dashoffset 0.5s ease 0s;
删除此行并不能解决问题。
gatsby-config.js
是必不可少的Gatsby configuration files之一。不把这个文件加回来调试肯定是没希望的
从 official documentation and add the PostCSS plugin as described in the documentation 复制空的 gatsby-config.js
。重新运行 npm 或 yarn。 运行 gatsby clean
然后 gatsby develop
.
该错误很可能是由于缺少 POSTCSS 插件应该提供并可以轻松解决的源或配置文件造成的。
您的网站现在可以使用了吗?