Source map error when attempting to run grunt server - sass

I'm unable to access my sass files when running grunt server. Not sure if this is just a file path/permission error or something greater.
Running sudo grunt server gives the same output
grunt server
Running "server" task
Running "clean:dist" (clean) task
Running "copy:video_fonts" (copy) task
Copied 4 files
Running "copy:video_js" (copy) task
Copied 1 files
Running "concurrent:dist" (concurrent) task
Warning: Error: Error generating source map: couldn't determine public URL for the source stylesheet.
No filename is available so there's nothing for the source map to link to.
on line of standard input
Use --trace for backtrace. Use --force to continue.
Aborted due to warnings.
%
I get the following error in my browser when I run grunt server --force
Sass::SyntaxError: Error generating source map: couldn't determine public URL for the source stylesheet.
No filename is available so there's nothing for the source map to link to.

I had the same problem on a grunt task that was perfectly working a couple of days ago. I suppose the problem was in some misalignment between the modules for that project (specifically grunt-contrib-sass) and the version of SASS installed.
I solved the problem by upgrading SASS, removing the node_modules folder inside my project and re-installing them.
I am sorry I cannot provide you any reason why it worked, but it did.
Update:
$ rm -R node_modules
$ npm install
Try:
$ grunt --debug --verbose sass
To get more info about what's happening while grunt runs.
S.

Related

Yarn failing to start service based on "path/" argument must be of type string, Vue application, windows10

I am using a template, Vue cli3 application and it stopped working and I don't recall why. The error I am receiving is when I try to start the application I get this error.
yarn run serve
yarn run v1.16.0
error An unexpected error occurred: "The \"path\" argument must be of type string. Received type object".
info If you think this is a bug, please open a bug report with the information provided in "C:\\node\\TradeTriggers\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I can delete the node_modules and package.json.lock
I cannot do anything with yarn. No yarn install, yarn run serve, nothing and npm doesn't seem to want to run the application. I'm sorry there are a lot of tools to know in the JS world!
The machine is a windows10 machine and I cannot find yarn in my env variables, so the issue may lie there. I even tried installing the Yarn MSI but my version is still the one I installed through npm a while ago, still nothing.
I had problem that was caused by yarn looking at first the global settings file, ie global registry. It might be similar. On Windows, first check your yarn config path:
yarn config bin
Windows shows the path. Then in that folder, check whether you have a "rc" file, ie that is yarn configuration.
Try move this file out of the folder, for test. Have it as a copy somewhere else, where you can restore it if this does not help.
Then, once file is out, run your yarn commands again like you used to.
Sideline: on Linux, I had to remove a leftover buggy .yarnrc file in
/usr/local/share/.yarnrc
to get similar things working again. It was not a Vue app, but similar kind of error.
This error can occur when you are using Yarn Workspaces and have incompatible directories in the packages/ directory.
In my scenario, I used git subtrees to pull another repo into my project's packages/ directory. This directory had a package.json file, but it did not have compatible values for the fields required by Yarn Workspaces.
Moving the problematic package out of packages/ should fix this issue.

How can I keep grunt separate from my source files?

I've spent about a day trying to figure this out.
What I finally did was a bash script:
gw() {
# runs grunt using this path
cd ~/root_install/grunt
grunt watch &
cd ~/root
}
My install file are in root_install and my source file are in root.
Note installing the grunt task runner globally is deprecated.
Note that setting the location of the Gruntfile.js does not work as it appears to need a local installation of the task runner.
This seems to be the deal killer.
But alas, application files I want separate from my source files and Grunt is an application.
What I have works, but it is a bit hackish as I don't want to spend any more time on this.

sass source map issues on OS X Yosemite

I recently updated to OSX Yosemite and now, when I run Grunt and make changes to the sass file in my project, I receive the following error:
Warning: Error: Error generating source map: couldn't determine public URL for the source stylesheet.
No filename is available so there's nothing for the source map to link to.
on line of standard input
Use --trace for backtrace. Use --force to continue.
I have made no other changes to my Grunt setup or sass:dist, dependencies are unchanged and so forth. Any help resolving this would be greatly appreciated. Thanks!
This issue can have more than one reason, maybe this will help you.
Before starting remove the compiled css!
Update grunt-contrib-sass to the latest version
Sourcemap Requires Sass 3.4.0, which can be installed with gem install sass
Run grunt sass task and review compiled css.
When everything is updated, the sourcemap should be automatically created and available. Be sure to empty browser cache before testing in the browser.

Installing the correct environment for Angular with Compass and all other Node dependencies

I am just trying to make a local development environment that isn't on my work computer, and I keep getting an error:
Warning: Errno::ENOENT on line 441 of /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/pathname.rb: No such file or directory - /Users/johnpett/Desktop/Node/app/bower_components
Run with --trace to see the full backtrace Use --force to continue.
I have installed all the Ruby parts and Yeoman to build the app scaffold, but I can't seem to run the 'grunt server' command without throwing up this error.
The error is quite clear, a grunt-plugin require that file...
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/pathname.rb
Anyway ruby components are needed usually if you plan to use compass, if not, you can comment the "compass" sub-task in the "server" task in Gruntfile.js
Your folder was surely not called bower_components at that time. I guess you used yeoman.
In your compass task config you should have modified bower_components.

When running grunt on Windows, I receive "Access is Denied" error with default grunt.js file

I'm getting grunt.js setup on a Windows 7 machine. I've got Grunt setup on my %PATH%, but when I try to execute it, I receive this error:
C:\project>grunt
Access is denied.
However, if I rename the grunt file from grunt.js to gruntfile.js and rerun Grunt using the --config flag, it works:
C:\project>grunt --config gruntfile.js
...Lots of Grunt output...
5 specs, 0 failures in 0.041s.
Done, without errors.
My %PATH% is setup with follows:
set PATH=.;%NODE_HOME%;%PATH%
Any idea why I'm seeing this "Access is denied" error?
Grunt's FAQ gives me the solution:
If you're in the same directory as the grunt.js gruntfile, Windows
tries to execute that file when you type grunt. So you need to type
grunt.cmd instead.
The FAQ just showed a different output than what I was seeing; using grunt.cmd fixes it.

Resources