简体   繁体   English

找不到模块Angular2 Ctrl

[英]Cannot Find Module Angular2 Ctrl

This is a popular question with several resources on the web to resolve. 这是一个很受欢迎的问题,可以通过网络上的一些资源解决。 However after trying multiple solutions none have worked. 但是,在尝试了多种解决方案后,没有任何效果。 I am getting an error which says Cannot Find Module './neuralnet'. 我收到一条错误消息,提示找不到模块“ ./neuralnet”。

打字稿Ctrl

文件路径

I have tried some of the solutions listed here 我已经尝试过这里列出的一些解决方案

How do I resolve "Cannot find module" error using Node.js? 如何使用Node.js解决“找不到模块”错误?

including npm install and npm install --save neuralnet and nothing has worked. 包括npm install和npm install --save neuronet,什么都没用。

Any suggestions would be great. 任何建议都很好。

The way you have it setup -- in home.component.ts -- your import { NeuralNetService } from './neuralnet.service' , is looking in the current directory, which is in app/components/home . 在home.component.ts中设置的方式- import { NeuralNetService } from './neuralnet.service' ,将在当前目录中查找,该目录位于app/components/home This clearly isn't where it is. 这显然不在这里。

Use import { NeuralNetService } from './../../neuralnet.service' and it will properly resolve. 使用import { NeuralNetService } from './../../neuralnet.service'它将正确解析。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM