2017-02-04 9 views
0

Gulpコマンドを実行しているときにMy Reactアプリがクラッシュしています。数時間後には完璧に動作していました。 Azureプラットフォームにアプリケーションをデプロイしたいので、ノードのバージョンを6.2.1から6.2.2に変更しました。私は、この端末で(nodemonのAPPCRASH)クラッシュ文を取得していますがぶ飲みコマンドを実行したときにここで Gulpコマンドを実行するとnodemonアプリがクラッシュする

[09:43:30] Requiring external module babel-register 
[09:43:31] Using gulpfile ~/Downloads/Frontend-Master-master/gulpfile.babel.js 
[09:43:31] Starting 'build:watch'... 
[09:43:31] Starting 'copy:assets'... 
[09:43:31] Starting 'copy:vendors'... 
    Cleaned build/ 
    Copied 12 asset entries. 
[09:43:31] Finished 'copy:vendors' after 179 ms 
[09:43:31] Starting 'copy:views'... 
[09:43:31] copied views all files 1.87 kB 
[09:43:31] Finished 'copy:views' after 39 ms 
[09:43:31] Starting 'copy:public'... 
[09:43:31] Finished 'copy:public' after 7.85 ms 
[09:43:31] Finished 'copy:assets' after 233 ms 
[09:43:31] Starting 'bundle:dll'... 
DLL Bundled. 
Hash: 7ed86431bba8f924d2d1 
Version: webpack 1.13.3 
Time: 2869ms 
     Asset  Size Chunks    Chunk Names 
dll.vendor.js 3.08 MB  0 [emitted] vendor 
[09:43:34] Finished 'bundle:dll' after 2.9 s 
[09:43:34] Starting 'bundle'... 
Hash: 83008c2f0264de7933ac 
Version: webpack 1.13.3 
Time: 412ms 
      Asset  Size Chunks    Chunk Names 
server-bundle.js 24.4 kB  0 [emitted] main 
    -- server:watch bundled. 
Hash: 4fcb73c5d659e0ff6d79 
Version: webpack 1.13.3 
Time: 4737ms 
           Asset  Size Chunks    Chunk Names 
552d3ad10bba822801dbc6245f754eaa.mp4 21.1 MB   [emitted] 
         main-bundle.js 1.36 MB  0 [emitted] main 
    -- client bundled. 
[09:43:39] Finished 'bundle' after 4.75 s 
[09:43:39] Starting 'start:server'... 
Starting Node Server... 
[09:43:39] Finished 'start:server' after 38 ms 
[09:43:39] Starting 'watch:sync'... 
[09:43:39] [nodemon] 1.11.0 
[09:43:39] [nodemon] to restart at any time, enter `rs` 
[09:43:39] [nodemon] watching: build/server-bundle.js 
[09:43:39] [nodemon] starting `node --debug --inspect build/server-bundle.js` 
Server Restarted: Reloading BrowserSync. 
[tessact: ] Reloading Browsers... 
node: bad option: --inspect 
[09:43:39] [nodemon] app crashed - waiting for file changes before starting... 
[tessact: ] Proxying: http://localhost:4200 
[tessact: ] Access URLs: 
---------------------------------------- 
     Local: http://localhost:3000 
    External: http://192.168.168.144:3000 
---------------------------------------- 
      UI: http://localhost:3001 
UI External: http://192.168.168.144:3001 
---------------------------------------- 
[tessact: ] Watching files... 
[09:43:39] Finished 'watch:sync' after 356 ms 
[09:43:39] Starting 'watch:assets'... 
[09:43:39] Finished 'watch:assets' after 16 ms 
[09:43:39] Finished 'build:watch' after 8.29 s 
[09:43:39] Starting 'default'... 
[09:43:39] Finished 'default' after 2.14 μs 
webpack built 4fcb73c5d659e0ff6d79 in 2992ms 
Hash: 4fcb73c5d659e0ff6d79 
Version: webpack 1.13.3 
Time: 2992ms 
           Asset  Size Chunks    Chunk Names 
552d3ad10bba822801dbc6245f754eaa.mp4 21.1 MB   [emitted] 
         main-bundle.js 1.36 MB  0    main 
webpack: bundle is now VALID. 

は私の一気ファイルである今、この

npm -g install n used 

npm cache clean -f 

n 6.2.2 

のようなノードのバージョンを変更しました

gulp.task('default', ['build:watch']); 
gulp.task('build:prod', cb=> { 
    WATCH = false; 
    run('copy:assets', 'bundle', cb); 
}); 
gulp.task('build:watch', cb=> { 
    WATCH = true; 
    run('copy:assets', 'bundle:dll', 'bundle', 'start:server', 'watch:sync', 'watch:assets', cb); 
}); 

gulp.task('bundle:dll', cb=> { 
    if (IS_PROD) 
     return cb(); 

    var dllBundler = webpack(DLLConfig); 

    return new Promise((resolve, reject)=> { 
     dllBundler.run((err, stats)=> { 
      if (err) { 
       return reject(err) 
      } 
      console.log('DLL Bundled.') 
      console.log(stats.toString({colors: true, chunks: false})) 
      resolve() 
     }); 
    }) 
}); 

gulp.task('bundle', cb => { 
    var count = 0; 
    clientBundler = webpack(ClientConfig) 
    serverBundler = webpack(ServerConfig); 
    const bundleComplete = (msg) => (err, stats)=> { 
     if (err) 
      throw new gutil.PluginError(msg + ':bundle', err) 
     console.log(stats.toString({ colors: true, chunks: false })); 
     console.log(` -- ${msg} bundled.`); 
     if (++count === 2) cb(); 
    } 

    clientBundler.run(bundleComplete('client')); 
    WATCH 
     ? serverBundler.watch(750, bundleComplete('server:watch')) 
     : serverBundler.run(bundleComplete('server')) 
}); 

gulp.task('start:server', cb=> { 
    console.log('Starting Node Server...'); 
    $.nodemon({ 
     script: 'build/server-bundle.js', 
     watch: ['build/server-bundle.js'], 
     ext: 'js', 
     ignore: ['!build/public', '!build/vendor', 'src/client'], 
     env: Object.assign({NODE_ENV: 'development', DEBUG: 'tessact:*'}, process.env), 
     nodeArgs: ['--debug', '--inspect'] 
    }).on('start', cb=>{ 
     console.log('Server Restarted: Reloading BrowserSync.'); 
     browserSync.reload(); 
    }); 
    cb(); 
}); 

gulp.task('watch:sync', cb=> { 
    process.on('exit',() => browserSync.exit()); 
    browserSync({ 
     logPrefix: 'tessact: ', 
     open: false, notify: true, 
     port: (process.env.BS_PORT || 3000), 
     proxy: { 
      target: 'localhost:4200', 
      middleware: [ 
       webpackDevMiddleware(clientBundler, { 
        publicPath: ClientConfig.output.publicPath, 
        stats: {colors: true, chunks: false} 
       }), 
       webpackHotMiddleware(clientBundler) 
      ] 
     }, 
     files: [ 
      'build/public/**/*.css', 
      '!build/public/**/*.js' 
     ] 
    }, cb); 
}); 

gulp.task('copy:vendors', vendorsTask); 
gulp.task('copy:assets', cb=> { 
    run('copy:vendors', 'copy:views', 'copy:public', cb); 
}); 
gulp.task('copy:views', cb=> { 
    return (
     gulp.src('./src/server/views/**/*.jade') 
      .pipe($.changed('./build/views')) 
      .pipe($.size({title: 'copied views', pretty: true})) 
      .pipe(gulp.dest('./build/views')) 
    ) 
}); 
gulp.task('copy:public', cb=> { 
    return (
     gulp.src('./src/public/**/*.*') 
      .pipe($.changed('./build/public/')) 
      .pipe($.size({title: 'copied public', pretty: true})) 
      .pipe(gulp.dest('./build/public/')) 
    ) 
}); 
gulp.task('watch:assets', cb=> { 
    gulp.watch('./src/server/views/**/*.jade', {interval: 1000}, ['copy:views']); 
    gulp.watch('./src/public/**/*.*', {interval: 1000}, ['copy:public']); 
    cb() 

enter image description here

答えて

0

私は最新の安定版にアップグレードすることで問題を解決

sudo npm cache clean -f 
sudo npm install -g n 
sudo n stable 

乾杯

介してノードJSの