应用程序启动时的角度错误

时间:2016-12-21 18:09:34

标签: angularjs cordova angular-cli

所以我开始使用Ionic的混合移动应用程序。首先,我在Windows 10上安装了NodeJS,Angular,Ionic和Cordova。我遇到的问题是当我创建Anuglar应用程序并尝试运行它时,它给了我很多错误,我不知道为什么如果我没有改变任何事情。我使用了以下命令。

# ng new [APP-NAME]
# cd [APP-NAME]
# ng serve

返回以下所有内容:

** NG Live Development Server is running on http://localhost:4200. **
 94% asset optimizationwebpack: wait until bundle finished: /
Hash: dc480c594a2365ced8eb
Time: 1626ms
chunk    {0} styles.bundle.map (styles) 28 bytes {2} [initial] [rendered]
chunk    {1} main.bundle.js, main.bundle.map (main) 40 bytes [initial] [rendered]
chunk    {2} inline.bundle.js, inline.bundle.map (inline) 0 bytes [entry] [rendered]

ERROR in multi main
Module not found: Error: Can't resolve 'webpack-dev-server/client?http://localhost:4200/' in 'C:\Users\Brian\Documents\Ionic Projects\github-repos'
 @ multi main

ERROR in multi styles
Module not found: Error: Can't resolve 'style-loader' in 'C:\Users\Brian\Documents\Ionic Projects\github-repos'
 @ multi styles

ERROR in multi main
Module not found: Error: Can't resolve '@ngtools/webpack' in 'C:\Users\Brian\Documents\Ionic Projects\github-repos'
 @ multi main

ERROR in   Error: Child compilation failed:
  Entry module not found: Error: Can't resolve 'raw-loader' in 'C:\Users\Brian\Documents\Ionic Projects\github-repos':
  Error: Can't resolve 'raw-loader' in 'C:\Users\Brian\Documents\Ionic Projects\github-repos'

  - compiler.js:76
    [github-repos]/[angular-cli]/[html-webpack-plugin]/lib/compiler.js:76:16

  - Compiler.js:279 Compiler.<anonymous>
    [github-repos]/[angular-cli]/[webpack]/lib/Compiler.js:279:10

  - Compiler.js:474
    [github-repos]/[angular-cli]/[webpack]/lib/Compiler.js:474:13

  - Tapable.js:102 next
    [github-repos]/[angular-cli]/[webpack]/[tapable]/lib/Tapable.js:102:11

  - CachePlugin.js:61 Compiler.<anonymous>
    [github-repos]/[angular-cli]/[webpack]/lib/CachePlugin.js:61:4

  - Tapable.js:106 Compiler.applyPluginsAsyncSeries
    [github-repos]/[angular-cli]/[webpack]/[tapable]/lib/Tapable.js:106:13

  - Compiler.js:471 Compiler.<anonymous>
    [github-repos]/[angular-cli]/[webpack]/lib/Compiler.js:471:10

  - Tapable.js:102 next
    [github-repos]/[angular-cli]/[webpack]/[tapable]/lib/Tapable.js:102:11

  - suppress-entry-chunks-webpack-plugin.js:28 Compilation.<anonymous>
    [github-repos]/[angular-cli]/plugins/suppress-entry-chunks-webpack-plugin.js:28:17

  - Tapable.js:106 Compilation.applyPluginsAsyncSeries
    [github-repos]/[angular-cli]/[webpack]/[tapable]/lib/Tapable.js:106:13

  - Compilation.js:626 Compilation.<anonymous>
    [github-repos]/[angular-cli]/[webpack]/lib/Compilation.js:626:18

  - Tapable.js:95 Compilation.applyPluginsAsyncSeries
    [github-repos]/[angular-cli]/[webpack]/[tapable]/lib/Tapable.js:95:46

  - Compilation.js:617 Compilation.<anonymous>
    [github-repos]/[angular-cli]/[webpack]/lib/Compilation.js:617:10

  - Tapable.js:95 Compilation.applyPluginsAsyncSeries
    [github-repos]/[angular-cli]/[webpack]/[tapable]/lib/Tapable.js:95:46

  - Compilation.js:612 Compilation.<anonymous>
    [github-repos]/[angular-cli]/[webpack]/lib/Compilation.js:612:9

  - Tapable.js:95 Compilation.applyPluginsAsyncSeries
    [github-repos]/[angular-cli]/[webpack]/[tapable]/lib/Tapable.js:95:46

  - Compilation.js:608 Compilation.<anonymous>
    [github-repos]/[angular-cli]/[webpack]/lib/Compilation.js:608:8

  - Tapable.js:95 Compilation.applyPluginsAsyncSeries
    [github-repos]/[angular-cli]/[webpack]/[tapable]/lib/Tapable.js:95:46

  - Compilation.js:554 Compilation.seal
    [github-repos]/[angular-cli]/[webpack]/lib/Compilation.js:554:7

  - Compiler.js:468 Compiler.<anonymous>
    [github-repos]/[angular-cli]/[webpack]/lib/Compiler.js:468:16

  - Tapable.js:189
    [github-repos]/[angular-cli]/[webpack]/[tapable]/lib/Tapable.js:189:11

  - Compilation.js:452 Compilation.<anonymous>
    [github-repos]/[angular-cli]/[webpack]/lib/Compilation.js:452:10

  - Compilation.js:347 Compilation.errorAndCallback
    [github-repos]/[angular-cli]/[webpack]/lib/Compilation.js:347:3

  - Compilation.js:364 Compilation.<anonymous>
    [github-repos]/[angular-cli]/[webpack]/lib/Compilation.js:364:11

  - NormalModuleFactory.js:40 onDoneResolving
    [github-repos]/[angular-cli]/[webpack]/lib/NormalModuleFactory.js:40:20

  - NormalModuleFactory.js:159
    [github-repos]/[angular-cli]/[webpack]/lib/NormalModuleFactory.js:159:21

  - async.js:726
    [github-repos]/[angular-cli]/[webpack]/[async]/lib/async.js:726:13

  - async.js:52
    [github-repos]/[angular-cli]/[webpack]/[async]/lib/async.js:52:16

  - async.js:241 done
    [github-repos]/[angular-cli]/[webpack]/[async]/lib/async.js:241:17

  - async.js:44
    [github-repos]/[angular-cli]/[webpack]/[async]/lib/async.js:44:16

  - async.js:723
    [github-repos]/[angular-cli]/[webpack]/[async]/lib/async.js:723:17

  - async.js:167
    [github-repos]/[angular-cli]/[webpack]/[async]/lib/async.js:167:37

  - async.js:52
    [github-repos]/[angular-cli]/[webpack]/[async]/lib/async.js:52:16

  - async.js:361
    [github-repos]/[angular-cli]/[webpack]/[async]/lib/async.js:361:13

  - async.js:52
    [github-repos]/[angular-cli]/[webpack]/[async]/lib/async.js:52:16

  - async.js:241 done
    [github-repos]/[angular-cli]/[webpack]/[async]/lib/async.js:241:17

  - async.js:44
    [github-repos]/[angular-cli]/[webpack]/[async]/lib/async.js:44:16

  - async.js:358
    [github-repos]/[angular-cli]/[webpack]/[async]/lib/async.js:358:17

  - NormalModuleFactory.js:216
    [github-repos]/[angular-cli]/[webpack]/lib/NormalModuleFactory.js:216:19

  - Resolver.js:70 onResolved
    [github-repos]/[angular-cli]/[webpack]/[enhanced-resolve]/lib/Resolver.js:70:11

  - createInnerCallback.js:31 loggingCallbackWrapper
    [github-repos]/[angular-cli]/[webpack]/[enhanced-resolve]/lib/createInnerCallback.js:31:19

  - Resolver.js:138 afterInnerCallback
    [github-repos]/[angular-cli]/[webpack]/[enhanced-resolve]/lib/Resolver.js:138:10

  - createInnerCallback.js:31 loggingCallbackWrapper
    [github-repos]/[angular-cli]/[webpack]/[enhanced-resolve]/lib/createInnerCallback.js:31:19

  - Tapable.js:145 Resolver.applyPluginsAsyncSeriesBailResult1
    [github-repos]/[angular-cli]/[webpack]/[tapable]/lib/Tapable.js:145:46

  - Resolver.js:125 innerCallback
    [github-repos]/[angular-cli]/[webpack]/[enhanced-resolve]/lib/Resolver.js:125:19

  - createInnerCallback.js:31 loggingCallbackWrapper
    [github-repos]/[angular-cli]/[webpack]/[enhanced-resolve]/lib/createInnerCallback.js:31:19

  - Tapable.js:247
    [github-repos]/[angular-cli]/[webpack]/[tapable]/lib/Tapable.js:247:15

  - UnsafeCachePlugin.js:39
    [github-repos]/[angular-cli]/[webpack]/[enhanced-resolve]/lib/UnsafeCachePlugin.js:39:4

  - createInnerCallback.js:31 loggingCallbackWrapper
    [github-repos]/[angular-cli]/[webpack]/[enhanced-resolve]/lib/createInnerCallback.js:31:19

  - Resolver.js:138 afterInnerCallback
    [github-repos]/[angular-cli]/[webpack]/[enhanced-resolve]/lib/Resolver.js:138:10

  - createInnerCallback.js:31 loggingCallbackWrapper
    [github-repos]/[angular-cli]/[webpack]/[enhanced-resolve]/lib/createInnerCallback.js:31:19


webpack: bundle is now VALID.

有谁知道为什么会这样,以及如何解决这个问题?我的服务版本如下:

Node: v4.6.0
Angular: angular-cli: 1.0.0-beta.24
Ionic: 2.1.17
Cordova: 6.4.0

非常感谢任何帮助,感谢先进。

2 个答案:

答案 0 :(得分:0)

正如gelliott181在评论中所说:

  

如果您升级了,请确保&#34; ng init&#34;你的应用程序再次和&#34; d&#34;对于diff所有文件,它会要求您在盲目地改变组件和package.json之前覆盖。

这为我解决了同样的问题,但我还有另一个错误,即:

ERROR in default is not an NgModule

跟踪HERE,并提供降级到beta21的解决方法,这解决了我的问题:

$ npm install --save-dev angular-cli@1.0.0-beta.21

对我来说它适用于棱角2.4.1。

答案 1 :(得分:0)

我有几个小时的问题。原来我安装了angular-cli的错误版本。 ng new正在催生一个无法构建的应用程序。

dynamic_cast

是什么让我工作。全部归功于@ yoongkang-lim的回答 ng serve does not work