Node.js, Windows, npm, Development Environment
(This post is English version of Windowsでnpm installの赤いエラーに悩まされているアナタへ)
I know preparing Node.js Dev Environment on Windows is really painful... until today.
They says "Install VC++ something" "Needed Windows SDK something" "If 32bit then hogehoge If 64bit then foobar"... and so on. Even after trying anything I can what I thought,
npm install shows me many many Red Errors.
Just what I got is unuseful old and very big trash --Visual Studio 2010-- on my HDD.
Oh, what a terrible history.
BUT, Today, I introduce you a perfect(probably) solution about preparing Node.js Dev Environment on your Windows!
npm install usually just downloads files from Npm, some libraries need to BUILD after downloading.
If your environment is not correct, that causes Red Errors.
I know you've nearly thrown your keyboard and mouse.
Ok, introducing steps with Microsoft's guideline, here we go.
First, Install Node.js
I recommend you to install
v5.1.0 Stable for Windows.(As of 2015-11-27)
Because that contains Npm3 which deploys under node_modules folder as flat. So you can avoid causing The Problem of Too long folder tree To delete.
Configuring your Windows development environment
The page above is very helpful, you had better to read it.
For busy people I've excerpted a profitable way from the guideline.
- Install VC++ Build Tools Technical Preview
- Install Python 2.7, and add it to your
npm config set python python2.7
- Launch cmd,
npm config set msvs_version 2015 --global(this is instead of
npm install [package name] --msvs_version=2015every time.)
npm config set msvs_version 2015 --globalon Command Prompt.
- Confirm your setting worked by
npm config list.
- SO MUCH npm install
Install node-gyp as global
npm install node-gyp -g
Maybe this is needed.
Try install some libraries which need to build
Microsoft's guideline says "Here are a few packages you can try installing to see if your environment is set up properly."
Libraries below need to build, ok try it.
Make a folder then execute
npm install bson bufferutil kerberos node-sass sqlite3 phantomjs utf-8-validate
No Red Errors? That's perfect!!
Thanks for your reading.