grunt-contrib-sass
grunt-contrib-sass copied to clipboard
Path must be a string. Received undefined Use --force to continue.
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 ?
I get exactly the same. Did you sort it out?
I get the same... then I checked the path I've specified, and found a typo... fix the typo solved the issue.
@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.
@n8finch are you sure this is correct: 'assets/styles/boubon.css'
? The library is called Bourbon, with an "r".
@fschroiff haha, months ago:-). Issue resolved.
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.
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"
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 try using a dot or two, like cwd: "./scss"
or "../scss"
depending on where your scss
directory lies relative to Gruntfile.js
@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.
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.
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'
}]
@brunoscopelliti Mine was the same. There was a typo. Fixed the typo and it worked. Thanks
Also same issue, path directory was off, thanks
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!!!
I too had a typo in the files section of the grunt task. Once I fixed that it worked.