openmarco / gulp-systemjs-builder

A tiny wrapper around SystemJS builder .bundle and .buildStatic methods
MIT License
1 stars 7 forks source link

Error: ENOENT: no such file or directory, open 'C:\Users\username\Projects\my-project\dist-compiled\main.js' #5

Closed JackMiszencin closed 7 years ago

JackMiszencin commented 7 years ago

Hey there, I'm pretty new to gulp in general, so I'm sorry if I'm missing something, but I can't figure this out for the life of me.

I'm trying to write a series of tasks within my gulpfile. The first processes some source files and outputs to a directory called 'dist-compiled'. When I run the builder, I tell it to use one of the files in this directory as the source for the new bundle. Here's my gulpfile.js :

`// gulpfile.js

'use strict';

var del = require('del'); var gulp = require('gulp'); var embedTemplates = require('gulp-angular-embed-templates'); var sourcemaps = require('gulp-sourcemaps'); var systemjsBuilder = require('gulp-systemjs-builder'); var sass = require('gulp-sass');

gulp.task('clean', function() { return del(['dist-compiled/', 'dist/']); });

gulp.task('sass', function() { return gulp.src('assets/*.scss') .pipe(sass().on('error', sass.logError)) .pipe(gulp.dest('./dist')); });

gulp.task('build:prep', ['clean', 'sass'], function () { gulp.src('app/*/.js') // also can use *.js files .pipe(sourcemaps.init()) .pipe(embedTemplates({sourceType:'js'})) .pipe(sourcemaps.write()) .pipe(gulp.dest('./dist-compiled')); });

gulp.task('build:dev', ['build:prep'], function() { var builder = systemjsBuilder(); builder.loadConfigSync('./systemjs.config.js'); builder.loader.defaultJSExtensions = true; builder.buildStatic('./dist-compiled/main.js', './dist/bundle.js', { minify: false, mangle: false }).pipe(gulp.dest('./dist')); }); `

When I try to run gulp build:dev, it runs through the build:prep task fine, but then gets to the systemjs-builder part and throws this error:

Unhandled rejection Error on fetch for dist-compiled/main.js at file:///C:/Users/username/Projects/my-project/dist-compiled/main.js Error: ENOENT: no such file or directory, open 'C:\Users\username\Projects\my-project\dist-compiled\main.js' at Error (native)

The problem of course is that the file actually does exist. I'm not sure if the build:prep maybe doesn't get done before the build:dev portion starts or what, but it doesn't seem to be finding the main.js file either way. Thoughts? Any help is much appreciated. I'm at wit's end with this thing.

marklreyes commented 4 years ago

@JackMiszencin What was your final resolution? I too am running into similar issues and have reported it on StackOverflow.