处理这个问题两天就赢了。
我全新安装Windows 10
主机,运行最新版本的Vagrant
,laravel/homestead (Ubuntu 18.04 LTS box, v 6.0.0)
,Virtualbox
,laravel
,git for windows
,node.js for windows
。
vagrant
,git
,virtualbox
设置为在windows
中以管理员身份运行。
我创建一个名为博客的Laravel
项目,如下所示:
vagrant@homestead:~/src$ composer create-project --prefer-dist laravel/laravel blog
全部创建好。然后我尝试像这样安装npm
:
vagrant@homestead:~/src/blog$ npm install -g npm@latest
我得到了:
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
但是当我检查vagrant
用户权限时:
vagrant@homestead:~/src/blog$ groups
vagrant adm cdrom sudo dip www-data plugdev lxd lpadmin sambashare
所以我用npm
消息不推荐解决这个问题:
vagrant@homestead:~/src/blog$ sudo npm install -g npm@latest
我现在去安装一个npm
包,例如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
我尝试sudo安装包,结果相同
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
结果是highchatrts
中的node_modules
文件夹,其中只包含packaje.json.1984492036
个文件。
我似乎无法找到解决方法。使用--no-bin-links
会出现同样的错误。
感谢任何帮助。
答案 0 :(得分:0)
两天前我遇到同样的问题,尝试运行sudo npm install --unsafe-perm
,撤消您先做的任何更改,因为我不知道代客是如何工作的(悲伤的Linux用户)
答案 1 :(得分:0)
我通过从fit
主机操作系统运行npm install
而不是从git
vm运行来完成所有工作。不是我想要的,但我向前迈进,学会了一些东西,并且更接近疯狂......