2

私は Gulp システムを初めて使用し、AngularJS アプリケーションを起動して実行しようとしています。Yeoman を使用して、gulp タスクの標準セットを取得しましたが、そのうちの 1 つがエラー メッセージで失敗しています。特定の行に絞り込みましたが、このシステムについて、何が失敗しているのか、またはその理由を知るのに十分な知識がありません (もちろん、不足しているファイルの名前は別として)。

失敗している gulp ファイルは次のとおりです。

const gulp = require('gulp');
const filter = require('gulp-filter');
const useref = require('gulp-useref');
const lazypipe = require('lazypipe');
const rev = require('gulp-rev');
const revReplace = require('gulp-rev-replace');
const uglify = require('gulp-uglify');
const cssnano = require('gulp-cssnano');
const htmlmin = require('gulp-htmlmin');
const sourcemaps = require('gulp-sourcemaps');
const uglifySaveLicense = require('uglify-save-license');
const ngAnnotate = require('gulp-ng-annotate');

const conf = require('../conf/gulp.conf');

gulp.task('build', build);

function build() {
  const htmlFilter = filter(conf.path.tmp('*.html'), {restore: true});
  const jsFilter = filter(conf.path.tmp('**/*.js'), {restore: true});
  const cssFilter = filter(conf.path.tmp('**/*.css'), {restore: true});

  return gulp.src(conf.path.tmp('/index.html'))
    .pipe(useref({}, lazypipe().pipe(sourcemaps.init, {loadMaps: true})))
    // .pipe(jsFilter)
    // .pipe(ngAnnotate())
    // .pipe(uglify({preserveComments: uglifySaveLicense})).on('error', conf.errorHandler('Uglify'))
    // .pipe(rev())
    // .pipe(jsFilter.restore)
    // .pipe(cssFilter)
    // .pipe(cssnano())
    // .pipe(rev())
    // .pipe(cssFilter.restore)
    // .pipe(revReplace())
    // .pipe(sourcemaps.write('maps'))
    // .pipe(htmlFilter)
    // .pipe(htmlmin())
    // .pipe(htmlFilter.restore)
    // .pipe(gulp.dest(conf.path.dist()));
}

ご覧のとおり、問題のある行以外はすべてコメントアウトしました。その行は、ビルド プロセスの一部として呼び出されると、次のエラー メッセージを生成します。

[17:22:27] 'build' errored after 42 ms
[17:22:27] Error: Error: File not found with singular glob: C:\Users\Jeffrey Getzin\Documents\GitHubVisualStudio\newclient\.tmp\jspm_packages\system.js
at DestroyableTransform.<anonymous> (C:\Users\Jeffrey Getzin\Documents\GitHubVisualStudio\newclient\node_modules\gulp-useref\index.js:65:28)
at emitOne (events.js:101:20)
at DestroyableTransform.emit (events.js:188:7)
at emitOne (events.js:101:20)
at Through2.emit (events.js:188:7)
at OrderedStreams.<anonymous> (C:\Users\Jeffrey Getzin\Documents\GitHubVisualStudio\newclient\node_modules\glob-stream\index.js:140:20)
at emitOne (events.js:96:13)
at OrderedStreams.emit (events.js:188:7)
at emitOne (events.js:96:13)
at DestroyableTransform.emit (events.js:188:7)
at Glob.<anonymous> (C:\Users\Jeffrey Getzin\Documents\GitHubVisualStudio\newclient\node_modules\glob-stream\index.js:40:16)
at Glob.g (events.js:286:16)
at emitOne (events.js:96:13)
at Glob.emit (events.js:188:7)
at Glob._finish (C:\Users\Jeffrey Getzin\Documents\GitHubVisualStudio\newclient\node_modules\glob-stream\node_modules\glob\glob.js:172:8)
at done (C:\Users\Jeffrey Getzin\Documents\GitHubVisualStudio\newclient\node_modules\glob-stream\node_modules\glob\glob.js:159:12)
[17:22:27] 'build' errored after 25 s
[17:22:27] 'default' errored after 25 s
[17:22:27] 'serve:dist' errored after 25 s

 Process finished with exit code 1

明らかに、jspm パッケージの一時コピーで system.js を探していますが、なぜでしょうか? そして、なぜそれが見つからないのですか?ファイルはそこにあるべきですか?gulp スクリプトが何をしようとしているのかわからないので、なぜ機能しないのか推測することはできませんでした。

これはおそらく包括的な回答を得るには十分な情報ではないことはわかっていますが、少なくとも正しい方向に向けるために十分な情報がここにあることを願っています.

ありがとう!

2017 年 1 月 3 日更新

私は、userrefが何をすべきかをちょっと理解しました。私のindex.htmlファイルは

<!doctype html>
<html>
  <head>
    <base href="/">
    <meta charset="utf-8">
    <title>FountainJS</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="icon" type="image/png" href="http://fountainjs.io/assets/imgs/fountain.png" />
    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <link rel="stylesheet" href="css/camera.css" type="text/css" media="screen">
    <link rel="stylesheet" href="css/style.css" type="text/css" media="screen">

    <!-- build:css(.tmp) index.css -->
    <link rel="stylesheet" href="index.css"></link>
    <!-- endbuild -->
  </head>

  <body class="front" ng-app="app">
    <div id="main">
      <ui-view></ui-view>
      <page-footer></page-footer>
    </div>
  </body>

  <!-- build:js(.tmp) index.js -->
  <script src="jspm_packages/system.js"></script>
  <script src="jspm.browser.js"></script>
  <script src="jspm.config.js"></script>

  <script>
    System.import('src/index.ts');
  </script>
  <!-- endbuild -->
</html>

私が考えていることは、ブロックを置き換えることになっているということです

  <!-- build:js(.tmp) index.js -->
  <script src="jspm_packages/system.js"></script>
  <script src="jspm.browser.js"></script>
  <script src="jspm.config.js"></script>

  <script>
    System.import('src/index.ts');
  </script>
  <!-- endbuild -->

  <script src="tmp/index.js"></script>

この音は正しいですか?

4

1 に答える 1