Search code examples
cssnpmsasspostcssautoprefixer

Autoprefixer script doesn't run TypeError: Patterns must be a string or an array of strings


I installed autoprefixer and postcss-cli successfully. I am trying to "Set up a simple build process with NPM scripts" using my command prompt and VS code. I am watching a tutorial on CSS/SASS topics as I only have 2 months of coding experience and don't quite understand how to debug yet. I completed the code I wanted and now I am trying to compile everything into a compressed style.css doc... I successfully concatenated everything but now I am having trouble with prefixing.

In the command prompt I am typing: npm run prefix:css which is running this script: postcss --use autoprefixer -b 'last 10 versions' css/style.concat.css -o css/style.prefix.css

I get:

TypeError: Patterns must be a string or an array of strings 
 at assertPatternsInput (C:\Users\mjpry\Desktop\advanced-css-course master\Natours\starter\node_modules\globby\index.js:17:9)
    at generateGlobTasks (C:\Users\mjpry\Desktop\advanced-css-course-master\Natours\starter\node_modules\globby\index.js:42:2)
    at module.exports (C:\Users\mjpry\Desktop\advanced-css-course-master\Natours\starter\node_modules\globby\index.js:116:20)
    at C:\Users\mjpry\Desktop\advanced-css-course-master\Natours\starter\node_modules\postcss-cli\index.js:59:14
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] 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 [email protected] 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\mjpry\AppData\Roaming\npm-cache\_logs\2020-01-29T23_00_22_951Z-debug.log

Like I said.... not enough experience to even start solving this. Id suspect that it isn't the Node_Modules that is the problem like what this error seems to be catching... but I don't know what to do regardless. Help please!

Screenshot of errors


Solution

  • If you're using windows (and you do as you paths show) try the following:

    postcss --use autoprefixer -b \"last 10 versions\" css/style.concat.css -o css/style.prefix.css

    From: https://github.com/npm/npm/issues/20048