Unexpected token keyword «function», expected punc «,» - gulp

Here is the error message after I try to run my app
[15:32:01] Starting 'default'...
[15:32:01] Plumber found unhandled error:
GulpUglifyError: unable to minify JavaScript
Caused by: SyntaxError: Unexpected token keyword «function», expected
punc «,»
File: /home/*******/myfile.js Line: 81
my gulp file:
const gulp = require('gulp')
const uglify = require('gulp-uglify')
const babel = require('gulp-babel')
const plumber = require('gulp-plumber')
const del = require('del')
gulp.task('default', ['conf'], () => gulp.src('src/app/**/*.js')
.pipe(plumber())
.pipe(babel())
.pipe(uglify())
.pipe(gulp.dest('dist')))
gulp.task('conf', ['package'], () => gulp.src('./src/conf/*').pipe(gulp.dest('dist/conf')))
gulp.task('package', ['clean'], () => gulp.src(['./package.json']).pipe(gulp.dest('dist/')))
gulp.task('clean', () => del(['dist/**/*']))
If I correctly understand the problem, my code has to be transpiled to es5 by babel, so here is the .babelrc
{
"plugins": [
"transform-class-properties",
"babel-plugin-transform-runtime",
"transform-es2015-shorthand-properties",
["babel-plugin-root-import", {
"rootPathSuffix": "src/app"
}]
],
"presets": ["es2015"]
}
Here is the code from line 81 (where the comments begin) from myfile.js.
export default class Scraper {
// ...
/**
* Converts a html string to a cheerio object
* #param {String} html The html string
* #return {Object} The cheerio object
*/
htmlToDom(html) {
// https://bugs.chromium.org/p/v8/issues/detail?id=2869
// https://github.com/cheeriojs/cheerio/issues/263
if(typeof global.gc === 'function') {
global.gc()
html = (' ' + html).substr(1)
}
return cheerio.load(html)
}
static absolute(location, relative) {
//...
}
First I thought maybe the shorthanded version causing the problem, but I have transform-es2015-shorthand-properties installed, and in an older project I use the very same skeleton, without this plugin.
Update
"dependencies": {
"babel-plugin-transform-class-properties": "^6.24.1",
"bunyan": "^1.8.10",
"cheerio": "^1.0.0-rc.2",
"colors": "^1.1.2",
"js-yaml": "^3.12.0",
"pg": "^7.4.3",
"puppeteer": "^1.5.0",
"sequelize": "^4.38.0",
"sequelize-connect": "^2.1.1"
},
"devDependencies": {
"ava": "^0.19.1",
"babel-plugin-root-import": "^6.1.0",
"babel-plugin-transform-es2015-shorthand-properties": "^6.24.1",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.7.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-latest": "^6.24.1",
"babel-register": "^6.24.1",
"coveralls": "^2.13.0",
"del": "^2.2.2",
"esdoc": "^0.5.2",
"gulp": "^3.9.1",
"gulp-babel": "^6.1.2",
"gulp-plumber": "^1.1.0",
"gulp-uglify": "^2.1.2",
"mkdir-recursive": "^0.4.0",
"nyc": "^11.2.0",
"sinon": "^2.1.0",
"standard": "^10.0.1",
"wait-on": "^3.2.0"
},

uninstalling and reinstalling gulp-uglify did the trick for me.

You may want to try adding babel-plugin-transform-async-to-generator
yarn add babel-plugin-transform-async-to-generator -D
.babelrc : "plugins": ["babel-plugin-transform-async-to-generator"]

Related

How to add huge number of elements from array to MySQL using Sequleize in Node.js

This is the operation going on in my method
if (result) {
const csvdata = result.body;
var csvarray = csvdata.split('\n') //array details are shown below
for (var i = 1; i <= length; i++) {
const eachdata = csvarray[i];
var symbolarray = eachdata.split(",");
const obj = {
"instrument_token": symbolarray[0],
"exchange_token": symbolarray[1],
"tradingsymbol": symbolarray[2],
"name": symbolarray[3],
"last_price": symbolarray[4],
"expiry": symbolarray[5],
"strike": symbolarray[6],
"tick_size": symbolarray[7],
"lot_size": symbolarray[8],
"instrument_type": symbolarray[9],
"segment": symbolarray[10],
"exchange": symbolarray[11]
}
db.symboltable.create(obj)
.then((response) => {
console.log("added to symbol table")
})
.catch((err) => {
console.log(err)
})
}
csvarray contains elements like :
[
"267556358,1045142,EURINR20AUGFUT,\"EURINR\",0,2020-08-27,0,0.0025,1,FUT,BCD-FUT,BCD",
"268660998,1049457,EURINR20DECFUT,\"EURINR\",0,2020-12-29,0,0.0025,1,FUT,BCD-FUT,BCD",
"266440966,1040785,EURINR20JULFUT,\"EURINR\",0,2020-07-29,0,0.0025,1,FUT,BCD-FUT,BCD",
"266073606,1039350,EURINR20JUNFUT,\"EURINR\",0,2020-06-26,0,0.0025,1,FUT,BCD-FUT,BCD",
]
it contains thousands of similar elements and when the methods calls, i am getting an error like :
D:\MEAN\node projects\Trade\controllers\apicontroller.js:135
var symbolarray = eachdata.split(",");
^
TypeError: Cannot read property 'split' of undefined
at Request._callback (D:\MEAN\node projects\Trade\controllers\apicontroller.js:135:48)
at Request.self.callback (D:\MEAN\node projects\Trade\node_modules\postman-request\request.js:268:12)
at Request.emit (events.js:311:20)
at Request.<anonymous> (D:\MEAN\node projects\Trade\node_modules\postman-request\request.js:1489:10)
at Request.emit (events.js:311:20)
at IncomingMessage.<anonymous> (D:\MEAN\node projects\Trade\node_modules\postman-request\request.js:1360:12)
at Object.onceWrapper (events.js:417:28)
at IncomingMessage.emit (events.js:323:22)
at endReadableNT (_stream_readable.js:1204:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
[nodemon] app crashed - waiting for file changes before starting...
can anyone get me out from this issue

Why is babeljs.io output different than gulp-babel output?

Background
I am trying to transpile my ES6 js to ES5 js. When I visit the https://babeljs.io/repl webpage to test out what babel should output for the preset option es2015 it outputs JavaScript that is different than what gulp-babel outputs.
Input ES6 JavaScript
// eslint-disable-next-line no-unused-vars
function getStars() {
// Round the number like "3.5k" https://stackoverflow.com/a/9461657
const round = num => (num > 999 ? `${(num / 1000).toFixed(1)}k` : num);
// Add the most recent star count to the repositories.
// eslint-disable-next-line no-undef
document.querySelectorAll('.repositories .repo a').forEach(async (a) => {
const link = a;
const name = link.getAttribute('href').split('/').slice(-2).join('/');
const url = `https://api.github.com/repos/${name}`;
const { starGazersCount } = await fetch(url).then(res => res.json());
if (!starGazersCount) return;
link.querySelector('.stars').innerText = `${'⭐️ '}${round(starGazersCount)}`;
});
}
babeljs.io output ~Desired Output~
'use strict';
// eslint-disable-next-line no-unused-vars
function getStars() {
// Round the number like "3.5k" https://stackoverflow.com/a/9461657
var round = function round(num) {
return num > 999 ? (num / 1000).toFixed(1) + 'k' : num;
};
// Add the most recent star count to the repositories.
// eslint-disable-next-line no-undef
document.querySelectorAll('.repositories .repo a').forEach(async function (a) {
var link = a;
var name = link.getAttribute('href').split('/').slice(-2).join('/');
var url = 'https://api.github.com/repos/' + name;
var _ref = await fetch(url).then(function (res) {
return res.json();
}),
starGazersCount = _ref.starGazersCount;
if (!starGazersCount) return;
link.querySelector('.stars').innerText = '⭐️ ' + round(starGazersCount);
});
}
gulp-babel output
"use strict";
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
(function () {
function r(e, n, t) {
function o(i, f) {
if (!n[i]) {
if (!e[i]) {
var c = "function" == typeof require && require;
if (!f && c) return c(i, !0);
if (u) return u(i, !0);
var a = new Error("Cannot find module '" + i + "'");
throw a.code = "MODULE_NOT_FOUND", a;
}
var p = n[i] = {
exports: {}
};
e[i][0].call(p.exports, function (r) {
var n = e[i][1][r];
return o(n || r);
}, p, p.exports, r, e, n, t);
}
return n[i].exports;
}
for (var u = "function" == typeof require && require, i = 0; i < t.length; i++) {
o(t[i]);
}
return o;
}
return r;
})()({
1: [function (require, module, exports) {
// eslint-disable-next-line no-unused-vars
function getStars() {
// Round the number like "3.5k" https://stackoverflow.com/a/9461657
var round = function round(num) {
return num > 999 ? "".concat((num / 1000).toFixed(1), "k") : num;
}; // Add the most recent star count to the repositories.
// eslint-disable-next-line no-undef
document.querySelectorAll('.repositories .repo a').forEach(
/*#__PURE__*/
function () {
var _ref = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee(a) {
var link, name, url, _ref2, starGazersCount;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
link = a;
name = link.getAttribute('href').split('/').slice(-2).join('/');
url = "https://api.github.com/repos/".concat(name);
_context.next = 5;
return fetch(url).then(function (res) {
return res.json();
});
case 5:
_ref2 = _context.sent;
starGazersCount = _ref2.starGazersCount;
if (starGazersCount) {
_context.next = 9;
break;
}
return _context.abrupt("return");
case 9:
link.querySelector('.stars').innerText = '⭐️ '.concat(round(starGazersCount));
case 10:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
return function (_x) {
return _ref.apply(this, arguments);
};
}());
}
}, {}]
}, {}, [1]);
⚠️Notice how the gulp-babel output contains polyfill functions such as _asyncToGenerator & asyncGeneratorStep.
Why does the online babel editor not output this when using the es2015 preset?
Other Useful files
Below is my .babelrc:
{
"presets": [
"#babel/preset-env"
]
}
Below is my package.json:
{
"devDependencies": {
"#babel/core": "^7.0.0",
"#babel/preset-env": "^7.0.0",
"babel-eslint": "^10.0.1",
"babel-preset-env": "^1.7.0",
"bower": "^1.8.2",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-node": "^8.0.0",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^4.0.0",
"gulp-babel": "^8.0.0",
"gulp-changed": "^3.2.0",
"gulp-cssnano": "^2.1.2",
"gulp-error-handle": "^1.0.0",
"gulp-eslint": "^5.0.0",
"gulp-gh-pages": "^0.5.4",
"gulp-htmlmin": "^5.0.1",
"gulp-imagemin": "^5.0.3",
"gulp-include": "^2.3.1",
"gulp-notify": "^3.2.0",
"gulp-plumber": "^1.1.0",
"gulp-postcss": "^8.0.0",
"gulp-pug": "^4.0.1",
"gulp-rename": "^1.2.2",
"gulp-sass": "*",
"gulp-size": "^3.0.0",
"gulp-sourcemaps": "^2.6.*",
"gulp-strip-css-comments": "^2.0.0",
"gulp-strip-debug": "^3.0.0",
"gulp-surge": "^0.1.0",
"gulp-terser": "^1.1.5",
"gulp-util": "^3.0.8",
"localtunnel": "^1.8.3",
"main-bower-files": "^2.13.1",
"path": "^0.12.7",
"postcss-cli": "^6.0.1",
"run-sequence": "^2.2.1",
"yarn": "^1.12.3"
},
"dependencies": {
"animate.css": "latest",
"argv": "^0.0.2",
"autoprefixer": "^9.3.1",
"babel-polyfill": "^6.26.0",
"browser-sync": "^2.18.13",
"browserify": "^16.2.3",
"bulma": "latest",
"del": "^3.0.0",
"gulp": "^3.9.1",
"gulp-load-plugins": "^1.5.0",
"hamburgers": "latest",
"hover": "latest",
"imagemin-pngquant": "^6.0.0",
"isinviewport": "latest",
"jquery": "latest",
"lost": "^8.2.0",
"minimist": "^1.2.0",
"moment": "^2.22.2",
"node-bourbon": "^4.2.8",
"node-neat": "^2.0.0-beta.0",
"psi": "^3.1.0",
"require-dir": "^1.1.0",
"rucksack-css": "^1.0.2",
"vanilla-lazyload": "latest",
"vinyl-buffer": "^1.0.1",
"vinyl-ftp": "^0.6.0",
"vinyl-source-stream": "^2.0.0"
}
}
Below is my js task for gulp:
'use-strict';
const gulp = require('gulp');
const $ = require('gulp-load-plugins')({ lazy: true });
const browserify = require('browserify');
const source = require('vinyl-source-stream');
const buffer = require('vinyl-buffer');
const paths = require('../../paths.js');
const config = require('../../config.js')();
gulp.task('eslint', () => {
console.log('-> Running eslint');
// Select files
gulp.src(`${paths.to.js.in}/**/*.js`)
// Prevent pipe breaking caused by errors from gulp plugins
.pipe($.plumber())
// Check for lint errors
.pipe($.eslint())
// eslint.format() outputs the lint results to the console.
// Alternatively use eslint.formatEach() (see Docs).
.pipe($.eslint.format())
// To have the process exit with an error code (1) on
// lint error, return the stream and pipe to failAfterError last.
.pipe($.eslint.failAfterError());
});
gulp.task('js', ['eslint'], () => {
const env = ((config.environment || process.env.NODE_ENV || 'development').trim().toLowerCase() !== 'production');
console.log(`-> Compiling JavaScript for ${config.environment}`);
// Obtain a readable stream containing the processed browserified bundle
const bundle = browserify({
entries: paths.to.js.in,
debug: env,
})
.bundle()
// Convert browserify stream to a gulp-readable steam & buffer
.pipe(source(config.js.name))
.pipe(buffer());
if (env) {
// Select bundle
bundle
// Initialize sourcemaps
.pipe($.sourcemaps.init())
// Prevent pipe breaking caused by errors from gulp plugins
.pipe($.plumber())
// Concatenate includes
.pipe($.include({
includePaths: [`${paths.to.js.in}`],
}))
// Transpile
.pipe($.babel())
// Catch errors
.pipe($.errorHandle())
// Save sourcemaps
.pipe($.sourcemaps.write('.'))
// Save unminified file
.pipe(gulp.dest(`${paths.to.js.out}`));
} else {
// Select bundle
bundle
// Prevent pipe breaking caused by errors from gulp plugins
.pipe($.plumber())
// Concatenate includes
.pipe($.include({
includePaths: [`${paths.to.js.in}`],
}))
// Transpile
.pipe($.babel())
// Catch errors
.pipe($.errorHandle())
// Show file-size before compression
.pipe($.size({ title: 'Javascript In Size' }))
// Optimize and minify
.pipe($.terser())
// Show file-size after compression
.pipe($.size({ title: 'Javascript Out Size' }))
// Append suffix
.pipe($.rename({
suffix: '.min',
}))
// Save minified file
.pipe(gulp.dest(`${paths.to.js.out}`));
}
});
#babel/preset-env is not the same thing as #babel/preset-es2015 - the former turns plugins on and off based on your targeted browser compatibility metrics (which you can customize).
The docs say that if you don't explicitly specify the targets in the preset's config, the following defaults will be used:
Sidenote, if no targets are specified, #babel/preset-env behaves exactly the same as #babel/preset-es2015, #babel/preset-es2016 and #babel/preset-es2017 together (or the deprecated babel-preset-latest).
#babel/preset-es2015 alone, on the other hand, will only compile features that were added in the ES2015 version of the spec. This does not include newer features, such as async/await! If you want all of the features added since then, you will have to add all of the yearly presets. For this reason, it's recommended that you use the env preset.
If you switch https://babeljs.io to the #babel/preset-env preset (which is a seperate section below the list of yearly presets), you get the same output.

nightwatch Error: Cannot find module 'e2e/step_definitions/analysis.js'

We have an angular 4 project and we're trying to add some e2e tests using gulp, nightwatch and cucumber but every time we run the tests the following error happens:
$ gulp e2e-tests
[11:15:12] Using gulpfile ~project/path/gulpfile.js
[11:15:12] Starting 'e2e-tests'...
[11:15:12] Starting 'e2e-scenarios'...
[11:15:12] log file
[11:15:12] Starting nightwatch...
Starting selenium server... started - PID: 18742
There was an error while starting the test runner:
Error: Cannot find module 'e2e/step_definitions/xxxx.js'
at Function.Module._resolveFilename (module.js:555:15)
at Function.Module._load (module.js:482:25)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at /project/path/node_modules/cucumber/lib/cli/index.js:163:16
at Array.forEach (<anonymous>)
Below is the configuration we have:
nightwatch.conf
var seleniumServer = require('selenium-server');
const chromedriver = require('chromedriver');
require('nightwatch-cucumber')({
cucumberArgs: ['--require', 'e2e/step_definitions', '--format', 'json:reports/cucumber.json', 'e2e/features']
});
module.exports = {
// Loads nightwatch-cucumber configuration into main nightwatch.js conf
custom_commands_path: '',
custom_assertions_path: '',
page_objects_path: '',
live_output: false,
disable_colors: false,
// Sets configuration for Selenium Server
selenium: {
start_process: true,
server_path: seleniumServer.path,
host: '127.0.0.1',
port: 4444,
cli_args : {
"webdriver.chrome.driver" : chromedriver.path
}
},
// Sets config options for different testing environments defined by the user
test_settings: {
default: {
launch_url: '',
selenium_port: 4444,
selenium_host: '127.0.0.1',
silent: true,
desiredCapabilities: {
browserName: 'chrome',
javascriptEnabled: true,
acceptSslCerts: true
},
'screenshots': {
enabled: true,
on_error: true,
on_failure: true,
path: '/screenshots'
}
},
chrome: {
desiredCapabilities: {
browserName: 'chrome',
javascriptEnabled: true,
acceptSslCerts: true
}
}
}
};
package.json
"devDependencies": {
"#angular/cli": "~1.6.0",
"#angular/compiler-cli": "^4.3.2",
"#angular/language-service": "^4.3.2",
"#types/jasmine": "~2.5.53",
"#types/jasminewd2": "~2.0.2",
"#types/node": "^6.0.104",
"codelyzer": "~3.0.1",
"gulp": "^3.9.1",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.4.2",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"selenium-webdriver": "^4.0.0-alpha.1",
"ts-node": "~3.0.4",
"tslint": "~5.3.2",
"typescript": "~2.3.3"
}
gulpfile.js
var gulp = require('gulp');
var nightwatch = require('gulp-nightwatch');
var reporter = require('gulp-protractor-cucumber-html-report');
var runSequence = require('run-sequence');
gulp.task('default', function() {
return console.log('Starting gulp tasks…');
});
gulp.task('login', function() {
return gulp.src('')
.pipe(nightwatch({
configFile: 'nightwatch.conf.js'
}))
});
//E2E tasks
gulp.task('e2e-scenarios', [], function e2e() {
let tags = '';
let skipTags = '';
let tagIndex = process.argv.indexOf("--tag");
let skipTagIndex = process.argv.indexOf("--skiptags");
if (tagIndex > -1) {
tags = process.argv[tagIndex + 1];
tags = '--tag ' + tags;
}
if (skipTagIndex > -1) {
skipTags = process.argv[skipTagIndex + 1];
skipTags = '--skiptags ' + skipTags;
}
return gulp.src('')
.pipe(nightwatch({
configFile: 'nightwatch.conf.js',
cliArgs: [tags, skipTags]
}));
});
gulp.task('e2e-report', function () {
return gulp.src('./reports/cucumber.json')
.pipe(reporter({
dest: 'reports/'
}));
});
gulp.task('e2e-tests', function (done) {
runSequence('e2e-scenarios', 'e2e-report', function () {
done();
});
});
And this is the project Structure
Project
enter image description here
Please help me to find out what is causing this issue.

npm start failure. $JSON.stringify.apply is not a function

I'm trying to run a react app but running into issues.
This is the error trace.
ERROR in Template execution failed: TypeError: $JSON.stringify.apply is not a function
ERROR in TypeError: $JSON.stringify.apply is not a function
- json-output-template.js:96 stringify
/CoD/src/origin-cms/origin-ui/ui.reactapps/src/json-output-template.js:96:26
- json-output-template.js:126 module.exports
/CoD/src/origin-cms/origin-ui/ui.reactapps/src/json-output-template.js:126:36
- index.js:265
[ui.reactapps]/[html-webpack-plugin]/index.js:265:16
- util.js:16 tryCatcher
[ui.reactapps]/[html-webpack-plugin]/[bluebird]/js/release/util.js:16:23
- promise.js:512 Promise._settlePromiseFromHandler
[ui.reactapps]/[html-webpack-plugin]/[bluebird]/js/release/promise.js:512:31
- promise.js:569 Promise._settlePromise
[ui.reactapps]/[html-webpack-plugin]/[bluebird]/js/release/promise.js:569:18
- promise.js:606 Promise._settlePromiseCtx
[ui.reactapps]/[html-webpack-plugin]/[bluebird]/js/release/promise.js:606:10
- async.js:138 Async._drainQueue
[ui.reactapps]/[html-webpack-plugin]/[bluebird]/js/release/async.js:138:12
- async.js:143 Async._drainQueues
[ui.reactapps]/[html-webpack-plugin]/[bluebird]/js/release/async.js:143:10
- async.js:17 Immediate.Async.drainQueues
[ui.reactapps]/[html-webpack-plugin]/[bluebird]/js/release/async.js:17:14
The template its trying to execute is
module.exports = function (templateParams) {
var obj = {};
obj.js = (templateParams.htmlWebpackPlugin.options.globalJs || []).concat( templateParams.htmlWebpackPlugin.files.js );
obj.css = templateParams.htmlWebpackPlugin.files.css;
return JSON.stringify(obj);
};
Application version's that I'm using
AMAC02PQ06PG8WN:ui.reactapps subhash.sulanthar$ node --version
v7.8.0
AMAC02PQ06PG8WN:ui.reactapps subhash.sulanthar$ npm --version
4.2.0
AMAC02PQ06PG8WN:ui.reactapps subhash.sulanthar$ yarn --version
0.21.3
AMAC02PQ06PG8WN:ui.reactapps subhash.sulanthar$ nvm --version
0.33.1
I've tried reinstalling node, yarn, cleared application caches, etc - all to no avail.
It all looks fine when I console the parameters from the template js:
module.exports = function (templateParams) {
var obj = {};
obj.js = (templateParams.htmlWebpackPlugin.options.globalJs || []).concat( templateParams.htmlWebpackPlugin.files.js );
obj.css = templateParams.htmlWebpackPlugin.files.css;
console.log("Object: ", obj);
console.log("JSON: ", JSON);
console.log("JSON.stringify: ", JSON.stringify);
return JSON.stringify(obj);
};
Console:
Object: { js:
[ '/etc/react-apps-chunks/b43f1ef1ef32e943333a.login-modal.js',
'/etc/react-apps-chunks/bb104a33ab4b80479b28.compare-plans.js' ],
css: [ '/etc/react-apps-chunks/ef77cfb892b9199adc95.login-modal.styles.css' ] }
JSON: {}
JSON.stringify: function stringify(it) {
// eslint-disable-line no-unused-vars
return $JSON.stringify.apply($JSON, arguments);
}
Object: { js:
[ '/etc/react-apps-chunks/react.js',
'/etc/react-apps-chunks/react-dom.js',
'/etc/react-apps-chunks/8c3d64978772b4558f5b.originReactAemIntegrator.js' ],
css: [] }
JSON: {}
JSON.stringify: function stringify(it) {
// eslint-disable-line no-unused-vars
return $JSON.stringify.apply($JSON, arguments);
}
Any idea if I'm missing something here?

Gulp with "NPM start" causes a blank page with the text: Cannot GET / when testing Locally

I've been following this tutorial Angular2, Bootstrap, Yeoman, Gulp, tutorial and I get up to the frontend task section, but then something happens when I try to test the code locally.
Whenever I use npm start I run the following code, but end up getting the blank webpage with Cannot GET/
Folder Structure:
> my-vzlr
> -build
> -node_modules
> -src
> --app
> ---app.js
> ---index.html
> ---main.js
> --electron
> --fonts
> --images
> --styles
> -gulpfile.js
> -package.json
Package.json:
> { "name": "my-vzlr", "version": "0.0.0", "private": true,
> "scripts": {
> "start": "gulp clean && gulp frontend && gulp dev",
> "build": "gulp clean && gulp frontend" }, "dependencies": {
> "angular2": "2.0.0-beta.2",
> "traceur": "0.0.102",
> "es6-promise": "^3.0.2",
> "es6-shim": "^0.33.3",
> "rxjs": "5.0.0-beta.0",
> "zone.js": "0.5.10",
> "reflect-metadata": "0.1.2",
> "systemjs": "0.19.6" }, "devDependencies": {
> "del": "^2.2.2",
> "gulp": "3.9.0",
> "gulp-rename": "1.2.2",
> "gulp-symdest": "^1.0.0",
> "gulp-traceur": "0.17.2",
> "gulp-webserver": "0.9.1" } }
Gulpfile.JS
var gulp = require('gulp'),
del = require('del'),
rename = require('gulp-rename'),
traceur = require('gulp-traceur'),
webserver = require('gulp-webserver'),
symdest = require('gulp-symdest');
var config = {
sourceDir: 'src',
buildDir: 'build',
packagesDir: 'packages',
npmDir: 'node_modules'
};
gulp.task('clean', function() {
return del(config.buildDir + '/**/*', { force: true });
});
// run init tasks
//gulp.task('default', ['dependencies', 'js', 'html', 'css']);
// run development task
gulp.task('dev', ['dev:watch', 'dev:serve']);
// serve the build dir
gulp.task('dev:serve', function () {
gulp.src(config.buildDir)
.pipe(webserver({
open: true
}));
});
// watch for changes and run the relevant task
gulp.task('dev:watch', function() {
gulp.watch(config.sourceDir + '/**/*.js', ['frontend:js']);
gulp.watch(config.sourceDir + '/**/*.html', ['frontend:html']);
gulp.watch(config.sourceDir + '/**/*.css', ['frontend:css']);
});
gulp.task('frontend', [
'frontend:dependencies',
'frontend:js',
'frontend:html',
'frontend:css'
]);
// move dependencies into build dir
gulp.task('frontend:dependencies', function() {
return gulp.src([
config.npmDir + '/traceur/bin/traceur-runtime.js',
config.npmDir + '/systemjs/dist/system-csp-production.src.js',
config.npmDir + '/systemjs/dist/system.js',
config.npmDir + '/reflect-metadata/Reflect.js',
config.npmDir + '/angular2/bundles/angular2.js',
config.npmDir + '/angular2/bundles/angular2-polyfills.js',
config.npmDir + '/rxjs/bundles/Rx.js',
config.npmDir + '/angular2/bundles/router.js',
config.npmDir + '/es6-shim/es6-shim.min.js',
config.npmDir + '/es6-shim/es6-shim.map'
])
.pipe(gulp.dest(config.buildDir + '/lib'));
});
// transpile & move js
gulp.task('frontend:js', function() {
return gulp.src( config.sourceDir + '/**/*.js')
.pipe(rename({
extname: ''
}))
.pipe(traceur({
modules: 'instantiate',
moduleName: true,
annotations: true,
types: true,
memberVariables: true
}))
.pipe(rename({
extname: '.js'
}))
.pipe(gulp.dest(config.buildDir));
});
// move html
gulp.task('frontend:html', function() {
return gulp.src(config.sourceDir + '/**/*.html')
.pipe(gulp.dest(config.buildDir))
});
// move css
gulp.task('frontend:css', function() {
return gulp.src(config.sourceDir + '/**/*.css')
.pipe(gulp.dest(config.buildDir))
});
So the short of it is to make sure the app is structured so Gulp can move all the files it needs to