2017-03-09 174 views
1

我是angular2上的新程序员。我用角度cli编译时遇到问题。编译错误:找不到模块'util'

我通过角度cli生成角度2项目。 我想通过node_modules/@types/node这样的导入模块使用debuglog模块,如下所示:import {debuglog} from "util"; 我使用Webstorm IDE进行开发,并且IDE不会导入警告或错误。我检查并找到路径中的debuglog模块:myproject/node_modules/@types/node/index.d.ts

我的代码有什么问题?有任何建议修复它?在Github上

项目:https://github.com/sinhpn92/angular2-example-types-node

版本环境:

@angular/cli: 1.0.0-rc.1 
node: 7.7.1 
os: darwin x64 
@angular/common: 2.4.9 
@angular/compiler: 2.4.9 
@angular/core: 2.4.9 
@angular/forms: 2.4.9 
@angular/http: 2.4.9 
@angular/platform-browser: 2.4.9 
@angular/platform-browser-dynamic: 2.4.9 
@angular/router: 3.4.9 
@angular/upgrade: 2.2.4 
@angular/cli: 1.0.0-rc.1 
@angular/compiler-cli: 2.4.9 

enter image description here

+0

你可以添加'systemjs.config.js'吗? – Smit

+0

是否有必要?该项目从角CLI生成,它工作的很好,如果没有这个问题 –

回答

2

这解决了这个问题对我来说。

+0

谢谢。它适用于我 –