2016-05-19 9 views
0

正常に動作しているノード・グロブを使用しています。 は、私は今、私はまた、フォルダ2から一発で読みたいマルチパターン使用時のノードglobbyエラー

 glob('folder1/*.js'), function(err, files){ 
     if (err) { 
      console.log('Not able to get files from folder: ', err); 
     } else { 
      files.forEach(function (file) { 

https://github.com/isaacs/node-glob

を次のように1 folder1のためにそれを使用して、私は次のようglobbyを使用しようと、私はエラー

globby(['folder1/*.js','folder2/*.js']).then(function(err, files){ 
     if (err) { 
      console.log('Not able to get files from folder: ', err); 
     } else { 
      //Get plugin configuration & provided actions 
      files.forEach(function (file) { 
を得ました

https://github.com/sindresorhus/globby

この場合、ファイルはundfiendと私は何らかの理由でエラーになった

答えて

1

thenコールバックからerr引数を削除してみてください。エラー処理にcatchを使用してください。 globby(['folder1/*.js','folder2/*.js']).then(function(files){...}).catch(function(err){...})

関連する問題