0

I am following Learning Typescript Book and created the following gulpfile.js file :->

var tslint      = require('gulp-tslint');
var tsProject = ts.createProject('tsconfig.json');
var tsTestProject = ts.createProject('tsconfig.json');

gulp.task('ts-lint', function(){
      return gulp.src(['./source/ts/**/**.ts', './test/**/**.test.ts'])
     .pipe(tslint())
     .pipe(tslint.report('verbose'));
});
gulp.task('default', ['ts-lint']);

when I run gulp getting below error :

module.js:340
throw err;
^

Error: Cannot find module 'tslint'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:289:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/Files/TypeScript/Packt/LearningTS/node_modules/gulp-
     tslint/index.js:5:14)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:313:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)

"gulp-tslint": "^7.1.0" -> version

Can anybody let me know why am I getting this error?

Thanks in Advance.

1 Answer 1

2

I found the problem. tslint itself was not installed.

Installed tslint using sudo npm install tslint@>=4.0.0-dev --save-dev

It started working :)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.