angularjs 应用程序启动时出现Angular 错误“未找到模块”

inb24sb2  于 2022-10-31  发布在  Angular
关注(0)|答案(2)|浏览(194)

我刚开始使用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.

为什么会这样?我该怎么补救?
我的服务版本如下:

  • 节点:v4.6.0
  • Angular :Angular -倾斜:1.0.0-beta.24
  • 离子型:2.1.17
  • cordova :6.4.0
oipij1gg

oipij1gg1#

正如gelliott181在评论中所建议的:
如果你升级了,一定要再次“ng init”你的应用程序,并“d”为diff它要求你覆盖的所有文件,然后盲目地OKing更改你的组件和package.json。
这为我解决了同样的问题,但我留下了另一个错误,那就是:

ERROR in default is not an NgModule

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

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

我觉得它可以和angular 2.4.1一起使用。

dbf7pr2w

dbf7pr2w2#

我有几个小时的问题。原来我有一个错误的版本的angular-cli安装。ng新的是产卵了一个应用程序,不会建立。

npm uninstall -g angular-cli
npm cache clean
npm install -g angular-cli@latest

是什么让我工作。这一切都要感谢这个答案从@yoongkang-lim ng serve does not work

相关问题