IntendaUK / opus-ui-website

MIT License
0 stars 0 forks source link

NPM Install Fails on WSL #1

Closed MansMarius-Intenda closed 5 months ago

MansMarius-Intenda commented 5 months ago

npm ERR! path \wsl.localhost\Ubuntu\home\intenda\opus-ui-website\node_modules\esbuild npm ERR! command failed npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node install.js npm ERR! '\wsl.localhost\Ubuntu\home\intenda\opus-ui-website\node_modules\esbuild' npm ERR! CMD.EXE was started with the above path as the current directory. npm ERR! UNC paths are not supported. Defaulting to Windows directory. npm ERR! node:internal/modules/cjs/loader:1078 npm ERR! throw err;

joel6948 commented 5 months ago

It seems like you're encountering an issue with npm install failing on Windows Subsystem for Linux (WSL), particularly related to a UNC path error when installing the esbuild package.

Here are some steps you can try to resolve this issue:

Update npm and Node.js: Ensure you are using the latest versions of npm and Node.js. Sometimes, issues like this are resolved in newer releases.

Clear npm cache: Sometimes, corrupted cache files can cause installation issues. You can try clearing the npm cache by running:

npm cache clean --force Use WSL paths: Make sure you're using WSL paths instead of Windows paths when working within the WSL environment. For example, instead of C:\Users\username, you should use /mnt/c/Users/username.

Check permissions: Ensure that you have the necessary permissions to install packages in the specified directory. You might need to run the npm install command with elevated privileges using sudo.

Install esbuild separately: Instead of relying on npm install to install the esbuild package, you can try installing it separately using npm or yarn: npm install esbuild or yarn add esbuild Manually install the package: If none of the above steps work, you can try manually installing the package by downloading it from npm and extracting it into the node_modules directory of your project.

Check for antivirus/firewall interference: Sometimes, antivirus or firewall software can interfere with npm installations. Temporarily disabling such software and then attempting the installation again might help diagnose the issue. If none of these steps resolve the problem, please provide more details about your setup and any specific error messages you're encountering, and I can try to assist you further.

MansMarius-Intenda commented 5 months ago

If you are using NPM that was installed on windows, you need to also install NPM on you WSL instance. Please see this to fix. https://learn.microsoft.com/en-us/windows/dev-environment/javascript/nodejs-on-wsl

MansMarius-Intenda commented 5 months ago

joel6948's solution did not work for me, the Linux native NVM solution did.