错误:安装ngx-paypal后

时间:2019-02-06 09:28:58

标签: angular paypal

当我尝试构建或启动我的角度应用程序时,按照以下安装步骤添加ngx-paypal后,会出现一个巨大的错误:https://www.npmjs.com/package/ngx-paypal/v/4.0.2

  

$ npm运行构建

     

pfl@0.0.0构建D:\ Documents \ GitHub Repositories \ eMate \ client   ng build --prod

     

日期:2019-02-06T09:09:36.720Z
  哈希:876956740a48ed92eebb
  时间:10432ms
  块{0} polyfills.b35e735ba10974ee9e92.bundle.js(polyfills)65.9 kB [initial] [rendered]
  块{1} styles.1a047ae87052744dd806.bundle.css(样式)4.49 kB [initial] [rendered]
  块{2} main.69fbd0fc96123d4373d2.bundle.js(主)432字节[初始] [呈现]
  块{3} vendor.80b84992b48229e8b292.bundle.js(供应商)207 kB [initial] [rendered]
  块{4} inline.93c9b92dbb4dfd0f022b.bundle.js(内联)1.45 kB [entry] [rendered]

     

./ src / main.ts中的错误   找不到模块:错误:无法解析“ D:\ Documents \ GitHub Repositories \ eMate \ client \ src”中的“ ./$$_gendir/app/app.app.module.ngfactory”   在'D:\ Documents \ GitHub Repositories \ eMate \ client \ src'中解析'./$$_gendir/app/app.module.ngfactory'     使用描述文件:D:\ Documents \ GitHub Repositories \ eMate \ client \ package.json(相对路径:./src)       字段“浏览器”不包含有效的别名配置     使用描述文件后:D:\ Documents \ GitHub Repositories \ eMate \ client \ package.json(相对路径:./src)       使用描述文件:D:\ Documents \ GitHub Repositories \ eMate \ client \ package.json(相对路径:./src/$$_gendir/app/app.app.module.ngfactory)         没有扩展           字段“浏览器”不包含有效的别名配置           D:\ Documents \ GitHub存储库\ eMate \ client \ src \ $$ _ gendir \ app \ app.module.ngfactory不存在         .ts           字段“浏览器”不包含有效的别名配置           D:\ Documents \ GitHub存储库\ eMate \ client \ src \ $$ _ gendir \ app \ app.module.ngfactory.ts不存在         .js           字段“浏览器”不包含有效的别名配置           D:\ Documents \ GitHub存储库\ eMate \ client \ src \ $$ _ gendir \ app \ app.module.ngfactory.js不存在         作为目录           D:\ Documents \ GitHub存储库\ eMate \ client \ src \ $$ _ gendir \ app \ app.module.ngfactory不存在   [D:\ Documents \ GitHub存储库\ eMate \ client \ src \ $$ _ gendir \ app \ app.module.ngfactory]   [D:\ Documents \ GitHub存储库\ eMate \ client \ src \ $$ _ gendir \ app \ app.module.ngfactory.ts]   [D:\ Documents \ GitHub存储库\ eMate \ client \ src \ $$ _ gendir \ app \ app.module.ngfactory.js]   [D:\ Documents \ GitHub存储库\ eMate \ client \ src \ $$ _ gendir \ app \ app.module.ngfactory]    @ ./src/main.ts 3:0-74    @多./src/main.ts   错误中的错误:模块D的元数据版本不匹配:/ Documents / GitHub存储库/eMate/client/node_modules/ngx-paypal/ngx-paypal.d.ts,找到了版本4,预期为3       在StaticSymbolResolver.getModuleMetadata(D:\ Documents \ GitHub存储库\ eMate \ client \ node_modules @ angular \ compiler \ bundles \ compiler.umd.js:25616:34)       在StaticSymbolResolver._createSymbolsOf(D:\ Documents \ GitHub Repositories \ eMate \ client \ node_modules @ angular \ compiler \ bundles \ compiler.umd.js:25404:46)       在StaticSymbolResolver.getSymbolsOf(D:\ Documents \ GitHub Repositories \ eMate \ client \ node_modules @ angular \ compiler \ bundles \ compiler.umd.js:25385:14)       在D:\ Documents \ GitHub Repositories \ eMate \ client \ node_modules @ angular \ compiler \ bundles \ compiler.umd.js:24241:30       在Array.forEach()       在extractProgramSymbols(D:\ Documents \ GitHub Repositories \ eMate \ client \ node_modules @ angular \ compiler \ bundles \ compiler.umd.js:24240:79)       在AotCompiler.analyzeModulesAsync(D:\ Documents \ GitHub Repositories \ eMate \ client \ node_modules @ angular \ compiler \ bundles \ compiler.umd.js:23796:47)       在CodeGenerator.codegen(D:\ Documents \ GitHub Repositories \ eMate \ client \ node_modules @ angular \ compiler-cli \ src \ codegen.js:32:14)       在Function.NgTools_InternalApi_NG_2.codeGen上(D:\ Documents \ GitHub存储库\ eMate \ client \ node_modules @ angular \ compiler-cli \ src \ ngtools_api.js:73:30)       在_donePromise.Promise.resolve.then(D:\ Documents \ GitHub Repositories \ eMate \ client \ node_modules @ ngtools \ webpack \ src \ plugin.js:430:58)   npm ERR!代码ELIFECYCLE
  npm ERR! errno 1
  npm ERR! pfl@0.0.0构建:ng build --prod
  npm ERR!退出状态1
  npm错误!
  npm ERR!在pfl@0.0.0生成脚本处失败。
  npm ERR! npm可能不是问题。上面可能还有其他日志记录输出。

     

npm错误!可以在以下位置找到此运行的完整日志:
  npm ERR! C:\ Users \ ilian \ AppData \ Roaming \ npm-cache_logs \ 2019-02-06T09_09_36_878Z-debug.log

我已执行以下步骤:

npm install ngx-module

app.module.ts:

import { NgxPayPalModule } from 'ngx-paypal';

imports: [
  FacebookModule.forRoot(),
  CommonModule,
  FormsModule,
  RegisterModule,
  ReactiveFormsModule,
  BrowserModule,
  HttpModule,
  AppRoutingModule,
  SharedModule,
  RegisterCoachModule,
  Ng2CloudinaryModule,
  FileUploadModule,
  EmojiPickerModule.forRoot(),
  AngularCropperjsModule,
  NguiSortableModule,
  DpDatePickerModule,
  CoachesModule,
  ArticlesModule,
  AngularMultiSelectModule,
  NgxPayPalModule // line added
],

payments.component.ts [这是我使用NgxPayPalModule的唯一地方]

import { PayPalConfig, PayPalEnvironment, PayPalIntegrationType } from 'ngx-paypal'; // i'm adding import on top of file

ngOnInit() {
  this.initPayPalConfig();
}

private initPayPalConfig() {
   this.payPalConfig = new PayPalConfig(
     PayPalIntegrationType.ClientSideREST,
     PayPalEnvironment.Sandbox,
     { // ... })
}

payments.componenet.html

<ngx-paypal [config]="payPalConfig"></ngx-paypal>

0 个答案:

没有答案