Skip to content

Instantly share code, notes, and snippets.

@RadGH
Created July 28, 2020 22:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RadGH/105a84b73b6e67a56a9f1907413a421a to your computer and use it in GitHub Desktop.
Save RadGH/105a84b73b6e67a56a9f1907413a421a to your computer and use it in GitHub Desktop.
Windows Fixes for gulp/npm/node errors: Python compile error, MSBuild.exe exit code 1, node-sass, and Primordials not defined
problem:
"npm i" fails with an error that Python failed to compile something like "%s.%s.%s"
solution 1:
revert python 3.8.5 to 2.7.13 to fix a compiler error
solution 2:
to install python and VC Redist automatically run:
npm install --global windows-build-tools
---
problem:
error from msbuild.exe with exit code 1 during "npm i"
solution:
1. Run CMD as administrator (powershell still gave me permission errors)
2. As Admin:
cd "C:\Program Files\nodejs\node_modules\npm"
npm install node-gyp
3. in your project, run: npm audit fix
---
problem:
npm i finally worked but "gulp xxxx" gives an error that Primordials are undefined
solution:
(reference https://stackoverflow.com/a/58394828)
1. edit package.json
2. add the following preinstall and graceful-fs entries:
"scripts":
// keep any existing scripts from your package.json
"preinstall": "npx npm-force-resolutions"
},
"resolutions": {
// keep any existing resolutions from your package.json
"graceful-fs": "4.2.4"
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment