Error: Module not found on paths with a space in them

Bud version 6 has ModuleNotFound-Errors if a parent directory has a space in its name.
It worked though in version 5.
Unfortunately my roots directory is called “Local Sites” and I can’t just rename it because it contains about 60 other websites.

The problem is, that in the generated webpack.config.js file the spaces in the paths are replaced by “%20”. Before version 6 there where left as spaces:

e.g. in version 6:

"loader": "/Users/jon/Local%20Sites/mysite/app/public/wp-content/themes/sho22/node_modules/babel-loader/lib/index.js",

e.g. in version 5:

"loader": "/Users/jon/Local Sites/mysite/app/public/wp-content/themes/sho22/node_modules/babel-loader/lib/index.js",

Does anyone experience the same problem and has found a solution without renaming the directories?
Thank you!

I’m using:
@roots/bud”: “6.3.3”,
@roots/bud-sass”: “6.3.3”,
@roots/sage”: “6.3.3”,

and working on a Mac

I’m not sure what exactly is failing but this is an issue with node, more broadly:

I wouldn’t be surprised if there are other issues with spaces in file paths outside of node’s child module.

I’ll have to experiment in order to have any sense of what is failing and if we even have control over it. In the meantime, I would try a symbolic link:

1 Like

Thank you – you made my day!

I created a new directory “Local%20Sites” next to the original “Local Sites” and placed a symbolic link in there to my website folder.

In the generated webpack.config.js file I actually see the path sometimes with blank spaces and sometimes spaces replaced by %20 …

But with this solution both versions work.