skip to Main Content

Presently, I am attempting to create a PHP laravel app and install some nodejs dependencies on wsl-2 but am getting the following errors (cf. https://www.linkedin.com/learning/laravel-9-0-essential-training). FYI, I have installed nodejs v18.16.0:

jdoe@Grieg:~/DevProjects/litenotes$ curl -s https://laravel.build/litenotes | bash
...
jdoe@Grieg:~/DevProjects/litenotes$  ./vendor/bin/sail up

In another terminal:

jdoe@Grieg:~/DevProjects/litenotes$ ./vendor/bin/sail composer require laravel/breeze --dev
...
jdoe@Grieg:~/DevProjects/litenotes$ ./vendor/bin/sail artisan breeze:install
...
jdoe@Grieg:~/DevProjects/litenotes$ npm install
npm WARN cleanup Failed to remove some directories [
npm WARN cleanup   [
npm WARN cleanup     '\\wsl.localhost\Ubuntu-22.04\home\jdoe\DevProjects\litenotes\node_modules\.bin\he',
npm WARN cleanup     [Error: EISDIR: illegal operation on a directory, lstat '\wsl.localhostUbuntu-22.04homejdoeDevProjectslitenotesnode_modules.binhe'] {
npm WARN cleanup       errno: -4068,
npm WARN cleanup       code: 'EISDIR',
npm WARN cleanup       syscall: 'lstat',
npm WARN cleanup       path: '\\wsl.localhost\Ubuntu-22.04\home\jdoe\DevProjects\litenotes\node_modules\.bin\he'
npm WARN cleanup     }
npm WARN cleanup   ],
npm WARN cleanup   [
npm WARN cleanup     '\\wsl.localhost\Ubuntu-22.04\home\jdoe\DevProjects\litenotes\node_modules\.bin\autoprefixer',
npm WARN cleanup     [Error: EISDIR: illegal operation on a directory, lstat '\wsl.localhostUbuntu-22.04homejdoeDevProjectslitenotesnode_modules.binautoprefixer'] {
npm WARN cleanup       errno: -4068,
npm WARN cleanup       code: 'EISDIR',
npm WARN cleanup       syscall: 'lstat',
npm WARN cleanup       path: '\\wsl.localhost\Ubuntu-22.04\home\jdoe\DevProjects\litenotes\node_modules\.bin\autoprefixer'
npm WARN cleanup     }
npm WARN cleanup   ],
npm WARN cleanup   [
npm WARN cleanup     '\\wsl.localhost\Ubuntu-22.04\home\jdoe\DevProjects\litenotes\node_modules\tailwindcss',
npm WARN cleanup     [Error: EPERM: operation not permitted, rmdir '\wsl.localhostUbuntu-22.04homejdoeDevProjectslitenotesnode_modulestailwindcsslib'] {
npm WARN cleanup       errno: -4048,
npm WARN cleanup       code: 'EPERM',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: '\\wsl.localhost\Ubuntu-22.04\home\jdoe\DevProjects\litenotes\node_modules\tailwindcss\lib'
npm WARN cleanup     }
npm WARN cleanup   ]
npm WARN cleanup ]
npm ERR! code EISDIR
npm ERR! syscall lstat
npm ERR! path \wsl.localhostUbuntu-22.04homejdoeDevProjectslitenotesnode_modules.binautoprefixer
npm ERR! errno -4068
npm ERR! EISDIR: illegal operation on a directory, lstat '\wsl.localhostUbuntu-22.04homejdoeDevProjectslitenotesnode_modules.binautoprefixer'

npm ERR! A complete log of this run can be found in: C:UserspsalmAppDataLocalnpm-cache_logs2023-05-14T05_45_26_819Z-debug-0.log

This is my npm version:

jdoe@Grieg:~/DevProjects/litenotes$ npm -v
9.6.6

Also, I have checked the following sites but don’t have a solution yet:

Cannot find module '\wsl.localhostUbuntu-20.04mntcProgram Filesnodejsnode_modulesnpmbinnpm-cli.js'

NPM node_modules/.bin symlinks

Does anyone have any suggestions? TIA.

2

Answers


  1. Chosen as BEST ANSWER

    UPDATE:

    Gave up on wsl and ended up going with vagrant: https://www.vagrantup.com/

    Original answer:

    Ran these commands instead (see npm install errors on vagrant/homestead/windows: EPROTO: protocol error, symlink):

    $ sudo npm install --no-bin-links
    $ npm run dev
    

    Which should then open:

    enter image description here

    Then you should be able to connect to the mysql database using:

    enter image description here


  2. I have same problem. The problem is on nodejs installation.

    To install nodejs in WSL, do not use apt.
    Use following guidance from microsoft:

    https://learn.microsoft.com/en-us/windows/dev-environment/javascript/nodejs-on-wsl
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search