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

后端 未结 9 2099
谎友^
谎友^ 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:41

    I struggled with this problem on my Windows 10 machine with Homestead a lot of. And After a lot of effort I solved it with that way;

    delete your node_modules folder.

    You run this commands on your windows terminal:

    npm install --no-bin-links (After some experience it is necessary for virtual machines)
    npm rebuild --no-bin links
    

    Generally it works after these commands, but if you have take this error

    "Node Sass could not find a binding for your current environment:"

    please run this command on your Homestead Terminal for installing node Sass for Linux.

    npm rebuild node-sass
    

    if it is not work, try use yarn. Delete node modules folder package.json.lock and yarn.lock (if there) files and type

    yarn install
    

    If all of them is not save you, use all npm commands out of the virtual machine. It will be work.

    I hope this helps you...

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

    i had to delete the node_modules folder first, then i did

    sudo chmod a+x .
    

    for making sure i got the privilege to do anything on the machine, then i

    sudo npm install --no-bin-links
    

    no bin links is required in vagrant from my experience because these VM don't support bin links (correct me if im wrong). Then i just

    sudo npm run dev
    

    at this point some people might encounter no cross-env found error. In that case, just delete cross-env in package.json file and run it again. It worked for me but some people still encounter the same problem. Might worth to give it a shot.

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

    I was still getting an error, even after doing following

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

    as suggested by Babak Bandpey

    It turned out that there was another annoying problem of file path character limit. This happens quite often if you are using a node module with long name. You can easily solve this by following these steps after vagrant ssh into linux vm:

    1. Create ‘node_modules’ folder in your home folder mkdir ~/node_modules

    2. Add symbolic link to the ‘node_modules’ folder you just created inside your project folder

      ln -sf ~/node_modules /vagrant/your-project-folder

    This solution will ensure that all the node modules are stored inside home directory instead of synced folder. Original source : https://blog.rudylee.com/2014/10/27/symbolic-links-with-vagrant-windows/

    Hope it helps somone having similar issue, thanks!

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

    Downgraing the npm version to 5.7.1 did the trick for me.

    Command used to downgrade: npm install -g npm@5.7.1

    I am using Win10, Vagrant, Ubuntu v14.04 and Node v8.11.4

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

    I had problem with "npm install" too, I use Windows 10. Finally I got it fixed, what I did is that I exited from "vagrant ssh" and run "vagrant box update", then "npm install" worked. Notice that I ran "vagrant box update" and "npm install" out of "vagrant ssh". Hope it helps.

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

    The same thing happened to me

    My environment is linux

    fsevents is a module dedicated to mac

    Please try the following command

    npm install --no-optional

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