ng服务中出现错误“无法解析模块”

Ham*_*ian 3 angular-cli angular

我使用以下命令通过angular cli创建一个新的angular项目:

$ ng new ng5-app

当我尝试使用以下命令运行应用程序时,我一直等到所有创建的文件和所有依赖项安装完毕,以及所有这些任务完成之后

$ ng serve

出现此错误:

            ** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ ** Date: 2018-01-26T14:12:03.297Z
            Hash: 2238da56910f9b52c46b
            Time: 2158ms
            chunk {inline} inline.bundle.js (inline) 5.79 kB [entry] [rendered]
            chunk {main} main.bundle.js (main) 2.93 kB [initial] [rendered]
            chunk {polyfills} polyfills.bundle.js (polyfills) 636 bytes [initial] [rendered]
            chunk {styles} styles.bundle.js (styles) 33.6 kB [initial] [rendered]
            chunk {vendor} vendor.bundle.js (vendor) 852 kB [initial] [rendered]

            ERROR in Error: Could not resolve module H:/
                at StaticSymbolResolver.getSymbolByModule (H:\#htdocs\ng5-app\node_modules\@angular\compiler\bundles\compiler.umd.js:29765:30)
                at StaticReflector.resolveExternalReference (H:\#htdocs\ng5-app\node_modules\@angular\compiler\bundles\compiler.umd.js:31610:62)
                at parseLazyRoute (H:\#htdocs\ng5-app\node_modules\@angular\compiler\bundles\compiler.umd.js:29049:55)
                at AotCompiler.listLazyRoutes (H:\#htdocs\ng5-app\node_modules\@angular\compiler\bundles\compiler.umd.js:31142:43)
                at AngularCompilerProgram.listLazyRoutes (H:\#htdocs\ng5-app\node_modules\@angular\compiler-cli\src\transformers\program.js:156:30)
                at Function.NgTools_InternalApi_NG_2.listLazyRoutes (H:\#htdocs\ng5-app\node_modules\@angular\compiler-cli\src\ngtools_api.js:44:36)
                at AngularCompilerPlugin._getLazyRoutesFromNgtools (H:\#htdocs\ng5-app\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:248:66)
                at Promise.resolve.then.then (H:\#htdocs\ng5-app\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:565:50)
                at process._tickCallback (internal/process/next_tick.js:103:7)

            webpack: Failed to compile.
Run Code Online (Sandbox Code Playgroud)

此错误是什么问题?

Ham*_*ian 7

我找到了解决方案。我正在文件夹中创建应用程序文件#htdocs夹。我将其移至其外部,一切正常。太奇怪了!!!