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

**URL:** https://discourse.roots.io/t/error-module-not-found-on-paths-with-a-space-in-them/23612
**Category:** bud
**Tags:** bud, sage10
**Created:** 2022-07-26T08:25:44Z
**Posts:** 3

## Post 1 by @fint — 2022-07-26T08:25:44Z

Hi  
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

---

## Post 2 by @kellymears — 2022-07-26T18:15:02Z

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

> <https://github.com/nodejs/node/issues/38490>
>
> <!--
> Thank you for reporting an issue.
> 
> This issue tracker is for bugs and is…sues found within Node.js core.
> If you require more general support please file an issue on our help
> repo. https://github.com/nodejs/help
> 
> 
> Please fill in as much of the template below as you're able.
> 
> Version: output of `node -v`
> Platform: output of `uname -a` (UNIX), or output of `"$([Environment]::OSVersion | ForEach-Object VersionString) $(if ([Environment]::Is64BitOperatingSystem) { "x64" } else { "x86" })"` in PowerShell console (Windows)
> Subsystem: if known, please specify affected core module name
> -->
> 
> * **Version** : 14.16.0
> * **Platform** : MacOS 10.15.7 (Windows and Linux too)
> * **Subsystem** : child_process
> 
> ### What steps will reproduce the bug?
> 
> 1. Create a javascript program that spawns a shell script.
> 2. Ensure that the full path to the shell script has spaces in the directory names.
> 3. Run the javascript program.
> 
> <!--
> Enter details about your bug, preferably a simple code snippet that can be
> run using `node` directly without installing third-party dependencies.
> -->
> 
> ```javascript
> async function executeChildProcess(executable, argList) {
> const child = spawn(executable, argList, {
> stdio: ['pipe', 'pipe', 'pipe'],
> shell: true,
> detached: false,
> windowsHide: true
> });
> await onExit(child)
> .then(() => console.log(`${executable} exited with exit code 0`))
> .catch((err) => console.log(`${executable} failed: ${err.toString()}`));
> 
> return child.exitCode;
> }
> 
> executeChildProcess('/Applications/My Application.app/Contents/tools/myScript.sh', ['-v']).then();
> ```
> 
> ### How often does it reproduce? Is there a required condition?
> 
> Every single time. Yes, the child_process module should be properly escaping commands that have spaces in them since we cannot control where the user installs the application. 
> 
> ### What is the expected behavior?
> 
> The shell script is executed properly
> 
> <!--
> If possible please provide textual output instead of screenshots.
> -->
> 
> ### What do you see instead?
> 
> /bin/sh: /Applications/My: No such file or directory
> Applications/My Application.app/Contents/tools/myScript.sh failed: Error: Exit with error code: 127
> 
> <!--
> If possible please provide textual output instead of screenshots.
> -->
> 
> ### Additional information
> 
> <!--
> Tell us anything else you think we should know.
> -->

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:

[https://ss64.com/osx/ln.html](https://ss64.com/osx/ln.html)

---

## Post 3 by @fint — 2022-07-27T05:24:54Z

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.  
Thanks!
