smontanari / code-forensics

A toolset for code analysis and report visualisation
389 stars 48 forks source link

Startup issue "gulp.parallel is not a function" #36

Closed stepan-leibo closed 6 years ago

stepan-leibo commented 6 years ago

I did the following steps to start code-forensics

npm init
npm i code-forensics
touch gulpfile.js
require('code-forensics').configure(
  {
    repository: {
      rootPath: "/path/to/my/own/repo",
    }
  }
);

gulp webserver

I've got the following exception:

/cfissue/node_modules/code-forensics/lib/index.js:32
    throw e;
    ^

TypeError: gulp.parallel is not a function
    at module.exports (/cfissue/node_modules/code-forensics/lib/tasks/code_analysis_tasks.js:38:30)
    at /cfissue/node_modules/code-forensics/lib/index.js:25:24
    at arrayEach (/cfissue/node_modules/lodash/lodash.js:516:11)
    at Function.forEach (/cfissue/node_modules/lodash/lodash.js:9342:14)
    at Object.module.exports.configure (/cfissue/node_modules/code-forensics/lib/index.js:24:7)
    at Object.<anonymous> (/cfissue/gulpfile.js:1:89)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Liftoff.handleArguments (/usr/local/lib/node_modules/gulp/bin/gulp.js:116:3)
    at Liftoff.execute (/usr/local/lib/node_modules/gulp/node_modules/liftoff/index.js:203:12)
    at module.exports (/usr/local/lib/node_modules/gulp/node_modules/flagged-respawn/index.js:51:3)
gulp -v
[16:24:37] CLI version 3.9.1
[16:24:37] Local version 3.9.1
smontanari commented 6 years ago

code-forensics requires gulp v4. My guess is that when you invoke gulp on the command line you actually end up running the version that was installed globally on your system (under /usr/local/lib/node_modules/gulp) which is at 3.9.1. You must run the gulp command through the module that comes with code-forensics, or you must update the global version

smontanari commented 6 years ago

The gulp v4 requirement is mentioned in the CHANGELOG, but I will make it more explicit in the main README file, because the install instructions make too much of an assumption that you would have to run gulp that way

stepan-leibo commented 6 years ago

Thank you for your explanation! Can see it in the docs now.