brunch / brunch

:fork_and_knife: Web applications made easy. Since 2011.
https://brunch.io
MIT License
6.81k stars 436 forks source link

UnhandledPromiseRejectionWarning: BrunchError: Failed to read file #1834

Closed artfulrobot closed 2 years ago

artfulrobot commented 5 years ago

Description

While having brunch watch running, often when I save a file Brunch gets confused and in a never ending compilation loop.

Expected behavior

Should just compile like normal

Actual behavior

Before the compilation loop I see the following error:

09:03:36 - info: compiled 36 files into 3 files, copied index.html in 3.1 sec
(node:13772) UnhandledPromiseRejectionWarning: BrunchError: Failed to read file app/4913.
Error: ENOENT: no such file or directory, open '/var/app/4913'
    at readAndCache.then.error (/var/node_modules/brunch/lib/fs_utils/file_list.js:147:15)

(node:13772) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of anasync function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:13772) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Environment

  1. Brunch: 2.10.17
  2. Node.js: v10.14.2
  3. NPM: 6.4.1
  4. Operating system: Debian 9
  5. Code editor: vim

package.json contents

{                                               
  "name": "brunch-app",                         
  "description": "Brunch.io application",       
  "private": true,                              
  "author": "Brunch",                           
  "version": "0.0.1",                           
  "repository": "",                             
  "scripts": {                                  
    "start": "brunch watch --server",           
    "build": "brunch build --production"        
  },                                            
  "dependencies": {                             
    "axios": "^0.18.0",                         
    "babel-plugin-transform-runtime": "^6.23.0",
    "sass-brunch": "^2.10.7",                   
    "vue": "^2.5.21",                           
    "vue-brunch": "^2.0.3"                      
  },                                            
  "devDependencies": {                          
    "auto-reload-brunch": "^2",                 
    "babel-brunch": "~6.0",                     
    "babel-preset-latest": "^6",                
    "brunch": "^2",                             
    "clean-css-brunch": "^2",                   
    "uglify-js-brunch": "^2"                    
  }                                             
}                                               

brunch config contents

// See http://brunch.io for documentation.                        
exports.files = {                                                 
  javascripts: {                                                  
    joinTo: {                                                     
      'vendor.js': /^(?!app)/, // Files that are not in `app` dir.
      'app.js': /^app/                                            
    }                                                             
  },                                                              
  stylesheets: {joinTo: 'app.css'}                                
};                                                                

exports.plugins = {                                               
  babel: {presets: ['latest']}                                    
};                                                                

Other useful files, when present (log, bower.json etc.)

12:14:55 - info: compiled Amounts.vue and 3 cached files into app.js in 167 ms
2018-12-19T12:15:07.238Z brunch:watch add app/4913
2018-12-19T12:15:07.239Z brunch:list Reading app/4913
(node:28229) UnhandledPromiseRejectionWarning: BrunchError: Failed to read file app/4913.
Error: ENOENT: no such file or directory, open '/var/app/4913'
    at readAndCache.then.error (/var/node_modules/brunch/lib/fs_utils/file_list.js:147:15)

(node:28229) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:28229) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
2018-12-19T12:15:07.257Z brunch:watch change app/Amounts.vue
2018-12-19T12:15:07.257Z brunch:list Reading app/Amounts.vue
2018-12-19T12:15:07.266Z brunch:pipeline Compiling app/Amounts.vue @ vue-brunch
2018-12-19T12:15:07.374Z brunch:watch unlink app/4913
2018-12-19T12:15:07.378Z brunch:list Compiled app/Amounts.vue
halostatue commented 5 years ago

I’m experiencing something similar:

Error: EISDIR: illegal operation on a directory, read
    at readAndCache.then.error (/Users/austin/dev/kinetic/lowes-web/assets/node_modules/brunch/lib/fs_utils/file_list.js:147:15)
    at <anonymous>:null:null

(node:82069) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:82069) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:82069) UnhandledPromiseRejectionWarning: BrunchError: Failed to read file css.
Error: EISDIR: illegal operation on a directory, read
    at readAndCache.then.error (/Users/austin/dev/kinetic/lowes-web/assets/node_modules/brunch/lib/fs_utils/file_list.js:147:15)
    at <anonymous>:null:null

(node:82069) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:82069) UnhandledPromiseRejectionWarning: BrunchError: Failed to read file js.
Error: EISDIR: illegal operation on a directory, read
    at readAndCache.then.error (/Users/austin/dev/kinetic/lowes-web/assets/node_modules/brunch/lib/fs_utils/file_list.js:147:15)
    at <anonymous>:null:null

(node:82069) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:82069) UnhandledPromiseRejectionWarning: BrunchError: Failed to read file static.
Error: EISDIR: illegal operation on a directory, read
    at readAndCache.then.error (/Users/austin/dev/kinetic/lowes-web/assets/node_modules/brunch/lib/fs_utils/file_list.js:147:15)
    at <anonymous>:null:null

(node:82069) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)

Brunch is trying to readAndCache a directory. I’m on a brunch-based Phoenix project using yarn 1.15.2, node v8.15.1 and brunch 2.10.9 (although 2.10.17 exhibits the same behaviour). The directories being read are specified explicitly in brunch-config.js as paths.watched.