jdavisclark / mite

schema migrations so easy you already know how to write them. guaranteed.
http://jdc0589.github.io/mite
11 stars 6 forks source link

fs error when walking the directory tree in the Context Submodule Provider #37

Closed jdavisclark closed 10 years ago

jdavisclark commented 10 years ago

per zach:

Not sure what's causing this, but it's almost certainly outside of mite's control. In this instance it should probably have a soft failure (eg. it reports the error as a warning, but continues looking for submodules elsewhere).


[3/26/14, 4:33:43 PM] Zachary McKinnon: I added a try/catch around the walk function [3/26/14, 4:33:46 PM] Zachary McKinnon:

ContextSubmoduleProvider.prototype.getSubmodules = function(config) {
        var submodules = [];
try{
        walk(config.miteRoot, function(dirPath, dirs, files) {                    
                var isRoot = files.some(function(f) {
                        return config.CONFIG_FILENAMES.indexOf(f) > -1;
                });

                if(isRoot && dirPath !== config.miteRoot) {
                        submodules.push({
                                name: path.basename(dirPath),
                                miteRoot: dirPath,
                                migrationRoot: path.join(dirPath, config.migrationFolderName)
                        });
                }
        });
} catch (ex) { console.log(ex); }
        return submodules;
};

[3/26/14, 4:33:53 PM] Zachary McKinnon: and got this error: [3/26/14, 4:34:26 PM] Zachary McKinnon: zach@wbui:/sites/mibrary/qa$ mite status unexecuted migrations: 2014-02-18T10-58-26Z.sql 2014-02-21T16-46-29Z.sql 2014-02-24T21-19-50Z.sql 2014-02-26T17-03-54Z.sql 2014-02-26T21-10-57Z.sql 2014-02-27T21-22-59Z.sql 2014-02-28T19-42-05Z.sql 2014-03-06T19-25-18Z.sql 2014-03-07T17-57-21Z.sql 2014-03-11T21-28-47Z.sql { [Error: ENOENT, no such file or directory '/sites/mibrary/qa/public/content/Scrolr'] errno: 34, code: 'ENOENT', path: '/sites/mibrary/qa/public/content/Scrolr', syscall: 'stat' } submodules: unexecuted [3/26/14, 4:34:47 PM] Zachary McKinnon: that directory does exist

jdavisclark commented 10 years ago

additionally:

fatal: Error: ENOENT, no such file or directory '/home/madison/director-point/public/content/twitter-bootstrap-3.0.0' Error: ENOENT, no such file or directory '/home/madison/director-point/public/content/twitter-bootstrap-3.0.0' at Object.fs.statSync (fs.js:684:18) at filenames.reduce.names (/usr/local/lib/node_modules/mite/lib/submoduleProviders/contextProvider.js:56:11) at Array.reduce (native) at walk (/usr/local/lib/node_modules/mite/lib/submoduleProviders/contextProvider.js:53:24) at /usr/local/lib/node_modules/mite/lib/submoduleProviders/contextProvider.js:76:5 at Array.forEach (native) at walk (/usr/local/lib/node_modules/mite/lib/submoduleProviders/contextProvider.js:74:14) at /usr/local/lib/node_modules/mite/lib/submoduleProviders/contextProvider.js:76:5 at Array.forEach (native) at walk (/usr/local/lib/node_modules/mite/lib/submoduleProviders/contextProvider.js:74:14)

jdavisclark commented 10 years ago

@zmckinnon Looks like this is caused when the directory walker hits a symlink thats broken. in both these cases its a node_module for a static/public resource symlinked elsewhere in the project. Running npm install prior to running mite commands will fix the issue.

A more graceful failure is coming in a hotfix...

jdavisclark commented 10 years ago

there is no "fix" for this since it isn't a bug with mite in reality.

As of f31522d3f1fe11f5d9c247578f61e5b56a525f9d these errors are reported a little more gracefully, but still as errors (since they are).