javascriptnode.jslaravelnpmhomestead

error "ETXTBSY: text file is busy" on npm install


When running npm install [any package] or even npm install on homestead I get the following error:

npm ERR! ETXTBSY: text file is busy, rmdir '/home/vagrant/valemus-shop-starter/valemus-shop/node_modules/fsevents'

Debug log can be seen here

I tried removing the fsevents directory, however, it doesn't exist.

How do I fix this?


Solution

  • I ran into the same thing on Windows 10 + VirtualBox (VBox) + Vagrant + Laravel Homestead when I wanted to change to react frontend.

    And after much search and trial and error, this solution worked for me, maybe it works for you as well.

    Halted the vagrant:

    vagrant halt
    

    Added the following into the configure section of the Vagrantfile in the Homestead dir

      config.vm.provider "virtualbox" do |v|
            v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]
      end
    

    started the cmd as admin

    then vagrant up

    and vagrant ssh

    cd to development dir

    then removed the node_modules dir by rm -rf node_modules/ if any

    and then ran the sudo npm install && npm run dev

    and the whole thing was installed without any warnings or errors.

    This is the result of two hours reading :)

    Edit:

    If your problem is not solved and you have the mentioned setup you can use another solution:

    Install the Node on your windows machine too

    Then cd to your development directory and run the npm install from the Windows and the you'll have the same result.

    You can also initiate the npm run watch from a windows cmd afterwards.

    This helped me to lift the load from the VM and let the Windows do the watch and receive the notifications of the npm run watch in Windows.

    Cheers