我有这个tsconfig.json
:
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"outDir": "dist"
},
"exclude": [
"node_modules"
]
}
与dashboard.component.ts
:
import { Component, OnInit } from '@angular/core';
import Logger = require('le_node');
var log = new Logger({
token:'abcdef-1234-ghijklm-5678-nopqrstuvwxyz'
});
@Component({
selector: 'dashboard',
templateUrl: 'app/dashboard.component.html'
})
export class DashboardComponent implements OnInit {
constructor() { }
ngOnInit(): void {
log.log('Test LogEntries...');
}
}
并运行npm install le_node --save
安装 LogEntries。当尝试使用 运行应用程序时npm start
,我收到此错误:
> sample-app@2.0.0 start /Users/user/Workspace/sample-app
> tsc && concurrently "tsc -w" "lite-server"
app/dashboard.component.ts(10,25): error TS2307: Cannot find module 'le_node'.