ENOENT: no such file or directory, scandir 'direflow-components'
After installing react redux and forced to do npm audit fix direflow upgrades its dependencies and later on this error comes out ENOENT: no such file or directory, scandir 'direflow-components'
I faced the same issue, initially it had react dependency conflicts with [email protected] . I tried below version and it worked for me.
"react": "16.13.1",
"react-dom": "16.13.1"
Or atleast make sure you are not using conflicting version.
Still the same, after changing the react version, deleted node_modules and package-lock.json and reinstalled all from beginning. but the errors is still there. I cant start or either build my component
[email protected] start
direflow-scripts start
ENOENT: no such file or directory, scandir 'direflow-components'
I had the same problem.
(migrated from direflow to react-to-webcomponent for now, took me about 3 hours)
I had the same problem.
(migrated from direflow to react-to-webcomponent for now, took me about 3 hours)
How do you create a bundle from react-to-webcomponent? That's our only issue for migrating over
https://github.com/Silind-Software/direflow/blob/c71ab70e343249f261a255568fdb4179a5f96dfe/packages/direflow-scripts/src/config/config-overrides.ts#L22-L24
originalEntry is correctly set to the path to the "index.ts" which resides in the same folder as folder "direflow-components".
E.g. /home/user/project/src/index.tsx.
Although the next line doesn't make any sense.
For development, it picks char at index 1 (h) and for production it picks char at index 0 (/).
Later on it is meant to cut index.tsx from pathIndex and join it with "direflow-components" - the default componentPath.
I found how to bypass the error.
In direflow-webpack.js treat config before passing it to direflow-scripts.
function wrapEntryToArray(config) {
if (typeof config.entry === "string") {
config.entry = [config.entry];
}
return config;
}
/**
* Webpack configuration for Direflow Component
* Additional webpack plugins / overrides can be provided here
*/
module.exports = (config, env) => ({
...webpackConfig(wrapEntryToArray(config), env),
// Add your own webpack config here (optional)
});
The issue is that scripts expect entry always as an array of strings. But if only string is passed, it treats it as an array of characters. I was trying to find where I could fix it in the Direflow source code, but I could locate the right place.
Maybe someone else could understand it better and find the right place for the fix.
Afterwards I am getting another error:
var cssRuleIndex = module.rules[2].oneOf.findIndex(function (rule) { return '.css'.match(rule.test); });
^
TypeError: Cannot read property 'oneOf' of undefined
But I guess, this is unrelated to the originally reported issue and maybe not everyone will have it.
I was having this issue too, and for me, it was an upgrade of "react-scripts" from "3.4.4" to "4.0.3" that caused it. When i reverted this, the issue was gone.