I'm using NodeJS + Typescript + Gulp + PouchDB for backend, and Typescript + Webpack + React + Sass for the client (note that the webpack is served by express and webpackDevMiddleware) and yarn. Regularly I get this kind of error:
Error: Could not locate the bindings file. Tried:
→ /home/vinz243/compactd/node_modules/leveldown/build/leveldown.node
...
or the same for node-sass. I can easily fix this by running:
npm rebuild node-sass leveldown
it works, but it takes some time and really annoying. I'd like to know how can I make it permanent. I'm not sure what to provide, here is my gulpfile:
const gulp = require('gulp');
const ts = require('gulp-typescript');
const nodemon = require('gulp-nodemon');
const merge = require('merge2');
const tsProject = ts.createProject('server/tsconfig.json');
gulp.task('scripts', function() {
const tsResult = gulp.src('server/src/*.ts')
.pipe(tsProject());
return merge([ // Merge the two output streams, so this task is finished when the IO of both operations is done.
tsResult.dts.pipe(gulp.dest('server/defs')),
tsResult.js.pipe(gulp.dest('server/dist'))
]);
});
gulp.task('watch', ['scripts'], function() {
gulp.watch('server/src/*.ts', ['scripts']);
nodemon({
script: 'server/index.js',
ext: 'js html',
env: { 'NODE_ENV': 'development' }
});
});
and here is the output of the rebuild:
...
CXX(target) Release/obj.target/leveldown/src/leveldown.o
CXX(target) Release/obj.target/leveldown/src/leveldown_async.o
SOLINK_MODULE(target) Release/obj.target/leveldown.node
COPY Release/leveldown.node
make: Leaving directory '/home/vinz243/compactd/node_modules/leveldown/build'
> node-sass@4.5.2 install /home/vinz243/compactd/node_modules/node-sass
> node scripts/install.js
Cached binary found at /home/vinz243/.npm/node-sass/4.5.2/linux-x64-48_binding.node
> node-sass@4.5.2 postinstall /home/vinz243/compactd/node_modules/node-sass
> node scripts/build.js
Binary found at /home/vinz243/compactd/node_modules/node-sass/vendor/linux-x64-48/binding.node
Testing binary
Binary is fine
leveldown@1.5.0 /home/vinz243/compactd/node_modules/leveldown
node-sass@4.5.2 /home/vinz243/compactd/node_modules/node-sass
via Vinz243
No comments:
Post a Comment