title: gulp throws an error: TypeError('Path must be a string. Received ' + inspect(path))
body: <p>I'm using node v6.2.0. I have a simple gulpfile that compiles ts files and copies some libs.</p>
  
  <p>But when i try to copy the libs i keep getting the above mentioned error.</p>
  
  <p><strong>gulpfile.js:</strong></p>
  
  <pre><code>const gulp = require("gulp");
  const del = require("del");
  const tsc = require("gulp-typescript");
  const sourcemaps = require('gulp-sourcemaps');
  const tsProject = tsc.createProject("tsconfig.json");
  const tslint = require('gulp-tslint');
  const config = require('./gulp.config.js');
  
  const $ = require('gulp-load-plugins')({
      lazy: true
  });
  
  // clean the contents of the distribution directory
  gulp.task('clean', function() {
      return del(config.dest, { force: true });
  });
  
  gulp.task('resources', function() {
      _log('copy - ' + config.assets, $.util.colors.yellow);
      return gulp.src(config.assets, { base: root })
          .pipe(gulp.dest(config.dest));
  });
  
  /**
   * Copy all required libraries into build directory.
   */
  gulp.task("libs", () =&gt; {
      _log('copying libs to:' + config.dest + 'lib' ,$.util.colors.yellow);
      return gulp.src([
              'es6-shim/es6-shim.min.js',
              'systemjs/dist/system-polyfills.js',
              'systemjs/dist/system.src.js',
              'reflect-metadata/Reflect.js',
              'rxjs/**',
              'zone.js/dist/**',
              '@angular/**'
          ], { cwd: 'node_modules/**' })
          .pipe(gulp.dest(config.dest + 'lib'));
  });
  
  /**
   * Compile TypeScript sources and create sourcemaps in build directory.
   */
  gulp.task("compile", () =&gt; {
      var tsResult = gulp.src(config.root + "**/*.ts")
          .pipe(sourcemaps.init())
          .pipe(tsc(tsProject));
      return tsResult.js
          .pipe(sourcemaps.write("."))
          .pipe(gulp.dest(config.dest));
  });
  
  gulp.task("default", ['compile', 'resources', 'libs'], () =&gt; {
      _log('Building the project ...', $.util.colors.yellow);
  
  });
  
  function _log(msg, color) {
      color = color || $.util.colors.blue;
      $.util.log(color(msg));
  }
  
  function _logError(error) {
      _log('**** START OF ERROR ***', $.util.colors.red);
      _log(error, $.util.colors.red);
      _log('**** END OF ERROR ***', $.util.colors.red);
  
      return error;
  }
  </code></pre>
  
  <p><strong>gulp.config.js</strong></p>
  
  <pre><code>module.exports = (function() {
      var root = './';
      var config = {
          root: root,
          dest: '../dist/dashboard/',
          assets: [
              root + 'assets/**/*.*',
          ]
  
      };
  
      return config;
  })();
  </code></pre>
  
  <p><strong>error stack:</strong></p>
  
  <blockquote>
    <p>[14:03:08] Using gulpfile
    C:\workspace\main\webserver\public\angular-client\dashboard\gulpfile.js
    [14:03:08] Starting 'compile'... [14:03:08] Starting 'resources'...
    [14:03:08] copy - ./assets/**/<em>.</em> [14:03:08] Starting 'libs'...
    [14:03:08] copying libs to:../dist/dashboard/lib (node:11076)
    DeprecationWarning: 'root' is deprecated, use 'global' path.js:7
        throw new TypeError('Path must be a string. Received ' + inspect(path));
        ^</p>
    
    <p>TypeError: Path must be a string. Received {
    DTRACE_NET_SERVER_CONNECTION: [Function],   DTRACE_NET_STREAM_END:
    [Function],   DTRACE_HTTP_SERVER_REQUEST: [Function],<br>
    DTRACE_HTTP_SERVER_RESPONSE: [Function],   DTRACE_HTTP_CLIENT_REQUEST:
    [Function],   DTRACE_HTTP_CLIENT_RESPONSE: [Function],<br>
    COUNTER_NET_SERVER_CONNECTION: [Function],<br>
    COUNTER_NET_SERVER_CONNECTION_CLOSE: [Function],<br>
    COUNTER_HTTP_SERVER_REQUEST: [Function],<br>
    COUNTER_HTTP_SERVER_RESPONSE: [Function],<br>
    COUNTER_HTTP_CLIENT_REQUEST: [Function],<br>
    COUNTER_HTTP_CLIENT_RESPONSE: [Function],   global: [Circular],<br>
    process:    process {
         title: 'gulp',
         version: 'v6.2.0',
    ....</p>
  </blockquote>