【laravel笔记】npm install 执行错误 执行yarn install

homestead 环境下
执行 npm install 报错:

npm ERR! path /home/vagrant/code/laravel/node_modules/abbrev/package.json.1257227695
npm ERR! code ETXTBSY
npm ERR! errno -26
npm ERR! syscall rename
npm ERR! ETXTBSY: text file is busy, rename '/home/vagrant/code/laravel/node_modules/abbrev/package.json.1257227695' -> '/home/vagrant/code/laravel/node_modules/abbrev/package.json'

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

解决:
执行:yarn install

更坑的记录:

这是在台式机上成功了 ,同样win10系统在笔记本上运行同样的box,vagrant,vm一整套相同的环境竟然失败:

多番尝试: 升级yarn到最新版,
再次执行yarn install 错误:

error An unexpected error occurred: "EPROTO: protocol error, symlink '../acorn/bin/acorn' -> '/home/vagrant/code/test/node_modules/acorn-dynamic-import/node_modules/.bin/acorn'".

解决:
尝试 执行 yarn install --no-bin-links 顺利通过

但这时候 npm run dev 出现错误:

npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! @1.9.6 development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the @1.9.6 development script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:

解决:把package.json 中 cross-env 全部删除 ,再次运行命令,成功编译。

推荐阅读更多精彩内容