使用gulp编译typescript时,为什么这配置会出错呢

使用gulp 编译 typescript ,


var gulp = require('gulp'),

tslint = require('gulp-tslint')



console.log(tslint)


gulp.task('lint', function () {

  return gulp.src([

    './source/ts/**/**/**.ts',

    './test/**/**.test.ts'

    ]).pipe(tslint())

    .pipe(tslint.report('verbose'))

})


gulp.task('default', ['lint'], function () {

  console.log('242342')

})

执行报错:


Cannot find module 'typescript'


at Function.Module._resolveFilename (module.js:469:15)

at Function.Module._load (module.js:417:25)

at Module.require (module.js:497:17)

at require (internal/module.js:20:19)

at Object.<anonymous> (C:\Users\M-Ray\Desktop\typescript\node_modules\tslint\lib\linter.js:20:10)

at Module._compile (module.js:570:32)

at Object.Module._extensions..js (module.js:579:10)

at Module.load (module.js:487:32)

at tryModuleLoad (module.js:446:12)

at Function.Module._load (module.js:438:3)

其实我都已经全局安装了typescript 和gulp-typescript 了


阿波罗的战车
浏览 375回答 1
1回答

白衣染霜花

本地安装试试
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript