Error on fetch for .js
When running gulp on a windows machine, I get this error
c:\samples\mwd2>gulp [11:37:20] Requiring external module babel-register [11:37:36] Using gulpfile c:\samples\mwd2\gulpfile.babel.js [11:37:36] Starting 'default'... [11:37:36] Starting 'validate-package-json'... [11:37:36] Finished 'default' after 16 ms [11:37:36] Warnings: [11:37:36] Missing recommended field: licenses [11:37:36] Missing recommended field: repository [11:37:36] package.json is valid [11:37:36] Finished 'validate-package-json' after 53 ms [11:37:36] Starting 'clean'... [11:37:36] Finished 'clean' after 3.94 ms [11:37:36] Starting 'ts-lint'... [11:37:36] Starting 'check-js-style'... [11:37:38] Starting 'check-js-quality'... [11:37:38] check-js-style all files 48 B [11:37:38] Finished 'check-js-style' after 1.59 s [11:37:38] Finished 'check-js-quality' after 105 ms [11:37:39] ts-lint all files 3.77 kB [11:37:39] Finished 'ts-lint' after 2.33 s [11:37:39] Starting 'scripts-typescript'... [11:37:39] Starting 'scripts-javascript'... [11:37:47] scripts-javascript all files 152 B [11:37:47] Finished 'scripts-javascript' after 7.95 s [11:37:50] scripts-typescript all files 7.23 kB [11:37:50] Finished 'scripts-typescript' after 11 s [11:37:50] Starting 'copy'... [11:37:50] copy all files 40.56 kB [11:37:50] Finished 'copy' after 115 ms [11:37:50] Starting 'styles-vendor-dist'... [11:37:50] Starting 'styles-dist'... [11:37:50] Starting 'scripts-javascript-dist'... [11:37:50] The production JS bundle will NOT be mangled! [11:37:53] Starting 'html'... [11:37:53] The HTML will NOT be minified! [11:37:53] Starting 'images'... [11:37:55] styles-vendor-dist all files 1.87 kB [11:37:55] Finished 'styles-vendor-dist' after 5.83 s [11:37:56] html all files 79.73 kB [11:37:56] Finished 'html' after 2.65 s [11:37:56] images all files 7.28 kB [11:37:56] Finished 'images' after 2.78 s [11:37:56] 'scripts-javascript-dist' errored after 6.55 s [11:37:56] Error on fetch for .js at file:///c:/samples/mwd2/.js Loading npm:[email protected]/observable/PromiseObservable.js Loading npm:[email protected]/src/facade/async.js Loading npm:[email protected]/src/facade/facade.js Loading npm:[email protected]/core.js Loading .tmp/core/boot.js Error: ENOENT: no such file or directory, open 'c:\samples\mwd2.js' at Error (native) [11:37:56] Error in plugin 'run-sequence' Message: An error occured in task 'scripts-javascript-dist'. [11:37:57] styles-dist all files 3.86 kB [11:37:57] Finished 'styles-dist' after 7.02 s
Hi @visardida!
Could you upload a reproduction somewhere so that I can take a look at it? With this log alone, I can't help you.
One thing you could do is enable debug logging in the scripts-javascript-dist gulp task. You'll find it under node_modules/modern-web-dev-build/dist/gulp/tasks/
There are two lines to uncomment. Once done, the log should give you a bit more information. It might simply be that you have an import statement somewhere with a wrong path or with a file extension where you don't need one.
I'm getting a very similar error, also on a Windows machine, on a fresh yeoman run, no changes to any file. Repro steps are pretty simple: mkdir PROJECT_NAME && cd PROJECT_NAME && yo modern-web-dev && gulp default
I couldn't find any commented lines in the scripts-javascript-dist gup task's .js, but that file looks a lot like its been pre-transpiled from something.
For me, it looks a lot like its not properly resolving relative paths it finds in a require.
Here's the relevant log:
[23:02:44] Starting 'scripts-javascript-dist'... [23:02:44] The production JS bundle will NOT be mangled! [23:02:45] Starting 'html'... [23:02:45] The HTML will NOT be minified! [23:02:45] Starting 'images'... [23:02:48] 'scripts-javascript-dist' errored after 4.39 s [23:02:48] Error on fetch for app.js at file:///D:/Projects/PROJECT_NAME/app.js Loading .tmp\core\boot.js Error: ENOENT: no such file or directory, open 'D:\Projects\PROJECT_NAME\app.js' at Error (native) [23:02:48] Error in plugin 'run-sequence(scripts-javascript-dist)' Message: Error on fetch for app.js at file:///D:/Projects/PROJECT_NAME/app.js Loading .tmp\core\boot.js ENOENT: no such file or directory, open 'D:\Projects\PROJECT_NAME\app.js' Details: originalErr: Error: ENOENT: no such file or directory, open 'D:\Projects\PROJECT_NAME\app.js' Stack: Error on fetch for app.js at file:///D:/Projects/PROJECT_NAME/app.js Loading .tmp\core\boot.js Error: ENOENT: no such file or directory, open 'D:\Projects\PROJECT_NAME\app.js' at Error (native)