Angular2 RC2 - Quickstart项目无法生成2个.umd.js文件

时间:2016-06-16 18:36:09

标签: javascript angular

当我到达步骤

时,今天在https://angular.io/docs/ts/latest/tutorial/处完成快速入门教程
npm start

我看到两个404丢失的错误:

404 GET /node_modules/@angular/platform-browser-dynamic/platform-browser-dynamic.umd.js
404 GET /node_modules/@angular/core/core.umd.js

我直接从教程中复制了systemjs.config.js和其他文件(见下文)。这是使用2.0.0-rc.2。任何Angular专家都知道目前快速启动代码有什么问题吗?我应该尝试使用webpack工具吗?



/**
 * System configuration for Angular 2 samples
 * Adjust as necessary for your application needs.
 */
(function(global) {
  // map tells the System loader where to look for things
  var map = {
    'app':                        'app', // 'dist',
    '@angular':                   'node_modules/@angular',
    'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api',
    'rxjs':                       'node_modules/rxjs'
  };
  // packages tells the System loader how to load when no filename and/or no extension
  var packages = {
    'app':                        { main: 'main.js',  defaultExtension: 'js' },
    'rxjs':                       { defaultExtension: 'js' },
    'angular2-in-memory-web-api': { main: 'index.js', defaultExtension: 'js' },
  };
  var ngPackageNames = [
    'common',
    'compiler',
    'core',
    'http',
    'platform-browser',
    'platform-browser-dynamic',
    'router',
    'router-deprecated',
    'upgrade',
  ];
  // Individual files (~300 requests):
  function packIndex(pkgName) {
    packages['@angular/'+pkgName] = { main: 'index.js', defaultExtension: 'js' };
  }
  // Bundled (~40 requests):
  function packUmd(pkgName) {
    packages['@angular/'+pkgName] = { main: pkgName + '.umd.js', defaultExtension: 'js' };
  }
  // Most environments should use UMD; some (Karma) need the individual index files
  var setPackageConfig = System.packageWithIndex ? packIndex : packUmd;
  // Add package entries for angular packages
  ngPackageNames.forEach(setPackageConfig);
  var config = {
    map: map,
    packages: packages
  };
  System.config(config);
})(this);




2 个答案:

答案 0 :(得分:4)

您的unsigned int get_svc_pid (SC_HANDLE svc) { DWORD pid = 0; BYTE *buf = NULL; DWORD buf_size = 0; SERVICE_STATUS_PROCESS *svc_info = NULL; //determine svc_info size QueryServiceStatusEx(svc, SC_STATUS_PROCESS_INFO, NULL, 0, &buf_size); if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) { fprintf(msglog, "ERR: QueryServiceStatusEx failed\nGLE: %u\n", GetLastError()); return 0; } buf = malloc(buf_size); if (!buf) { fprintf(msglog, "ERR: malloc failed\nsize requested: %u\n", buf_size); return 0; } //get pid if (!QueryServiceStatusEx(svc, SC_STATUS_PROCESS_INFO, buf, buf_size, &buf_size)) { fprintf(msglog, "ERR: QueryServiceStatusEx failed\nGLE: %u\n", GetLastError()); } else { svc_info = (SERVICE_STATUS_PROCESS*) buf; switch (svc_info->dwCurrentState) { case SERVICE_RUNNING: case SERVICE_PAUSE_PENDING: case SERVICE_PAUSED: case SERVICE_CONTINUE_PENDING: pid = svc_info->dwProcessId; break; } } free(buf); return pid; } 功能应该是:

packUmd

注意// Bundled (~40 requests): function packUmd(pkgName) { packages['@angular/' + pkgName] = { main: '/bundles/' + pkgName + '.umd.js', //bundles path defaultExtension: 'js' }; }

答案 1 :(得分:0)

如何以编程方式解决这个问题:

  

function packUmd(pkgName) { if (pkgName != 'router'){ packages['@angular/'+pkgName] = { main: pkgName + '.umd.js', defaultExtension: 'js' }; } else{ packages['@angular/' + pkgName] = { main: 'bundles/' + pkgName + '.umd.js', defaultExtension: 'js' };
} };
  
  注意:(初学者警报)可能不是解决问题的最佳方法。