1

Two days dealing with this issue and it is winning.

I have a fresh install of Windows 10 host, running the latest versions of Vagrant, laravel/homestead (Ubuntu 18.04 LTS box, v 6.0.0), Virtualbox, laravel, git for windows, node.js for windows.

vagrant, git, virtualbox are set to run as administrator in windows.

I create a Laravel project called blog like this:

vagrant@homestead:~/src$ composer create-project --prefer-dist laravel/laravel blog

All creates OK. I then try and install npm like this:

vagrant@homestead:~/src/blog$ npm install -g npm@latest

And I get:

npm WARN checkPermissions Missing write access to /usr/lib/node_modules/npm
npm WARN checkPermissions Missing write access to /usr/lib/node_modules
npm ERR! path /usr/lib/node_modules/npm
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/lib/node_modules/npm'
npm ERR!  { Error: EACCES: permission denied, access '/usr/lib/node_modules/npm'
npm ERR!   stack: 'Error: EACCES: permission denied, access \'/usr/lib/node_modules/npm\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/lib/node_modules/npm' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/vagrant/.npm/_logs/2018-05-05T00_57_41_110Z-debug.log

But when i check vagrant user permissions:

vagrant@homestead:~/src/blog$ groups
vagrant adm cdrom sudo dip www-data plugdev lxd lpadmin sambashare

So I solve this with the not recommended by npm message:

vagrant@homestead:~/src/blog$ sudo npm install -g npm@latest

I now go and install an npm package like highcharts:

vagrant@homestead:~/src/blog$ npm install --save highcharts
npm WARN rollback Rolling back highcharts@6.1.0 failed (this is probably harmless): ETXTBSY: text file is busy, unlink '/home/vagrant/src/blog/node_modules/highcharts/package.json.2262439515'
npm ERR! path /home/vagrant/src/blog/node_modules/highcharts/package.json.2262439515
npm ERR! code ETXTBSY
npm ERR! errno -26
npm ERR! syscall rename
npm ERR! ETXTBSY: text file is busy, rename '/home/vagrant/src/blog/node_modules/highcharts/package.json.2262439515' -> '/home/vagrant/src/blog/node_modules/highcharts/package.json'

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/vagrant/.npm/_logs/2018-05-05T01_10_24_241Z-debug.log

I try sudo to install package, same result

vagrant@homestead:~/src/blog$ sudo npm install --save --no-bin-links highcharts 
npm WARN rollback Rolling back highcharts@6.1.0 failed (this is probably harmless): ETXTBSY: text file is busy, unlink '/home/vagrant/src/blog/node_modules/highcharts/package.json.1984492036'
npm ERR! path /home/vagrant/src/blog/node_modules/highcharts/package.json.1984492036
npm ERR! code ETXTBSY
npm ERR! errno -26
npm ERR! syscall rename
npm ERR! ETXTBSY: text file is busy, rename '/home/vagrant/src/blog/node_modules/highcharts/package.json.1984492036' -> '/home/vagrant/src/blog/node_modules/highcharts/package.json'

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/vagrant/.npm/_logs/2018-05-05T01_58_13_140Z-debug.log

The result is a highchatrts folder in node_modules with only the packaje.json.1984492036 file in it.

I cannot seem to find a way around this. Using --no-bin-links gives the same error.

Any help is appreciated.

TheRealPapa
  • 4,393
  • 8
  • 71
  • 155

2 Answers2

1

I got it all working by running npm install from the git host os, not from the ubuntu vm. Not what I wanted but I move forward and have learned something and creeped closer to insanity...

TheRealPapa
  • 4,393
  • 8
  • 71
  • 155
0

I had this same issue two days ago, try running sudo npm install --unsafe-perm , undo any changes you made first though, cause i don't know how valet works (sad Linux user)

mohdule
  • 528
  • 7
  • 16
  • Thanks for the suggestion. I just tried `sudo npm install --unsafe-perm highcharts` and same result, exactly the same. – TheRealPapa May 05 '18 at 02:07
  • np, you are welcome, sorry i was not clear, i meant running the command with --unsafe-perm to install npm itself, but apparently you've solved that issue already hmmmm.. have you tried doing what the message says (renaming the package.json), better yet removing the whole node_modules folder – mohdule May 05 '18 at 02:58
  • I have. The puzzling thing is this is all FRESH. so when I do `npm install` per `Laravel` installation instructions the folder structure is created and for each packages, I get empty folders with the `package.json.123124321` file in each. npm runs by `vagrant` user and it seems it has no rights to rename this file. Yet it can create folders. `composer` is also used by `vagrant` and it has no problems creating project. #beaten – TheRealPapa May 05 '18 at 03:18