grunt-contrib-sass icon indicating copy to clipboard operation
grunt-contrib-sass copied to clipboard

Path must be a string. Received undefined Use --force to continue.

Open liadlivnat opened this issue 8 years ago • 16 comments

Hi,

for some reason i get this error: Path must be a string. Received undefined Use --force to continue.

this is the grunt.js code:

sass: {
      dist: {
        options: {
          sourcemap: false
        },
        files: {
          'css/main.css' : 'scss/main.scss'
        }
      }
    },

Any idea hot to get rid of the error ?

liadlivnat avatar Mar 12 '16 08:03 liadlivnat

I get exactly the same. Did you sort it out?

digeomel avatar Jun 02 '16 15:06 digeomel

I get the same... then I checked the path I've specified, and found a typo... fix the typo solved the issue.

brunoscopelliti avatar Jun 09 '16 04:06 brunoscopelliti

@n8finch to me it looks like the paths on the left are relative and the paths on the right are absolute, and from the looks of it, the paths on the right are wrong.

digeomel avatar Aug 05 '16 11:08 digeomel

@n8finch are you sure this is correct: 'assets/styles/boubon.css'? The library is called Bourbon, with an "r".

fschroiff avatar Nov 15 '16 15:11 fschroiff

@fschroiff haha, months ago:-). Issue resolved.

n8finch avatar Nov 15 '16 23:11 n8finch

In my case I was running the task and I had no .scss file in that folder. It seems that the task breaks if your folder is empty.

mihaiconstantin avatar Nov 27 '16 10:11 mihaiconstantin

Mine was the same issue as mihaiconstantin. In Node v4.5.0 an empty src dir was fine, but in Node v6.2.0 that's a breaking error: "Path must be a string. Received undefined"

kirkportas avatar Dec 08 '16 20:12 kirkportas

Is there a solution to this?

 sass: {
     options: {
        compass: true
             },
             dist: {
                 files: [{
                     expanded: true,
                     cwd: "scss", // tried "/scss/", "/scss", "scss/"
                     src: ["*.scss"], // tried "/*.scss"
                     dest: "css",
                     ext: ".css"
                 }]
             }
         }

Nothing works.

Rc85 avatar Jun 01 '17 15:06 Rc85

@Rc85 try using a dot or two, like cwd: "./scss" or "../scss" depending on where your scss directory lies relative to Gruntfile.js

digeomel avatar Jun 01 '17 15:06 digeomel

@digeomel I tried those. My scss is in the same directory as Gruntfile.js.

My working tree

root
    /scss
    Gruntfile.js

Using "scss", "./scss", or __dirname + "/scss" , I get

Errno::ENOENT No such file or directory @ rb_sysopen - main.scss

Using "/scss", I get

Warning: Path must be a string. Received undefined

I'm out of ideas.

Rc85 avatar Jun 02 '17 03:06 Rc85

I am getting this error on Travis CI only, locally I am not getting this error. Travis has the same node.js version as my local (6.11.4). Could this still be an issue with path name if it works locally and not on Travis? I've ruled out a typo for this reason.

EDIT: For me, it was case sensitivity. For whatever reason, it didn't matter locally on my Mac, but Travis complains if incorrect case.

esr360 avatar Oct 05 '17 02:10 esr360

For me it was the usage of array instead of a string for cwd, src, and dest. This worked:

      files: [{
                  expand: true,
                  cwd: './static/frontend/css/', // Parent folder of original CSS templates
                  src: '*.scss', // Collects all `*.css` files within the parent folder
                  dest: './static/grunted', // Stores the collected `*.css` files in your `src/css/` folder
                  ext: '.css'
       }]

lakesare avatar Jun 05 '18 20:06 lakesare

@brunoscopelliti Mine was the same. There was a typo. Fixed the typo and it worked. Thanks

dmcshehan avatar Jul 20 '18 04:07 dmcshehan

Also same issue, path directory was off, thanks

Sparlix avatar Apr 23 '22 02:04 Sparlix

Hi,

for some reason i get this error: Path must be a string. Received undefined Use --force to continue.

this is the grunt.js code:

sass: {
      dist: {
        options: {
          sourcemap: false
        },
        files: {
          'css/main.css' : 'scss/main.scss'
        }
      }
    },

Any idea hot to get rid of the error ?

It is 2024 and it still is an issue!!!

atiq-xs avatar Jan 06 '24 08:01 atiq-xs

I too had a typo in the files section of the grunt task. Once I fixed that it worked.

tlsimmons88 avatar Jan 25 '24 15:01 tlsimmons88