npm
looks for node_modules
in the current directory, and all its parent directories, then looks in the global location. My current proposed dir structure is:
- global
- package.json
- node_modules/
- project-1
- project-2
But this isn't where npm
normally looks for this. Is there an environment variable I can set to deal with this, or a way I can tell it to look in a specific directory? Thanks!
Try the following to set NODE_PATH in gulp.
.pipe(preprocess({context: { NODE_PATH: '$NODE_PATH:/path/to/other/dir'}}))
A full example would look like the following.
var preprocess = require('gulp-preprocess');
gulp.task('html', function() {
gulp.src('./app/*.html')
.pipe(preprocess({context: { NODE_PATH: '$NODE_PATH:/path/to/other/dir'}})) //To set environment variables in-line
.pipe(gulp.dest('./dist/'))
});
The above 2 examples add to the node path if it is set. If you want to just set it do the following.
.pipe(preprocess({context: { NODE_PATH: '/path/to/other/dir'}}))
There is a NODE_PATH
environment variable you can set.