运行Angular 6 SPA时出错
我正在尝试使用Visual Studio 2017社区创建一个新的Angular 6水疗中心 然而,当我运行这个项目时,我得到了以下错误 处理请求时发生未处理的异常 NodeInvocationException:rxjs.merge不是函数 TypeError:rxjs.merge不是函数 在新的ApplicationRef(网页包://%5Bname%5D_%5Bhash%5D//node_modules/@angular/core/bundles/core.umd.js?:6758:18) 运行运行Angular 6 SPA时出错,angular,webpack,Angular,Webpack,我正在尝试使用Visual Studio 2017社区创建一个新的Angular 6水疗中心 然而,当我运行这个项目时,我得到了以下错误 处理请求时发生未处理的异常 NodeInvocationException:rxjs.merge不是函数 TypeError:rxjs.merge不是函数 在新的ApplicationRef(网页包://%5Bname%5D_%5Bhash%5D//node_modules/@angular/core/bundles/core.umd.js?:6758:18)
webpack--config.\webpack.config.vendor.js--modedevelopment
我得到以下输出
Hash: ce0f0762f3389ba7924e2d2c28b9e665b99678a4
Version: webpack 4.2.0
Child
Hash: ce0f0762f3389ba7924e
Time: 4181ms
Built at: 2018-3-21 21:35:28
Asset Size Chunks Chunk Names
vendor.js 5.27 MiB vendor [emitted] vendor
vendor.css 174 KiB vendor [emitted] vendor
Entrypoint vendor = vendor.js vendor.css
WARNING in ./node_modules/@angular/core/fesm5/core.js
7498:15-36 Critical dependency: the request of a dependency is an expression
@ ./node_modules/@angular/core/fesm5/core.js
@ dll vendor
WARNING in ./node_modules/@angular/core/fesm5/core.js
7518:15-102 Critical dependency: the request of a dependency is an expression
@ ./node_modules/@angular/core/fesm5/core.js
@ dll vendor
WARNING in ./node_modules/@angular/core/fesm5/core.js
System.import() is deprecated and will be removed soon. Use import() instead.
For more info visit https://webpack.js.org/guides/code-splitting/
@ dll vendor 7498:15-36
WARNING in ./node_modules/@angular/core/fesm5/core.js
System.import() is deprecated and will be removed soon. Use import() instead.
For more info visit https://webpack.js.org/guides/code-splitting/
@ dll vendor 7518:15-102
Child extract-text-webpack-plugin node_modules/extract-text-webpack-plugin/dist node_modules/css-loader/index.js!node_modules/bootstrap/dist/css/bootstrap.css:
Entrypoint undefined = extract-text-webpack-plugin-output-filename
Child
Hash: 2d2c28b9e665b99678a4
Time: 4160ms
Built at: 2018-3-21 21:35:28
Asset Size Chunks Chunk Names
vendor.js 5.3 MiB vendor [emitted] vendor
Entrypoint vendor = vendor.js
WARNING in ./node_modules/@angular/core/bundles/core.umd.js
System.import() is deprecated and will be removed soon. Use import() instead.
For more info visit https://webpack.js.org/guides/code-splitting/
@ dll vendor 7539:15-36
WARNING in ./node_modules/@angular/core/bundles/core.umd.js
System.import() is deprecated and will be removed soon. Use import() instead.
For more info visit https://webpack.js.org/guides/code-splitting/
@ dll vendor 7559:15-102
webpack : (node:22080) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
At line:1 char:1
+ webpack --mode development
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: ((node:22080) De....hooks` instead:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
Hash: e69114918ff049b5c0ac707c222d6ee8afd2d94a
Version: webpack 4.2.0
Child
Hash: e69114918ff049b5c0ac
Time: 7313ms
Built at: 2018-3-21 21:37:47
Asset Size Chunks Chunk Names
main-client.js 230 KiB main-client [emitted] main-client
main-client.js.map 2.54 KiB main-client [emitted] main-client
Entrypoint main-client = main-client.js main-client.js.map
Child
Hash: 707c222d6ee8afd2d94a
Time: 7950ms
Built at: 2018-3-21 21:37:48
Asset Size Chunks Chunk Names
main-server.js 3.3 MiB main-server [emitted] main-server
Entrypoint main-server = main-server.js
当运行webpack--modedevelopment
时,我得到以下输出
Hash: ce0f0762f3389ba7924e2d2c28b9e665b99678a4
Version: webpack 4.2.0
Child
Hash: ce0f0762f3389ba7924e
Time: 4181ms
Built at: 2018-3-21 21:35:28
Asset Size Chunks Chunk Names
vendor.js 5.27 MiB vendor [emitted] vendor
vendor.css 174 KiB vendor [emitted] vendor
Entrypoint vendor = vendor.js vendor.css
WARNING in ./node_modules/@angular/core/fesm5/core.js
7498:15-36 Critical dependency: the request of a dependency is an expression
@ ./node_modules/@angular/core/fesm5/core.js
@ dll vendor
WARNING in ./node_modules/@angular/core/fesm5/core.js
7518:15-102 Critical dependency: the request of a dependency is an expression
@ ./node_modules/@angular/core/fesm5/core.js
@ dll vendor
WARNING in ./node_modules/@angular/core/fesm5/core.js
System.import() is deprecated and will be removed soon. Use import() instead.
For more info visit https://webpack.js.org/guides/code-splitting/
@ dll vendor 7498:15-36
WARNING in ./node_modules/@angular/core/fesm5/core.js
System.import() is deprecated and will be removed soon. Use import() instead.
For more info visit https://webpack.js.org/guides/code-splitting/
@ dll vendor 7518:15-102
Child extract-text-webpack-plugin node_modules/extract-text-webpack-plugin/dist node_modules/css-loader/index.js!node_modules/bootstrap/dist/css/bootstrap.css:
Entrypoint undefined = extract-text-webpack-plugin-output-filename
Child
Hash: 2d2c28b9e665b99678a4
Time: 4160ms
Built at: 2018-3-21 21:35:28
Asset Size Chunks Chunk Names
vendor.js 5.3 MiB vendor [emitted] vendor
Entrypoint vendor = vendor.js
WARNING in ./node_modules/@angular/core/bundles/core.umd.js
System.import() is deprecated and will be removed soon. Use import() instead.
For more info visit https://webpack.js.org/guides/code-splitting/
@ dll vendor 7539:15-36
WARNING in ./node_modules/@angular/core/bundles/core.umd.js
System.import() is deprecated and will be removed soon. Use import() instead.
For more info visit https://webpack.js.org/guides/code-splitting/
@ dll vendor 7559:15-102
webpack : (node:22080) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
At line:1 char:1
+ webpack --mode development
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: ((node:22080) De....hooks` instead:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
Hash: e69114918ff049b5c0ac707c222d6ee8afd2d94a
Version: webpack 4.2.0
Child
Hash: e69114918ff049b5c0ac
Time: 7313ms
Built at: 2018-3-21 21:37:47
Asset Size Chunks Chunk Names
main-client.js 230 KiB main-client [emitted] main-client
main-client.js.map 2.54 KiB main-client [emitted] main-client
Entrypoint main-client = main-client.js main-client.js.map
Child
Hash: 707c222d6ee8afd2d94a
Time: 7950ms
Built at: 2018-3-21 21:37:48
Asset Size Chunks Chunk Names
main-server.js 3.3 MiB main-server [emitted] main-server
Entrypoint main-server = main-server.js
我的package.json文件如下:
{
"name": "Bemfeito.Services.Public",
"private": true,
"version": "0.0.0",
"scripts": {
"test": "karma start ClientApp/test/karma.conf.js"
},
"devDependencies": {
"@angular/animations": "6.0.0-rc.0",
"@angular/common": "6.0.0-rc.0",
"@angular/compiler": "6.0.0-rc.0",
"@angular/compiler-cli": "6.0.0-rc.0",
"@angular/core": "6.0.0-rc.0",
"@angular/forms": "6.0.0-rc.0",
"@angular/http": "6.0.0-rc.0",
"@angular/platform-browser": "6.0.0-rc.0",
"@angular/platform-browser-dynamic": "6.0.0-rc.0",
"@angular/platform-server": "6.0.0-rc.0",
"@angular/router": "6.0.0-rc.0",
"@ngtools/webpack": "^1.10.2",
"@types/chai": "4.1.2",
"@types/jasmine": "2.8.6",
"@types/webpack-env": "1.13.5",
"angular2-router-loader": "0.3.5",
"angular2-template-loader": "0.6.2",
"aspnet-prerendering": "^3.0.1",
"aspnet-webpack": "^2.0.3",
"awesome-typescript-loader": "4.0.1",
"bootstrap": "4.0.0",
"chai": "4.0.2",
"chalk": "2.3.2",
"css": "2.2.1",
"css-loader": "0.28.4",
"es6-shim": "0.35.3",
"event-source-polyfill": "0.0.9",
"expose-loader": "0.7.3",
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"file-loader": "0.11.2",
"font-awesome": "^4.7.0",
"html-loader": "0.4.5",
"html-webpack-plugin": "^3.0.7",
"isomorphic-fetch": "2.2.1",
"jasmine-core": "2.6.4",
"jquery": "3.2.1",
"json-loader": "0.5.4",
"karma": "1.7.0",
"karma-chai": "0.1.0",
"karma-chrome-launcher": "2.2.0",
"karma-cli": "1.0.1",
"karma-jasmine": "1.1.0",
"karma-webpack": "3.0.0",
"mini-css-extract-plugin": "0.2.0",
"popper.js": "1.14.1",
"preboot": "6.0.0-beta.3",
"raw-loader": "0.5.1",
"reflect-metadata": "0.1.10",
"rxjs": "^5.5.7",
"style-loader": "0.18.2",
"to-string-loader": "1.1.5",
"typescript": "2.7.2",
"url-loader": "0.5.9",
"webpack": "^4.2.0",
"webpack-addons": "^1.1.5",
"webpack-cli": "^2.0.12",
"webpack-hot-middleware": "2.21.2",
"webpack-merge": "4.1.2",
"zone.js": "0.8.20"
}
}
现在唯一需要提及的另一点是,在解决方案资源管理器中,我在webpack cli上有一些警告,我不确定是否需要列出的所有软件包?下面是一个截图
有人能告诉我这里发生了什么吗?我修复了这个错误,用appRef.isStable.pipe替换了该行。Angular v6需要rxjs v6。你试过更新它吗?然后,在代码中也应该使用rxjs v6语法。我有一个类似的问题,但在
boot.server.ts
中的appRef.isStable.first(isStable=>isStable)
。错误是第一个不存在。知道吗?我用appRef.isStable.pipe
@iAziz替换了那一行,修复了这个错误。我已经搜索了几个小时了。我完美地遵循了Angular upgrade指南,使用了rxjs lint工具,等等。祝福你。请把你应得的荣誉作为答案贴在这里!(这也将帮助其他可能认为这个问题没有答案的人。)@iAziz我们也这样做了,但我们使用了appRef.isStable.pipe(第一个(obj=>{..}));->所以我们只消费第一项