2016-07-26 63 views
0

刚刚在Angular-2上采取了宝贝步骤,已经通过5-min quick startScothIO example。我尝试了一个组件和服务的例子,我甚至无法启动我的应用程序,当我发动npm start命令。在“npm start”找不到'.component'和'.service'模块例外

我获得以下错误:

app/app.ts(5,33): error TS2307: Cannot find module '/app/family.component'. 
app/app.ts(6,31): error TS2307: Cannot find module '/app/family.service'. 
app/family.component.ts(2,31): error TS2307: Cannot find module 'app/family.service'. 

我明白一个事实,即角/打字稿无法找到family.componentfamily.service当其试图编译,但所有的导入路径似乎是我正确的,因为它的工作在尝试使用5-min quick start示例时都很好。

这里是Plunker link拥有所有的代码文件

请帮我在纠正这种编译例外。

+1

https://plnkr.co/edit/PMt6BvYMw69BSvocvOmT?p=preview – micronyks

+0

@micronyks:u能PLZ告诉具有u在plunker环节做了什么变化ü提供?我看到除了systemjs.config.js中的一些更改外,所有文件都是相同的。 – BeingSuman

+0

是的,我更改了'systemjs.config.js'。 – micronyks

回答

2

在app.ts的路径是不正确的family.component和family.service ...

只是改变从应用/ family.component的路径,只是./family.component

的变化: -

应用程序/ family.component ==> ./family.component

应用程序/ family.service ==> ./family.service

这将解决你的问题:)

+0

非常感谢@Akshay,它像一个魅力男人:) – BeingSuman