Skip to content

Instantly share code, notes, and snippets.

@mikaelvesavuori
Last active April 15, 2018 15:52
Show Gist options
  • Save mikaelvesavuori/f5e628421f72810cdeb98b09eb0869b3 to your computer and use it in GitHub Desktop.
Save mikaelvesavuori/f5e628421f72810cdeb98b09eb0869b3 to your computer and use it in GitHub Desktop.
Troubleshooting NPM, Yarn, Gulp, Node
# Gist: Troubleshooting Gulp and NPM
## Unclean installation/execution errors via NPM (ENOENT, no such file, cannot find...)
Lots of things you can usually fix with the following two-step procedure.
In your CLI:
- npm update
- npm install
- If using sass: npm rebuild node-sass
## Problems with access rights (Windows)
In your CLI:
- Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
- npm install -g npm-windows-upgrade
- npm-windows-upgrade
## node-sass/libsass error about bindings
In your CLI:
- npm rebuild node-sass
You can manually download bindings from:
- https://github.com/sass/node-sass/releases/tag/v4.2.0 (or whatever version is current)
Place it in node_modules/node-sass/vendor/ and a folder for your system with the current version number:
- Windows: win32-x64-51
- Mac: darwin-x64-51
## Mismatch in module versions
- The caret sign (^) in package.json guarantees all updates except bumps to new major versions (version 1 to 2, for example)
- Check current version with: npm view [package] version
- Do the update: npm install [package] or yarn add [package]
- Make sure the package is in package.json
- Verify version number with npm view [package] version
## Visual Studio and Gulp
You need to point VS to a more recent, custom Node than what it comes packaged with.
- Go to Tools/Options/Projects and Solutions/External Web Tools
- Update C:\Program Files\nodejs (or similar) as the first one
You may need global installs of things, like Webpack and Gulp.
- npm install gulp -g
- npm install gulp-cli -g
- npm install webpack -g
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment