首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >缺少json文件的JSPM包

缺少json文件的JSPM包
EN

Stack Overflow用户
提问于 2017-06-09 08:55:33
回答 1查看 224关注 0票数 0

当我执行命令时,我得到了错误的包文件:

代码语言:javascript
复制
jspm bundle src/main.js main-bundle.js

不包括像npm:@angular/animations@4.1.3.json这样的文件,不包含.json文件,只有.js文件,但是,如果我从OSX启动相同的命令,那么这些字段都包括在内。

来自OSX (有效的包文件内容):

代码语言:javascript
复制
   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包定义):

代码语言:javascript
复制
   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 (0.16.4),我想这两种环境都有不同的影响,但我已经删除了~/.jspm目录以获得相同的结果,而且我不知道还会有什么影响。

在这两种情况下,jspm.config.js文件是相同的:

代码语言:javascript
复制
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:@ bundle /http@4.1.3/bundle/http.umd.js”,因为在“npm:@bundle/http@4.1.3.json”中定义了该文件,但是,由于某种原因,包定义文件在包中被跳过。

在这两种环境中,是否还有其他文件需要我签入?任何想法都是欢迎的。

更新:经过一些测试后,我怀疑问题与systemjs-builder有关,而不是jspm。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-06-09 15:24:19

最后,我发现了这个问题,如果带有getPackageConfigPath(...)的目录绝对路径包含一个"(“),则库系统utils.js中的utils.js中的方法packageConfigPaths将失败(什么也不返回)。

在linux中,jenkins作业的名称类似于"MyProject (angular2)",这导致构建过程无法为包中的任何一个库找到packageConfigPath。

我在github项目上打开了一个问题:https://github.com/systemjs/builder/issues/811

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44453491

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档