Windows 10 node-gyp cannot build: MSBUILD failed with exit code 1 - node.js

Windows 10,
Microsoft Visual Studio 2013,
Node v0.12.7,
node-gyp v2.0.2
I always get the error build error with node-gyp:
Error: `C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe` failed with exit code: 1
Also in red color description:
Could not write lines to file "Release\obj\validation\validation.tlog\validation.lastbuildstate". The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
Bigger excerpt of error:
https://gist.github.com/nerijusgood/63e54d9c376999a044bb
As I understand everything is running fine, however msbuild cannot write long path names. Is there a patch for this or windows workaround?

Edit: The question in title is a bit different from OP's actual issue (which this answer addresses).
For node-gyp, or MSBUILD errors in general please see other questions.
To solve the "The specified path, file name, or both are too long." issue, update npm to version 3+. This has been bothering all windows users for a while now, and the answer is to flatten your dependencies. npm#3.x automatically flattens all dependencies to the root even during install.

Long file paths is a big issue with Visual Studio that Microsoft has stated that they have no plans to fix in the near future!
Try moving your solution folder to the root of the drive (c:\project)
Also NPM version 3+ changes the module folder structure so they are not nested so deep. (it says it's in beta but seems to have solved some problems for me)
Regarding your post on Github, (I've been running into an endless string of problems with NPM and node-gyp as well, apparently everything is made to work well on linux!)
You probably need to install VS2013 (you can use the express version, make sure it includes c++)
From the npm errors on github:
v120 is VS2013
v140 is VS2015
To make node-gyp use the correct version for the package you are installing you may need to set an environment variable in Windows.
set GYP_MSVS_VERSION=2013
(if you set it in your windows system properties make sure to restart your command prompt)

By default in MS Windows 10, the NPM global install path will use your user profile directory;
%USERPROFILE%\AppData\Roaming\npm
%USERPROFILE%\AppData\Roaming\npm-cache
Which translates to something like;
C:\Users\YOUR-USER-PROFILE-NAME\AppData\Roaming\npm
C:\Users\YOUR-USER-PROFILE-NAME\AppData\Roaming\npm-cache
The first path above contains 51 characters and the second contains 57 characters. Depending on the length or your user profile name, your path may be a little shorter or longer.
So the aim is to change the directories used when you install anything with NPM globally by using the -g flag to use directories with fewer characters.
Change the "global" NPM folders to %ALLUSERSPROFILE%\(npm|npm-cache)
Your user account should be a member of the administrators group or you may need to enter your administrator password when prompted.
Copy the existing 'npm' folder from %USERPROFILE%\AppData\Roaming\ and paste into %ALLUSERSPROFILE%
Open a Windows command prompt and run the following commands;
npm config --global set prefix "C:\ProgramData\npm"
npm config --global set cache "C:\ProgramData\npm-cache"
This will add/update the contents of: %USERPROFILE%\AppData\Roaming\npm\etc\npmc with;
prefix=C:\ProgramData\npm
cache=C:\ProgramData\npm-cache
The first path above now only contains 18 characters and the second contains just 24 characters.
Add/change the PATH variable for NPM
Navigate to 'Environment Variables' by following these steps;
Start > Settings > System > About > System info > Advanced system settings
Under the 'Advanced' tab click the 'Environment Variables...' button.
Select the 'PATH' variable and click the 'Edit...' button.
If there is already an entry for NPM like C:\Users\YOUR-USER-PROFILE-NAME\AppData\Roaming\npm, select it and click the 'Edit' button. Otherwise, click the 'New' button.
Paste C:\ProgramData\npm and click the 'OK' button to save.
Finally, restart your computer.

Related

Node JS NPM modules installed but command not recognized

Node JS and NPM were working well before. Recently I have re-installed the Node JS, NPM and the problem started. After I install a module like an example npm install -g bower, the module gets installed successfully but bower -v gives
'bower' is not recognized as an internal or external command,
operable program or batch file.
I have checked the installation path
C:\Users\XXXXX\AppData\Roaming\npm\node_modules has all the old installed modules. I have tried to uninstall them and reinstall the modules, but still, I am getting the same error.
Even I have deleted the entire folder and installed all the modules again but the result is the same.
I don't know why I am getting this error after reinstalling NodeJS NPM.
I had this same problem and fixed it by adding the 'npm' directory to my PATH:
Right-click 'My Computer' and go to 'Properties > Advanced System Settings > Environment Variables'.
Double click on PATH under the 'User variables for Username' section, and add C:\Users\username\AppData\Roaming\npm obviously replacing 'username' with yours. Based on the comments below, you may need to add it to the top/front of your path.
Restart your console window or IDE and you should get a response from the bower command.
I had the same problem as well but installed it globally so the other answers didn't work.
The nodeJS install may not have added npm to your PATH so it's not recognised globally.
Firstly: To figure out if you installed globally or for current user
If there is an npm folder at C:\Users\(your username)\AppData\Roaming\npm you've installed it for the current user
If there is an npm folder at C:\Program Files\nodejs\node_modules\npm or C:\Program Files(x86)\nodejs\node_modules\npm you've installed it globally for all users to access
Secondly: To add it to the Path
Right-click My Computer
Click on properties down the bottom
Click on Advanced System Settings in the left bar
Click on Environment Variables down the bottom
Now depending on whether you installed globally or for the current user will determine which PATH variable you are updating and with what path location
Local
Double click on PATH under 'user variables' section
Add C:\Users\(your username)\AppData\Roaming\npm without the quotes
Global
Double click on PATH under 'user variables' section
Add C:\Program Files\nodejs without the quotes (or with (x86))
Finally
Close all terminals or programs that aren't able to find npm and open them up again
Run npm config get prefix and check the correct npm path first and append the output to the PATH using command or adding manually.
npm config get prefix
C:\mydev\tools\npm\npm
set PATH=%PATH%;C:\mydev\tools\npm\npm
If the package is successfully installed and still shows the message "'npm' is not recognized as an internal or external command, operable program or batch file."
Click windows start button.
Look for "ALL APPS", you will see Node.js and Node.js Command prompt there.
You can run the Node.js Command prompt as administrator and soon as its run it will show the message "Your environment has been set up for using Node.js 6.3.0 (x64) and npm."
You should probably check if your node/bin directory is in your PATH variable. Look for it where you've been installing these global modules.
I'm not on windows, so I can't tell you the exact command, but you can check these variables navigating to [Control Panel -> System -> Advanced -> Environment Variables] or something like this.
I had the same issue in Windows
Two solution worked for me
If you are using bash shell, use npm run
Example : $ npm run ng --version
Use Windows power shell or command prompt
In my case the npm folder was already in the PATH variable.
If after trying everything else, you also still can't make it work, try to delete the folder from the PATH variable and put it at the beginning of the list.

Fixing npm path in Windows 8 and 10

Have done a lot of googling, tried reinstalling node.js using the official installer, but my npm pathing still doesn't work.
This doesn't work
npm install foo
I get an error message saying missing module npm-cli.js
2 hours of googling later I discovered a workaround
Instead of simply 'npm' I type
node C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js
But how can I correct my nodejs install so I can simply type 'npm' ?
You need to Add C:\Program Files\nodejs to your PATH environment variable. To do this follow these steps:
Use the global Search Charm to search "Environment Variables"
Click "Edit system environment variables"
Click "Environment Variables" in the dialog.
In the "System Variables" box, search for Path and edit it to include C:\Program Files\nodejs. Make sure it is separated from any other paths by a ;.
You will have to restart any currently-opened command prompts before it will take effect.
get the path from npm:
npm config get prefix
and just as a future reference, this is the path I added in Windows 10:
C:\Users\{yourName}\AppData\Roaming\npm
Update:
If you want to add it for all users just add the following path [by #glenn-lawrence from the comments]:
%AppData%\npm
I have used the cmdlet and navigate to the path you want to switch your npm files to. Type in npm root -g to see what the current path your npm is installed to. Next use npm config set prefix and your npm path will be changed to whatever directory you are currently on.
Try this one dude if you're using windows:
1.) Search environment variables at your start menu's search box.
2.) Click it then go to Environment Variables...
3.) Click PATH, click Edit
4.) Click New and try to copy and paste this: C:\Program Files\nodejs\node_modules\npm\bin
If you got an error. Do the number 4.) Click New, then browse the bin folder
You may also Visit this link for more info.
Go to control panel -> System -> Advanced System Settings then environment variables.
From here find the path variable, Go to the end of the line and paste "C:\Program Files\nodejs\node_modules\npm\bin" (change the path to the directory to where ever you installed it e.g. if you specifically installed it anywhere change it)
Edit the System environment variables, and enter following path:
C:\Program Files\nodejs\node.exe;
C:\Users\{yourName}\AppData\Roaming\npm
Installed Node Version Manager (NVM) for Windows: https://github.com/coreybutler/nvm-windows
I'm using Windows 10 - 64 bit so I run...
Commands:
nvm arch 64 (to make default the 64 bit executable)
nvm list (to list all available node versions)
nvm install 8.0.0 (to download node version 8.0.0 - you can pick any)
nvm use 8.0.0 (to use that specific version)
In my case I had to just switch to version 8.5.0 and then switch back again to 8.0.0 and it was fixed.
Apparently NVM sets the PATH variables whenever you do that switch.
You can follow the following steps:
Search environment variables from start menu's search box.
Click it then go to Environment Variables
Click PATH
click Edit
Click New and try to copy and paste your path for 'bin' folder [find where you installed the node] for example according to my machine 'C:\Program Files\nodejs\node_modules\npm\bin'
If you got any error. try the another step:
Click New, then browse for the 'bin' folder
If after installing your npm successfully, and you want to install VueJS then this is what you should do
after running the following command (as Admin)
npm install --global vue-cli
It will place the vue.cmd in the following directory
C:\Users\YourUserName\AppData\Roaming\npm
you will see this in your directory.
Now to use vue as a command in cmd. Open the cmd as admin and run the following command.
setx /M path "%path%;%appdata%\npm"
Now restart the cmd and run the vue again. It should work just fine, and then you can begin to develop with VueJS.
I hope this helps.
This worked for me:
1. npm root -g (to see the current npm is installed)
2. npm config set prefix (to change the path)
I did this in Windows 10,
Search for Environment Variables in the Windows search
"Edit the System environment variables" option will be popped in the result
Open that, select the "Path" and click on edit, then click "New" add your nodeJS Bin path i.e in my machine its installed in c:\programfiles\nodejs\node_modules\npm\bin
Once you added click "Ok" then close
Now you can write your command in prompt or powershell.
If you using WIndows 10, go for powershell its a rich UI
change the path for nodejs in environment varibale.
add Environment Path to
C:\Program Files\nodejs\node.exe;C:\Users[your username]\AppData\Roaming\npm
steps 1
in the user variable and system variable
C:\Program Files\nodejs
then check both node -v
and the npm -v
then try to update the the npm i -g npm
I've had this issue in 2 computers in my house using Windows 10 each.
The problem began when i had to change few Environmental variables for projects that I've been working on Visual studio 2017 etc.
After few months coming back to using node js and npm I had this issue again and non of the solutions above helped.
I saw Sean's comment on Yar's solution and i mixed both solutions:
1) at the environmental variables window i had one extra variable that held this value: %APPDATA%\npm. I deleted it and the problem dissapeared!
If you can't work with npm packages, you propably has bad config with npm install packages, you try this:
Run the following command in your terminal to revert back to the default registry
npm config set registry https://registry.npmjs.org/
https://docs.npmjs.com/misc/config#registry
When you're on Windows but running VS Code in Windows Subsystem for Linux like this
linux#user: /home$ code .
you actually want to install NodeJs on Linux with
linux#user: /home$ sudo apt install nodejs
Installing NodeJs on Windows, modifying PATH and restarting will get you no results.
If, like me, you have MSYS_NO_PATHCONV = 1 configured as a user variable for Git Bash, this issue will be triggered. To workaround, you can either remove this variable or use a different shell (PowerShell) for npm.
I did Node repair with the .msi file and everything worked well.
I may be a total noob but I had no clue I had to install npm-cli first. I had just assumed I already had it.
npm install --global vue-cli

bower is not recognised as an internal or external command

I have successfully installed nodejs, and express framework, however I downloaded bower via
npm install -g bower
which ran successfully.
However whenever I try to install something with bower I get the error message
bower is not recognised as an internal or external command
when I search my computer for bower or a bower.exe I cannot locate it.
I am using Windows 7 as well and had this problem too.
After I took the steps outlined in Scott Marchant's answer, bower worked.
Find the location of your npm global binaries: npm config get prefix. This path may look something like C:\Users\username\AppData\Roaming\npm.
Add the path from step 1 to your Path.
Open the Windows Control Panel, search for environment, then click on either edit environment variables for your account, or Edit the system environment variables`.
Find the variable named Path or PATH, or create one if it doesn't exist.
Paste the path from step 1 here (; delimited).
You may need to restart your command prompt window.
You should now be able to enter bower commands.
I solved this issue using command
$ npm install -g bower
make sure -g exist in command.
I am using os Window10.
Installing Bower Windows:
Install Node.js (required)
npm install -g bower
Add to the Path environment variable for your both Systems and Users like this:
;C:\Users\me\AppData\Roaming\npm\node_modules\bower\bin
Restart your machine
Open command prompt anywhere and type bower to verify that it works. DONE.
Open cmd
Check bower is installed successfully:
bower version -v
If bower version showed then go to step 3, else execute:
npm install -g bower
to install bower
Close and re-open cmd (to apply new environment variables)
using CD command to navigate to folder that has bower.json file then run
bower install
DONE.
Sometimes even after Scott's steps do not resolve the problem. Open the command prompt in admin mode. This resolves the problem
Press Window+R
%appdata% Press Enter Key
C:\Users\xyz\AppData\Roaming\npm
Double Click bower.cmd icon
Press Shift Right Mouse Click Then Selec Open Command Window Here
Paste bower install MDBootstrap
SCREENSHOT
Check were your cmd prompt/bash is located when you have successfully commanded "npm install"
Look for the any of the following.
-bower.cmd - windows command script
-bower - file
you can do a quick search in the directory.
if you find it, copy the path to the file.
"I found mine in the directory where I successfully performed npm install" + node_modules.bin" - "D:\Work\notepadplusplus\htdocs\laravel-main\angulartest\public\fed\node_modules.bin"
Then do these
Open the Windows Control Panel
Go to Advance
Environment Variables
Click on either edit environment variables for your account, or Edit the system environment variables`.
Find the variable named Path or PATH, or create one if it doesn't exist.
Paste the path from your search earlier (; delimited and without any space).
restart your command prompt window or your bash window.
There is no specific path since we all have different structure of our directories.
The only precise thing here is to find the bower.cmd location and that will be used to the Path to your windows environment.
Although we have already good answers here, I will give an extra hint. Check if you have a .npmrc file inside the folder /Users/YOUR_USER/. When this problem happened to me, my .npmrc file had this content:
http_proxy=http://<LOGIN>:<PASSWORD>#<PROXY>:<PORT>
https_proxy=http://<LOGIN>:<PASSWORD>#<PROXY>:<PORT>
proxy=http://<LOGIN>:<PASSWORD>#<PROXY>:<PORT>/
https-proxy=http://<LOGIN>:<PASSWORD>#<PROXY>:<PORT>
prefix = "D:\\<SOME_DIR>\\nodejs"
cache = "D:\\<SOME_DIR>\\nodejs\\npm-cache"
Due to prefix and cache lines, the bower was being installed inside the folder specified in prefix.
SOLUTION: I deleted prefix and cache lines. The I installed bower again with the following command:
npm install -g bower
After that, my bower became global as expected.
C:\Users\[username]\AppData\Roaming\npm;
should exist in PATH for both "User Variables" and "System Variables"
I have faced the same problem. I have solved by using the following steps
Go to Control Panel\System and Security\System and click Advanced system settings
In that you can see Environment Variables in Advanced tab. Now ,Environment Variables Window opens.
Select the path and click Edit button and add C:\Users\\AppData\Roaming\npm . Click ok to save.
Note : before adding path add a colon(;) in front of that path if not there for previous one
Now you can able to install bower . Hope it helps.
I resolved the issue my changing access rights of node.js folder. I gave Read-Write access to the file and issue resolved. node.js file path: C:\Program Files\nodejs
I just wanted to add update to windows 10 users,
I found that typing bower into the search bar will return "run command" option. Execute that and it will then prompt if bower can submit info, return a y/n and you should be good to go.
Add the directory of bower to the PATH environment variable.
Avoid having any space between directories:
C:\Program Files\nodejs;C:\Users\W\AppData\Roaming\npm\node_modules\bower\bin;C:\Users\W\AppData\Roaming\npm
To me it helped to remove the user variable and write the PATH environment variable in the System variables.

Installing Node.js (and npm) on Windows 10

I had some issues trying to install Node on Windows 10 and found the solution.
The error was as follows:
C:\Users\Stephan>npm
Error: ENOENT, stat 'C:\Users\Stephan\AppData\Roaming\npm'
The solution is below.
Edit:
It seems like new installers do not have this problem anymore, see this answer by Parag Meshram as my answer is likely obsolete now.
Original answer:
Follow these steps, closely:
http://nodejs.org/download/ download the 64 bits version, 32 is for hipsters
Install it anywhere you want, by default: C:\Program Files\nodejs
Control Panel -> System -> Advanced system settings -> Environment Variables
Select PATH and choose to edit it.
If the PATH variable is empty, change it to this: C:\Users\{YOUR USERNAME HERE}\AppData\Roaming\npm;C:\Program Files\nodejs
If the PATH variable already contains C:\Users\{YOUR USERNAME HERE}\AppData\Roaming\npm, append the following right after: ;C:\Program Files\nodejs
If the PATH variable contains information, but nothing regarding npm, append this to the end of the PATH: ;C:\Users\{YOUR USERNAME HERE}\AppData\Roaming\npm;C:\Program Files\nodejs
Now that the PATH variable is set correctly, you will still encounter errors. Manually go into the AppData directory and you will find that there is no npm directory inside Roaming. Manually create this directory.
Re-start the command prompt and npm will now work.
go to http://nodejs.org/
and hit the button that says "Download For ..."
This'll download the .msi (or .pkg for mac) which will do all the installation and paths for you, unlike the selected answer.
In addition to the answer from #StephanBijzitter I would use the following PATH variables instead:
%appdata%\npm
%ProgramFiles%\nodejs
So your new PATH would look like:
[existing stuff];%appdata%\npm;%ProgramFiles%\nodejs
This has the advantage of neiter being user dependent nor 32/64bit dependent.
New installers (.msi downloaded from https://nodejs.org) have "Add to PATH" option. By default it is selected. Make sure that you leave it checked.
Everything should be installed in %appdata% (C:\Users\\AppData\Roaming), not 'program files'.
Here's why...
The default MSI installer puts Node and the NPM that comes with it in 'program files' and adds this to the system path, but it sets the user path for NPM to %appdata% (c:\users[username]\appdata\roaming) since the user doesn't have sufficient priveleges to write to 'program files'.
This creates a mess as all modules go into %appdata%, and when you upgrade NPM itself - which NPM themselves recommend you do right away - you end up with two copies: the original still in 'program files' since NPM can't erase that, and the new one inn %appdata%.
Even worse, if you mistakenly perform NPM operations as admin (much easier on Windows then on *nix) then it will operate on the 'program files' copy of NPM node_modules. Potentially a real mess.
So, when you run the installer simply point it to %appdata% and avoid all this.
And note that this isn't anything wierd - it’s what would happen if you ran the installer with just user priveleges.
You should run the installer as administrator.
Run the command prompt as administrator
cd directory where msi file is present
launch msi file by typing the name in the command prompt
You should be happy to see all node commands work from new command prompt shell
I had the same problem, what helped we was turning of my anti virus protection for like 10 minutes while node installed and it worked like a charm.
The reason why you have to modify the AppData could be:
Node.js couldn't handle path longer then 256 characters, windows tend to have very long PATH.
If you are login from a corporate environment, your AppData might be on the server - that won't work. The npm directory must be in your local drive.
Even after doing that, the latest LTE (4.4.4) still have problem with Windows 10, it worked for a little while then whenever I try to:
$ npm install _some_package_ --global
Node throw the "FATAL ERROR CALL_AND_RETRY_LAST Allocation failed - process out of memory" error. Still try to find a solution to that problem.
The only thing I find works is to run Vagrant or Virtual box, then run the Linux command line (must matching the path) which is quite a messy solution.
For me I had to delete the nodejs folder in \program files and then when I went to install through the msi it worked. Seemed like when I uninstalled Node it didnt actually delete this file
I had the same problem, but after trying everything on this post unsuccessfully, I just had to restart.
So if you haven't tried restarting the computer after the installation, try it.
Restart your computer after installation

Grunt on Windows 8: 'grunt' is not recognized

I'm having a problem running Grunt from the command line on my Windows 8 machine.
My research indicates the most common solution is to install grunt-cli, since Grunt is no longer global. I also need to make sure I actually install the Grunt task runner, since that's not installed with grunt-cli.
Other solutions point to the PATH system environment variable, but that appears to be pointed as I'd expect to:
C:\Users[username]\AppData\Roaming\npm
Having done all that, I'm still getting a "'grunt' is not recognized as an internal or external command, operable program or batch file" error message in the CLI. I've tried the following things, uninstalling everything after every attempt:
Installed grunt-cli globally (npm install -g grunt-cli), then grunt at the directory level I want to use it (npm install grunt)
The same as above, but with the order of installation reversed
The same as both of the above, but using the Admin Command Prompt
Am I missing something obvious?
I've not had any issues with grunt on several different windows 8 machines.
If you open the folder: C:\Users\[username]\AppData\Roaming\npm
Do you have a file named grunt.cmd in this folder?
If not I'd maybe try npm install -g grunt-cli again, maybe from an elevated command prompt.
If this exists and you have C:\Users\[username]\AppData\Roaming\npm in your PATH environment variable then typing grunt from a command prompt should work.
Silly question, have you tried closing the command prompt and opening a new one?
Confirm your PATH is correct (and not messed up). Just type PATH from the command prompt. There's really no other explanation that makes sense given the error you're describing and the steps you've taken.
Normally, using the where grunt command would have found grunt.cmd in your path if npm is installed correctly and it has been properly added to the system path.
Close all Command Prompt instances.
Start a new Command Prompt instance.
Type PATH Enter and verify if C:\Users\Username\AppData\Roaming\npm is part of the path.
If not, you need to log off and on again,or close the Command Prompt and restart the explorer process.
In the Command Prompt, type where grunt Enter.
You're good if it reports:
C:\Users\Username\AppData\Roaming\npm\grunt
C:\Users\Username\AppData\Roaming\npm\grunt.cmd
Otherwise, you have to reinstall the grunt-cli package if it reports:
INFO: Could not find files for the given pattern(s).
Apparently, programs that change the PATH environment variable must broadcast a WM_SETTINGCHANGE message. The Windows' System settings window does it correctly when you change the PATH variable, but the NPM installer doesn't. That's why you have to restart explorer (or log off or restart, which has the same effect).
I know this has been answered but I thought I'd offer my step by step solution for windows 8.
First thing I checked was the PATH in my laptops Environment Variables (Right click my computer > properties > advanced system settings > Environment Variables)
It wasn't listed in there so I added a new variable in User variables (so it was specific only to my user account)
In the new user variable prompt I entered the following;
Variable Name: PATH
Variable Value: %USERPROFILE%\AppData\Roaming\npm
Quit command prompt, repoened, navigated to my projects directory and tried running grunt again and... SUCCESS!
I had the same issue.
I tried different things:
Restart computer
Deleted the grunt folder and ran
npm install -g grunt -cli
Didn't work.
Finally tried:
npm install -g grunt-cli
Worked perfectly.
Tried
where grunt
and I saw 2 locations where it was found.
I was facing the same problem on windows 8
I have added ' %APPDATA%\npm ' to the path variable . It has been working fine.
some times NPM install corrupts the basic windows path. i usually have a copy of my own version of PATH mainted separately. every week or on some installs i manually configure and update the %PATH% variable.
Basically Grunt.cmd is not availbe through %PATH% variable.
I have stucked with problem on Windows 8, that after install grunt-cli I've always got "command not found" while I'm tried to check grunt -v or where grunt. So I've added to enviroment PATH this path C:\Program Files (x86)\Git\local and run grunt.cmd from that folder (you need to look in node_modules folder here). And after reloading my terminal everything started to work.
Same happened to me and here was the solution:
Have you got 2 different versions of Node.JS installed?
Maybe Nodist?
This means you likely got NPM installed twice which will install the commands into 2 different folders:
Once into C:\Users\<user>\AppData\Roaming\npm and once into C:\dev\nodist\bin\bin.
C:\dev\nodist\bin\bin wasn't on my path variable so I added it, and I removed the Node.JS version I didn't want to use.
If you have no grunt.cmd file created by npm, make sure that you do not have a .npmrc in your home directory with: bin-links=false in it.
After getting a tonne of "'grunt' is not recognized as an internal or external command," errors, I solved this on Windows 10 by going to Path and adding C:\Users\Username\AppData\Roaming\npm

Resources