css - 在 npm 中运行前缀时遇到问题
问题描述
我正在尝试运行前缀 CSS 并且我已经在开发环境中安装了前缀 npm 包和 postcss-cli 包。在为我的 CSS 文件运行前缀时,出现了一些错误。这是错误日志-
TypeError: Patterns must be a string or an array of strings
at assertPatternsInput (E:\CODING GOOGLE DRIVE\CSS-SAAS\Natours\starter\node_modules\globby\index.js:16:9)
at generateGlobTasks (E:\CODING GOOGLE DRIVE\CSS-SAAS\Natours\starter\node_modules\globby\index.js:41:2)
at module.exports (E:\CODING GOOGLE DRIVE\CSS-SAAS\Natours\starter\node_modules\globby\index.js:115:20)
at E:\CODING GOOGLE DRIVE\CSS-SAAS\Natours\starter\node_modules\postcss-cli\index.js:59:14
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! isuro-portfolio@1.0.0 prefix:css: `postcss --use autoprefixer -b 'last 10 versions' css/style.concat.css -o css/style.prefix.css`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the isuro-portfolio@1.0.0 prefix:css script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\isuro\AppData\Roaming\npm-cache\_logs\2020-08-22T04_51_28_876Z-debug.log
&这里是 JSON 文件-
{
"name": "isuro-portfolio",
"version": "1.0.0",
"description": "Landing Page For Isuro.tech",
"main": "index.js",
"scripts": {
"watch:sass": "node-sass sass/main.scss css/style.css -w",
"compile:sass": "node-sass sass/main.scss css/style.comp.css",
"concat:css": "concat -o css/style.concat.css css/icon-font.css css/style.comp.css",
"prefix:css": "postcss --use autoprefixer -b 'last 10 versions' css/style.concat.css -o css/style.prefix.css",
"compress:css": ""
},
"author": "Surojit Manna",
"license": "ISC",
"devDependencies": {
"autoprefixer": "^9.8.6",
"concat": "^1.0.3",
"node-sass": "^4.14.1",
"postcss-cli": "^7.1.1"
}
}
无法理解我犯了什么类型的错误。我还仔细检查了所有内容。任何帮助将不胜感激。
解决方案
我觉得这里单引号不起作用,我们需要双引号,如错误所述。它对我有用!
尝试使用
"prefix:css": "postcss --use autoprefixer -b \"last 10 versions\" css/style.concat.css -o css/style.prefix.css"
推荐阅读
- javascript - 使用从父级传递的道具将路由器导航链接反应到另一个页面
- python - 如何使用 brython 导入类?
- javascript - TypeError:this.props.postRecipes 不是函数
- linux - 如何杀死 TASK_KILLABLE 进程?
- node.js - 通过反向代理提供的 nuxt 应用程序在浏览器中产生 ERR_INCOMPLETE_CHUNKED_ENCODING 错误
- python - 如何在缓慢的烧瓶 api 中处理并发?
- typescript - “是对象”和非空的 TypeScript 表示法
- python - 如何使用python获取这个url(来自微信)?
- find - 在 MingW 中使用“find -exec grep”
- python - 如何根据熊猫中的位置获取子字符串?