InversifyJS: error TS2307: Cannot find module 'inversify'
When import { TypeBinding, Kernel } from 'inversify'; getting an error TS2307: Cannot find module 'inversify'.
tsconfig.json:
{
"compilerOptions": {
"target": "ES5",
"module": "commonjs",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"watch": true
},
"exclude": [
"node_modules",
"typings/browser.d.ts",
"typings/browser"
]
}
gulp task:
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var ts = require('gulp-typescript');
var path = ["**/*.ts", "!node_modules/**", "!typings/browser/**", "!typings/browser.d.ts", '!bin/**'];
var config = ts.createProject('./tsconfig.json');
gulp.task('ts', ['clean'], function() {
return gulp
.src(path, {base: './'})
.pipe(sourcemaps.init())
.pipe(ts(config))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./'));
});
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 15 (8 by maintainers)
OK great. Thanks again.
Yes that’s the problem. I just opened a PR https://github.com/DefinitelyTyped/DefinitelyTyped/pull/8851 to solve your problem. I recommend you to use the latest
2.0.0-alpha.8and to keep an eye on releases. We will probably have a couple of releases this month before going into beta.The problem is the versions. Which version of InversifyJS are you using?
It could be that there is a conflict between:
And