大佬教程收集整理的这篇文章主要介绍了angular – 由于错误导致预渲染失败:错误:模块构建失败:错误:ENOENT:没有此类文件或目录,打开,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我一直让它走了一段时间,继续开发应用程序的其他部分.@H_874_7@
我现在再次尝试使用COre 2,但仍然没有运气.@H_874_7@
我创建项目,它完美地工作.我可以改变或创建Angular组件,一切运行良好.@H_874_7@
一旦我安装ngx-translate(https://www.npmjs.com/package/@ngx-translate/core)或ng2-translate(https://www.npmjs.com/package/ng2-translate),一切都无效.我遇到的最常见的问题是@H_874_7@
NodeInvocationException: Prerendering Failed because of error: Error: Module build Failed: Error: ENOENT: no such file or directory,open 'C:\Users\Andrei\AngularDefault\SIGAD\node_modules\@angular\platform-server\bundles\platform-server.umd.js'.
我安装时会收到这些警告:@H_874_7@
npm install @ ngx-translate / core –save@H_874_7@
npm WARN aspnet-webpack@2.0.1 requires a peer of webpack@^1.13.2 || ^2.1.0-beta but none was installed. npm WARN karma-chai@0.1.0 requires a peer of chai@* but none was installed. npm WARN karma-jasmine@1.1.0 requires a peer of jasmine-core@* but none was installed. npm WARN webpack-dev-middleware@1.11.0 requires a peer of webpack@^1.0.0 || ^2.0.0 || ^3.0.0 but none was installed. npm WARN @ngx-translate/core@7.2.0 requires a peer of @angular/core@>=2.0.0 but none was installed. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any "} (current: {"os":"win32","arch":"x64"})
对于npm install @ngx-translate / http-loader@H_874_7@
npm WARN @ngx-translate/core@7.2.0 requires a peer of @angular/core@>=2.0.0 but none was installed. npm WARN aspnet-webpack@2.0.1 requires a peer of webpack@^1.13.2 || ^2.1.0-beta but none was installed. npm WARN karma-chai@0.1.0 requires a peer of chai@* but none was installed. npm WARN karma-jasmine@1.1.0 requires a peer of jasmine-core@* but none was installed. npm WARN webpack-dev-middleware@1.11.0 requires a peer of webpack@^1.0.0 || ^2.0.0 || ^3.0.0 but none was installed. npm WARN @ngx-translate/http-loader@1.0.2 requires a peer of @angular/core@>=4.3.0 but none was installed. npm WARN @ngx-translate/http-loader@1.0.2 requires a peer of @angular/common@>=4.3.0 but none was installed. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"x64"})
这不是我通过“预渲染失败因为……”获得的唯一文件.例如,最奇怪的是如果我下载Mark Pieszak模板https://github.com/MarkPieszak/aspnetcore-angular2-universal.我在错误中得到另一个文件:@H_874_7@
NodeInvocationException: Prerendering Failed because of error: Error: Module build Failed: Error: ENOENT: no such file or directory,open 'C:\Users\Andrei\AngularDefault\SIGAD\node_modules\reflect-Metadata\Reflect.js' at Error (nativE)
没有我做任何改变……这是一个Windows问题或什么?@H_874_7@
来自其他问题和github上的问题,如Ionic: Error: Module build failed: Error: ENOENT: no such file or directory
我怀疑在将Angular更新到最新版本4.3.6之后,一些软件包已经改变了它们的情况,但我找不到它们.@H_874_7@
我的package.json是:@H_874_7@
{ "name": "SIGAD","private": true,"version": "0.0.0","scripts": { "test": "karma start ClientApp/test/karma.conf.js" },"dependencies": { "@angular/animations": "4.3.6","@angular/common": "4.3.6","@angular/compiler": "4.3.6","@angular/compiler-cli": "4.3.6","@angular/core": "4.3.6","@angular/forms": "4.3.6","@angular/http": "4.3.6","@angular/platform-browser": "4.3.6","@angular/platform-browser-dynamic": "4.3.6","@angular/platform-server": "4.3.6","@angular/router": "4.3.6","@ngtools/webpack": "1.6.2","@ngx-translate/core": "^7.2.0","@types/webpack-env": "1.13.0","angular2-template-loader": "0.6.2","aspnet-prerendering": "^3.0.1","aspnet-webpack": "^2.0.1","awesome-typescript-loader": "3.2.3","bootstrap": "3.3.7","css": "2.2.1","css-loader": "0.28.5","es6-shim": "0.35.3","event-source-polyfill": "0.0.9","expose-loader": "0.7.3","extract-text-webpack-plugin": "3.0.0","file-loader": "0.11.2","html-loader": "0.5.1","isomorphic-fetch": "2.2.1","jquery": "3.2.1","json-loader": "0.5.7","preboot": "5.0.0","raw-loader": "0.5.1","reflect-Metadata": "0.1.10","rxjs": "5.4.3","style-loader": "0.18.2","to-String-loader": "1.1.5","typescript": "2.4.2","url-loader": "0.5.9","webpack": "3.5.5","webpack-hot-middleware": "2.18.2","webpack-merge": "4.1.0","zone.js": "0.8.17" },"devDependencies": { "@types/chai": "4.0.4","@types/jasmine": "2.5.54","chai": "4.1.1","jasmine-core": "2.7.0","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": "2.0.4" } }
我的app.module.ts是:@H_874_7@
import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; import { httpR_758_11845@odule } from '@angular/http'; import { RouterModule } from '@angular/router'; import { AppComponent } from './components/app/app.component'; import { NavMenuComponent } from './components/navmenu/navmenu.component'; import { HomeComponent } from './components/home/home.component'; import { FetchDataComponent } from './components/fetchdata/fetchdata.component'; import { CounterComponent } from './components/counter/counter.component'; import { UserComponent } from "./components/user/user.component"; import { ErrorComponent } from "./components/error/error.component"; @NgModule({ declarations: [ AppComponent,NavMenuComponent,CounterComponent,FetchDataComponent,HomeComponent,UserComponent,ErrorComponent ],imports: [ CommonModule,httpR_758_11845@odule,FormsModule,RouterModule.forRoot([ { path: '',redirectTo: 'home',pathMatch: 'full' },{ path: 'home',component: HomeComponent },{ path: 'counter',component: CounterComponent },{ path: 'fetch-data',component: FetchDataComponent },{ path: 'user',component: UserComponent },{ path: 'error',component: ErrorComponent },{ path: '**',redirectTo: 'home' } ]) ] }) export class AppModuleShared { }
GIT存储库在这里https://github.com/dobrinsky/AngularDefault.@H_874_7@
请帮助…这很难理解为什么不工作因为每个人都很容易使用…@H_874_7@
附:我没有使用webpack.这2个包需要运行webpack吗?@H_874_7@
更新:使用Npm install webpack throws@H_874_7@
NodeInvocationException: Can't resolve all parameters for httpXsrfCookieExtractor: (?,[object Object],[object Object])
在此之后我尝试了:@H_874_7@
>完全卸载节点(以及任何版本管理器/等)
>转到%ApPDAta%/漫游删除任何npm或npm缓存文件夹
>重新启动计算机,安装最新的节点6. *
> npm i -g webpack@H_874_7@
安装时我没有收到上述警告,但现在我得到:@H_874_7@
Prerendering Failed because of error: Error: Module build Failed: TypeError: loaderUtils.getOptions is not a function
以上是大佬教程为你收集整理的angular – 由于错误导致预渲染失败:错误:模块构建失败:错误:ENOENT:没有此类文件或目录,打开全部内容,希望文章能够帮你解决angular – 由于错误导致预渲染失败:错误:模块构建失败:错误:ENOENT:没有此类文件或目录,打开所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。