I was trying to setup a new project using the Angular CLI and of course when I got to the point to do yarn install
or npm install
I got some issues. The issues had to do with node-sass
and me not having node-gyp
and Python on my machine.
Step 1 - Python via Visual Studio
As I am a happy .NET developer (thanks Microsoft for awesome IDE's & tooling support) I have Visual Studio 2017 and 2019 installed and just added the Python stuff in there. I installed both Python v2.7
and v3
.
I have NOT installed the windows-build-tools
package as many suggests.
Step 2 - Environment variable
I pointed the PYTHON
envorinment variable to v2.7
PYTHON=C:\Python27amd64\python.exe
Step 3 - node-gyp & npm config
npm install -g node-gyp
npm config set python "C:\Python27amd64\python.exe"
npm config set msvs_version 2017
Harvest
I was now able to do:
npm install -g @angular/cli
ng new mat-lab
--prefix matlab
--routing true
--style scss
--skip-install true
--skip-git true
npm install
Resulting in no more build errors or what so ever. No node-gyp
or node-sass
issues.
Hope it helps.
//Daniel