簡體   English   中英

缺少json文件的JSPM捆綁包

[英]JSPM Bundle with missing json files

執行命令時,我收到了錯誤的捆綁文件:

jspm bundle src/main.js main-bundle.js

不包含npm:@angular/animations@4.1.3.json類的文件,不包含npm:@angular/animations@4.1.3.json文件,僅包含.js文件,但是,如果我從OSX啟動相同的命令,則包含這些字段

從OSX(有效的捆綁文件內容):

   npm:@angular/animations@4.1.3.json
   npm:@angular/animations@4.1.3/bundles/animations-browser.umd.min.js
   npm:@angular/animations@4.1.3/bundles/animations.umd.js
   npm:@angular/common@4.1.3.json
   npm:@angular/common@4.1.3/bundles/common.umd.js
   npm:@angular/compiler@4.1.3.json
   npm:@angular/compiler@4.1.3/bundles/compiler.umd.js
   npm:@angular/core@4.1.3.json
   npm:@angular/core@4.1.3/bundles/core.umd.js
   npm:@angular/forms@4.1.3.json
   npm:@angular/forms@4.1.3/bundles/forms.umd.js
   npm:@angular/http@4.1.3.json
   npm:@angular/http@4.1.3/bundles/http.umd.js
   npm:@angular/material@2.0.0-beta.6.json
   npm:@angular/material@2.0.0-beta.6/bundles/material.umd.js
   npm:@angular/platform-browser-dynamic@4.1.3.json
   npm:@angular/platform-browser-dynamic@4.1.3/bundles/platform-browser-dynamic.umd.js
   npm:@angular/platform-browser@4.1.3.json
   npm:@angular/platform-browser@4.1.3/bundles/platform-browser-animations.umd.min.js
   npm:@angular/platform-browser@4.1.3/bundles/platform-browser.umd.js
   npm:@angular/router@4.1.3.json
   npm:@angular/router@4.1.3/bundles/router.umd.js
   npm:core-js@2.4.1.json
   npm:core-js@2.4.1/client/shim.js
   npm:core-js@2.4.1/es6/reflect.js
   npm:core-js@2.4.1/es7/reflect.js

從Linux(錯誤的捆綁文件,缺少json包定義):

   npm:@angular/animations@4.1.3/bundles/animations-browser.umd.min.js
   npm:@angular/animations@4.1.3/bundles/animations.umd.js
   npm:@angular/common@4.1.3/bundles/common.umd.js
   npm:@angular/compiler@4.1.3/bundles/compiler.umd.js
   npm:@angular/core@4.1.3/bundles/core.umd.js
   npm:@angular/forms@4.1.3/bundles/forms.umd.js
   npm:@angular/http@4.1.3/bundles/http.umd.js
   npm:@angular/material@2.0.0-beta.6/bundles/material.umd.js
   npm:@angular/platform-browser-dynamic@4.1.3/bundles/platform-browser-dynamic.umd.js
   npm:@angular/platform-browser@4.1.3/bundles/platform-browser-animations.umd.min.js
   npm:@angular/platform-browser@4.1.3/bundles/platform-browser.umd.js
   npm:@angular/router@4.1.3/bundles/router.umd.js
   npm:core-js@2.4.1/client/shim.js
   npm:core-js@2.4.1/es6/reflect.js
   npm:core-js@2.4.1/es7/reflect.js
   npm:core-js@2.4.1/modules/_a-function.js

兩者都使用相同版本的jspm( 0.17.0-beta.41 ),systemjs( 0.20.10 )和systemjs-builder( 0.16.4 ),我想這兩種環境在影響方面都存在差異,但是我已將~/.jspm目錄刪除以得到一個干凈的環境,並得到相同的結果,但我不確定還會影響到什么。

兩種情況下jspm.config.js文件相同:

SystemJS.config({
  nodeConfig: {
    "paths": {
      "github:": "jspm_packages/github/",
      "npm:": "jspm_packages/npm/"
    }
  },
  devConfig: {
    "map": {
      "plugin-typescript": "github:frankwallis/plugin-typescript@7.0.6",
      "typescript": "npm:typescript@2.3.4",
      "child_process": "npm:jspm-nodelibs-child_process@0.2.1",
      "module": "npm:jspm-nodelibs-module@0.2.1",
      "net": "npm:jspm-nodelibs-net@0.2.1"
    },
    "packages": {
      "npm:source-map-support@0.4.14": {
        "map": {
          "source-map": "npm:source-map@0.5.6"
        }
      },
      "npm:typescript@2.3.4": {
        "map": {
          "source-map-support": "npm:source-map-support@0.4.14"
        }
      }
    }
  },
  transpiler: false,
  packages: {
    "environments": {
      "defaultExtension": "js"
    },
    "src": {
      "defaultExtension": "js"
    }
  },
  map: {
    "@angular/animations/browser": "npm:@angular/animations@4.1.3/bundles/animations-browser.umd.min.js",
    "@angular/platform-browser/animations": "npm:@angular/platform-browser@4.1.3/bundles/platform-browser-animations.umd.min.js",
    "app": "src/app"
  }
});

SystemJS.config({
  packageConfigPaths: [
    "github:*/*.json",
    "npm:@angular/*.json",
    "npm:@covalent/*.json",
    "npm:*.json"
  ],
  map: {
    "@angular/animations": "npm:@angular/animations@4.1.3",
    "@angular/common": "npm:@angular/common@4.1.3",
    "@angular/compiler": "npm:@angular/compiler@4.1.3",
    "@angular/core": "npm:@angular/core@4.1.3",
    "@angular/forms": "npm:@angular/forms@4.1.3",
    "@angular/http": "npm:@angular/http@4.1.3",
    "@angular/material": "npm:@angular/material@2.0.0-beta.6",
    "@angular/platform-browser": "npm:@angular/platform-browser@4.1.3",
    "@angular/platform-browser-dynamic": "npm:@angular/platform-browser-dynamic@4.1.3",
    "@angular/router": "npm:@angular/router@4.1.3",
    "@covalent/core": "npm:@covalent/core@1.0.0-beta.4",
    "@covalent/dynamic-forms": "npm:@covalent/dynamic-forms@1.0.0-beta.4",
    "@covalent/http": "npm:@covalent/http@1.0.0-beta.4",
    "angular-in-memory-web-api": "npm:angular-in-memory-web-api@0.3.1",
    "angular-safeguard": "npm:angular-safeguard@1.0.1",
    "assert": "npm:jspm-nodelibs-assert@0.2.1",
    "buffer": "npm:jspm-nodelibs-buffer@0.2.2",
    "constants": "npm:jspm-nodelibs-constants@0.2.1",
    "core-js": "npm:core-js@2.4.1",
    "crypto": "npm:jspm-nodelibs-crypto@0.2.1",
    "events": "npm:jspm-nodelibs-events@0.2.2",
    "file-saver": "npm:file-saver@1.3.3",
    "fs": "npm:jspm-nodelibs-fs@0.2.1",
    "hammerjs": "npm:hammerjs@2.0.8",
    "ng2-toastr": "npm:ng2-toastr@4.0.1",
    "os": "npm:jspm-nodelibs-os@0.2.1",
    "path": "npm:jspm-nodelibs-path@0.2.3",
    "process": "npm:jspm-nodelibs-process@0.2.1",
    "rxjs": "npm:rxjs@5.3.0",
    "stream": "npm:jspm-nodelibs-stream@0.2.1",
    "string_decoder": "npm:jspm-nodelibs-string_decoder@0.2.1",
    "timers": "npm:jspm-nodelibs-timers@0.2.1",
    "util": "npm:jspm-nodelibs-util@0.2.2",
    "vm": "npm:jspm-nodelibs-vm@0.2.1",
    "web-animations-js": "npm:web-animations-js@2.2.2",
    "zone.js": "npm:zone.js@0.8.5"
  },
  packages: {
      // SKIPPED //
  }
});

如果我理解正確,丟失的json文件會被處理但不包括在內,文件“ npm:@ angular / http @ 4.1.3 / bundles / http.umd.js”已包含在內,因為它是在“ npm:@ angular / http”中定義的@ 4.1.3.json”,但是由於某種原因,軟件包定義文件在捆綁包中被跳過了。

¿在這兩種環境中我還應該檢查其他文件嗎? 任何想法都歡迎。

更新:經過一些測試,我懷疑問題與systemjs-builder lib有關,而不與jspm有關

最后,我發現了問題所在,如果帶有packageConfigPaths的目錄絕對路徑包含“(” getPackageConfigPath(...) ,則lib systemjs-builder中utils.js中的getPackageConfigPath(...)方法失敗(不返回任何內容)。

在Linux中,jenkins作業的名稱類似於“ MyProject(angular2)”,這導致構建過程無法找到包中沒有任何lib的packageConfigPath。

我在github項目上打開了一個問題: https : //github.com/systemjs/builder/issues/811

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM