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

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

Related

Error in cmd as python version not showing

While i write
python --version
I get nothing as a result in command prompt. I should get the version details of python, correct? how to rectify it?
Its the same for pip also, which file to download and how to install them, .whl or .grz? The guide shows method using pip --version which again is not working in cmd at the first place.
You did not say how your issue was solved, so I had to figure it out myself.
My problem was a 0kb Python.exe in the WindowsApps folder, which is in the PATH environmental variable. I just deleted that file, and everything worked.
I found entering python --version in terminal didn't work either, but entering py --version did.
Had the same problem. I fixed the problem by adding the python.exe directory to environment variables
Open System Properties (Right click Computer in the start menu, or use the keyboard shortcut Win+Pause)
Click Advanced system settings in the sidebar.
Click Environment Variables...
Select PATH in the System variables section
Click Edit
Add Python's path to the end of the list (the paths are separated by semicolons). For example:
C:\Windows;C:\Windows\System32;C:\Python27

Error adding vagrant box in PHPStorm 7, ruby.exe error

My PHPStorm 7 installation is throwing this error whenever I try to add a box. Am I missing something?
I pointed to the vagrant.bat in installation directory as told here
Am I supposed to install ruby too? Didn't say something like that in vagrant's site though.
The path to the .bat file you are using (...\embedded\gems\...) suggests that it is ruby related .. and may require ruby for proper executing (the error message you see confirms such suggestion).
Instead, choose vagrant executable from C:\Program Files (x86)\HashiCorp\Vagrant\bin\ folder.
If .bat file is absent -- choose .exe one instead.

npm global install does not add packages to PATH on Windows 8.1

When I run npm install -g <package> it installs the packages in my user/AppData/Roaming/npm/npm_modules/ folder. This sub-folder is not in my PATH so if I try to run the package without explicitly calling the entire path the call fails with a '<package>' is not recognized as an internal or external command, operable program or batch file.
What can I do to fix this?
Thanks
I'm using win8.1 and I found that the nodejs installer didn't add the path to global node modules to the system PATH. Just add %AppData%\npm; to the user variable(since %AppData% dir is depending on user) PATH to fix it.
You will need to log out then log back in for the change to your PATH variable to take effect.
SET PATH=%AppData%\npm;%PATH%
You have to run this line SET PATH=pathtonodejs;%PATH% (where pathtonodejs is where you installed nodejs) once the installation for nodejs is complete and it should work.
It turned the problem was a change in behavior of the module I was using.
I'd been following old tutorials for using Express.js. The old tutorials assumed Express would be in my path after installing it globally, but as of Express v4.0 there's a separate Express module you have to install in order to get it in your path

Netbeans - installing SASS

I have had a few attempts at installing SASS on netbeans. I have followed the following tutorial:
http://kgagliardo.com/blog/netbeans-sass-windows-7
I get the below error when creating and trying to save the SASS file and no CSS file is created.
""C:\Ruby193\bin\sass.bat" "--cache-location"
"C:\Users\Leanne\AppData\Local\NetBeans\Cache\7.4\sass-compiler"
"C:\Users\Leanne\Documents\work\freelance\sites\fws_templates\gamer\scss\store.scss"
"C:\Users\Leanne\Documents\work\freelance\sites\fws_templates\gamer\css\store.css"
'"ruby.exe"' is not recognized as an internal or external command,
operable program or batch file. Done."
I've been stuck on this all morning, please help...
UPDATE
I've tried to follow the instructions provided below and it still does not work, although I did get a slightly different error message:
"C:\Ruby193\bin\sass.bat" "--cache-location"
"C:\Users\Leanne\AppData\Local\NetBeans\Cache\7.4\sass-compiler"
"C:\Users\Leanne\Documents\work\freelance\sites\fws_templates\gamer\scss\store.scss"
"C:\Users\Leanne\Documents\work\freelance\sites\fws_templates\gamer\css\store.css"
Syntax error: File to import not found or unreadable:
foundation/components/accordion.
Load path: C:/Users/Leanne/Documents/work/freelance/sites/fws_templates
(DEPRECATED)
on line 10 of C:\Users\Leanne\Documents\work\freelance\sites\fws_templates\gamer\scss\foundation\foundation.scss
from line 11 of C:\Users\Leanne\Documents\work\freelance\sites\fws_templates\gamer\scss\store.scss
Use --trace for backtrace. Done.
However Now I simply get the original error message again. No idea what to do. See image below showing that I have done everything according to the instructions (I think).
http://i.stack.imgur.com/Eekyt.png
Your path environment variable points to the wrong folder
Your Path to ruby is C:\Ruby193\bin
Go back and edit your path environment variable to point to C:\Ruby193\bin . At the moment you have C:\Ruby\192\bin
EDIT
And Now remove the backslash between Ruby and 193.
Your Path is set to : C:\Ruby\193\bin :-) !
your .bat is in Folder : C:\Ruby193\bin
TIP
Go to Options
Miscellaneous --> CSS Preprocessors
check : Generate extra information (debug)
You don't have path to ruby.exe which is c:\Ruby\192\bin in you PATH variable.
In Windows 7:
Right click on My computer and select Properties -> Go to
Advanced Tab -> Click on the Environmental Variables button
In the Environmental Variables window highlight PATH variable in
System variables section and click Edit
Append ;c:\Ruby\192\bin to the end (the semicolon is intentional)
Restart command prompt
You don't have path to ruby.exe
As simple, reinstall ruby, use ruby installer for windows.
When you go through the installation wizard, you’ll come to this options screen:
From what I can tell, the only option that you need to check on that one is the middle option, which helps your command-line instructions recognize where to find (as it says) “Ruby executables”. Otherwise, you’ll get the error message “ruby is not recognized as an internal or external command” when you try to install Sass in the command prompt.
Go to Options
Miscellaneous --> CSS Preprocessors
check : Generate extra information (debug)
For more information go to Setting Up Sass on Windows
They are all right in the above message. The problem is that Netbeans is not designed to pick up these changes instantaneously. Once you make the changes above, you have to RESTART Netbeans, so that the changes will be applied. This worked for me. Let me know if it works for you.
Thanks

OS-independent grunt script command in NPM package.json

When the command grunt is run in a Windows shell in the same path as the grunt.js file, Windows opts to run grunt.js using the Windows Script Host. The recommended path is to explicitly call grunt.cmd.
That's all fine and dandy, but what can I do if I want to create an OS-independent script command in my NPM package.json? I can't do this if I want to also run in *nix:
"scripts": {
"dox": "grunt.cmd dox"
}
Any pointers? Or, is there a big piece of the puzzle that I'm missing? (I'm equally new to both NPM and Grunt).
I've found the solution in creating a grunt.bat file that just calls grunt.cmd:
#grunt.cmd %*
Therefore, on Windows, just invoking grunt triggers the batch file since it gets higher priority than Windows Scripting Host's picking up of grunt.js. On Linux, the regular grunt binary gets picked up. This works cross-platform for me now.
I've got the same problem: when there is tslint.js file in the root dir of the package and an npm script in package.json just calls tslint, jscript is fired by npm instead of node, resulting in "Microsoft JScript compilation error" popup.
A workaround is removing .JS from PATHEXT environment variable.

Resources