postcss / postcss-cli

CLI for postcss
Other
840 stars 93 forks source link

Expected `cwd` to be of type `string` but received type `undefined` #264

Closed Marzdor closed 5 years ago

Marzdor commented 5 years ago

I've been using the same script and config for my postcss now all of a sudden like maybe 30min ago I always get this error and I am not sure why.

"postcss": "postcss --config postcss.config.js -w src/css/main.css -o src/css/index.css"

/// config
module.exports = () => ({
  plugins: {
    autoprefixer: {
      browsers: "> 5%"
    },
    "postcss-import": {},
    "postcss-mixins": {},
    "postcss-nested": {},
    "postcss-simple-vars": {}
  }
});
$ npm run postcss

> brodericks-compendium@1.0.0 postcss A:\Documents\web\brodericks-compendium
> npm run postcss --prefix client

> client@0.1.0 postcss A:\Documents\web\brodericks-compendium\client
> postcss --config postcss.config.js -w src/css/main.css -o src/css/index.css

TypeError: Expected `cwd` to be of type `string` but received type `undefined`
    at module.exports (A:\Documents\web\brodericks-compendium\client\node_modules\dir-glob\index.js:44:25)
    at globDirs (A:\Documents\web\brodericks-compendium\client\node_modules\globby\index.js:58:9)
    at getPattern (A:\Documents\web\brodericks-compendium\client\node_modules\globby\index.js:61:64)
    at Promise.all.globTasks.map.task (A:\Documents\web\brodericks-compendium\client\node_modules\globby\index.js:72:69)
    at Array.map (<anonymous>)
    at module.exports (A:\Documents\web\brodericks-compendium\client\node_modules\globby\index.js:72:41)
    at Promise.resolve.then (A:\Documents\web\brodericks-compendium\client\node_modules\postcss-cli\index.js:58:14)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
    at Function.Module.runMain (module.js:695:11)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! client@0.1.0 postcss: `postcss --config postcss.config.js -w src/css/main.css -o src/css/index.css`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the client@0.1.0 postcss 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\Marzdor\AppData\Roaming\npm-cache\_logs\2019-01-11T01_35_10_036Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! brodericks-compendium@1.0.0 postcss: `npm run postcss --prefix client`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the brodericks-compendium@1.0.0 postcss script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
RyanZim commented 5 years ago

Not sure, there was a bug in our underlying glob library, try doing a fresh install.

Marzdor commented 5 years ago

I have tried doing a fresh install even deleted all local files and cloned my repo still getting the same error. And the script seems to still work in my other project just not this one.

Marzdor commented 5 years ago

Not sure exactly what was causing it but I think I did something with my files. I manage to fix it by taking my other project as my base and slowly replacing the files with the ones from the project that was giving me this error.

RyanZim commented 5 years ago

Please make a reduced test case repo.

Marzdor commented 5 years ago

Never done that before nor am I entirely sure what it is.

RyanZim commented 5 years ago

@Marzdor If you've managed to fix it on your end; no need, I somehow failed to see you'd commented and closed the issue.