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

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.

Related

Windows Script Host Error: Invalid character - Code:800A03F6 - Source: Microsoft JScript compilation error

I'm having an issue with Powershell and CMD. When I try to execute Angular CLI commands in CMD like ng --version or ng new projectName, I get this error;
Windows Script Host Error: Invalid character
Code: 800A03F6
Source: Microsoft JScript compilation error
Update:
On Windows .js files are associated to Windows Scripting Host by default, so the script will not be run with Node.
Open a file explorer and find a JavaScript file, open the JavaScript file's properties and then "open with", select the Node.js program file to open that kind of files.
The error should stop after doing this.
This is how I solved it: (on windows 10)
Go to C:\Users\<your_username>\AppData\Roaming\npm\node_modules\#angular\cli\bin
Check for ng.js
Right click on ng.js file and click on "properties" option
You need to open it with node.exe so click on "Change" button go to node js installed directory and
(example: C:\Program Files\nodejs\node.exe)
Select node.exe
Click on OK
It should change the color of ng.js like below:
Now try ng -v and other ng commands
Installing this exact Angular version:
npm -g install #angular/cli#10.3.1
instead of the latest version:
npm -g install #angular/cli
fixed the above error.
I ran into this exact issue after updating to Angular CLI 13. Tried tons of different suggestions from other threads. What is described in the solutions here is essentially what worked for me, but I just want to point out a possible alternative method to applying the fix that doesn't associate all JS files with node.js.
Trying to execute a script from package.json on Windows throws a JScript error
In your windows system environment variables is one variable called PATHEXT. If the value contains .JS;, remove it. Then restart your CMD windows.
make sure you have proper path variable configured as shown below
Go to your system variable settings
path variable snapshot
make sure you have all these mentioned as part of path
C:\Users<userfolder>\AppData\Roaming\npm\node_modules#angular\cli
C:\Users<userfolder>\AppData\Roaming\npm
C:\Program Files\nodejs
make sure you have all these mentioned as part of path C:\Users\AppData\Roaming\npm\node_modules#angular\cli C:\Users\AppData\Roaming\npm C:\Program Files\nodejs
in my case, before npm install -g #angular/cli, the path of my system variable was:
C:\Users\AppData\Roaming\npm\node_modules#angular\cli\bin
I remove \bin and work!!!!!
Remember to fix this for the correct User
Associating .JS files to node.exe is the way to solve this.
BUT after struggling with the same issue, I wanted to add that the file association needs to be done with the same USER that you are working with the Terminal/Shell.
So if you use the Terminal as a Admin, you must login with your Admin Account just to fix the file association.
Cheers

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.

Windows 10 golang setup. Error, Not in an environment

I am running into issues setting up go for the first time on a Windows 10 machine.
I followed the instructions from the install. https://golang.org/doc/install?download=go1.10.windows-386.msi
When I CD to my project E:\goProjects\goWebApp\src and run go build, I receive the following error.
C:\windows\system32>go version
Not in an environment
C:\Users\MyUser~1\AppData\Local\Temp\go_there.bat' is not recognized as an internal or external command,
operable program or batch file.
My system variables are as follows:
GOPATH=E:\goProjects\goWebApp
GOROOT=C:\Go
PATH=C:\Go\bin
If I run go version from C:\Go\bin everything works fine. Running go command from anywhere outside of this directory does not work. I have also tried restarting my cmd prompt and restarting my computer. Still no luck. Has anyone else ran into this issue? Or know what I might have done wrong?
Turns out I had two go locations in my PATH (sort of). When I ran the command where go from command prompt two paths were returned.
Something like this..
C:\tools\devTools\bin
C:\Go\bin\go.exe
There apparently was a bat file in devTools\bin called go.bat. This was unrelated to golang itself, just coincidental naming unfortunately.This was executing instead of the go binary, which in return was throwing the random error with the Not in an environment message.
To fix the issue I just removed the devTools path from my PATH variable for now.

Source map error when attempting to run grunt server

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.

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.

Resources