S
S
sanex33392016-04-22 11:24:19
npm
sanex3339, 2016-04-22 11:24:19

How to remove (or at least localize) the error Error: ENOENT: no such file or directory `some_file_name.ts___jb_tmp___`?

Problem: in the current project, when watchers are running, in 50% of cases, changing files throws an error:

ENOENT: no such file or directory, stat '/home/username/PhpstormProjects/js/bd/src/ts/classes/bd/file_name.ts___jb_tmp___'
at Error (native)

What is this postfix `___jb_tmp___` I have no idea. Google doesn't find anything. Search by node_modules - too.
How to determine in general - in the direction of which plugin to dig?
Dependencies:
"dependencies": {
    "gulp": "^3.9.1",
    "gulp-include-source": "0.0.5",
    "gulp-livereload": "^3.8.1",
    "gulp-minify": "0.0.10",
    "gulp-plumber": "^1.1.0",
    "gulp-sourcemaps": "^1.6.0",
    "gulp-watch": "^4.3.5",
    "ts-loader": "^0.8.2",
    "typescript-extends": "^1.0.1"
  },
  "devDependencies": {
    "browser-sync": "^2.12.3",
    "typescript": "^1.9.0-dev.20160422",
    "webpack": "^2.1.0-beta.6",
    "webpack-stream": "^3.2.0"
  }

JS task in gulp:
gulp.task('js', function() {
   gulp.src('src/ts/bd.ts')
       .pipe(plumber())
       .pipe(sourcemaps.init())
       .pipe(webpack({
           debug: true,
           devtool: 'source-map',
           module: {
               loaders: [
                   {
                       test: /\.ts$/,
                       loader: 'ts-loader',
                       exclude: /node_modules/
                   }
               ]
           },
           output: {
               filename: 'bd.js',
               library: "LibraryName",
               libraryTarget: "var"
           },
           plugins: [
               new ProvidePlugin({
                   __extends: 'typescript-extends'
               })
           ],
           resolve: {
               extensions: ['', '.ts', '.webpack.js', '.web.js', '.js'],
               modulesDirectories: ['node_modules', '.']
           }
       }))
       .pipe(minify())
       .pipe(sourcemaps.write())
       .pipe(gulp.dest('dist/js/'))
       .pipe(reload({stream: true}));
});

Watchers and server in Gulp
var config = {
    server: {
        baseDir: "./dist"
    },
    host: 'localhost',
    port: 9005,
    ui: {
        port: 8080,
        weinre: {
            port: 9090
        }
    },
    logPrefix: "prefix"
};

gulp.task('watch', function(){
    watch('src/ts/**/**', function(event, cb) {
        gulp.start('js');
    });
    watch('src/*.html', function(event, cb) {
        gulp.start('html');
    });
});

gulp.task('webserver', function () {
    browserSync(config);
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Kitmanov, 2016-04-22
@sanex3339

jb_tmp, this is obviously a JetBrains temp file :) And the problem is that your watcher is trying to watch all the files:
Correct the path to 'src/ts/**/*.ts', it should help.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question