error “ETXTBSY: text file is busy” on npm install

后端 未结 9 2100
谎友^
谎友^ 2020-12-09 08:16

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

npm ERR! ETXTBSY: text file is b         


        
相关标签:
9条回答
  • 2020-12-09 08:52

    Just issue "npm install" in Windows instead of in Homestead. Of course, you need to have npm for windows installed to do that.

    0 讨论(0)
  • 2020-12-09 08:56

    I also struggle finding a solution for this but here it is.

    1. Make sure to update node to latest version

    To update, you can install n

    sudo npm install -g n
    

    Then just :

    sudo n latest
    
    1. Set Node scripts to use environment variables across platforms

    In vagrant run :

    npm install --save-dev cross-env
    npm install 
    npm run dev 
    

    That did the trick , although i spent an entire day finding the right solution (https://www.npmjs.com/package/cross-env)

    0 讨论(0)
  • 2020-12-09 08:58

    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

    0 讨论(0)
提交回复
热议问题