I am using Homestead on Windows 10 and suddenly as I added a package ran into an issue of npm being broken, for lack of a better word.
There is some kind of problem with node-sass (included with laravel-mix), but I am not sure what. The error is:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.7.2 install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.7.2 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
This is preceeded by:
node-sass@4.7.2 install /home/vagrant/code/homestead/node_modules/node-sass
node scripts/install.js
fs.js:646
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: EINVAL: invalid argument, open '/home/vagrant/code/homestead/node_modules/node-sass/package.json'
at Object.fs.openSync (fs.js:646:18)
at Object.fs.readFileSync (fs.js:551:33)
at Object.Module._extensions..json (module.js:669:20)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/vagrant/code/homestead/node_modules/node-sass/lib/extensions.js:7:9)
at Module._compile (module.js:652:30)
I have tried deleting node_modules folder to build it from scratch. It also runs into a symlink error, so I am running npm install with the --no-bin-links option
I am not sure what else to do. I have found nothing on Google so far to help me.
This is a snippet from the logs:
1975 verbose lifecycle node-sass@4.7.2~install: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/vagrant/code/homestead/node_modules/node-sass/node_modules/.bin:/home/vagrant/code/homestead/node_modules/.bin:/home/vagrant/.composer/vendor/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
1976 verbose lifecycle node-sass@4.7.2~install: CWD: /home/vagrant/code/homestead/node_modules/node-sass
1977 silly lifecycle node-sass@4.7.2~install: Args: [ '-c', 'node scripts/install.js' ]
1978 silly lifecycle node-sass@4.7.2~install: Returned: code: 1 signal: null
1979 info lifecycle node-sass@4.7.2~install: Failed to exec install script
To add: I have also cleared npm cache (verified and even force cleared), provisioned Homestead several times. This is also actually a new box since the last one refused to come up so I replaced it completely. One of the more recent commands I ran was:
npm audit fix
Could that have broken it? I ran the install on my Windows host on the same folder and it worked without issues. After that it seems the install also works on Homestead. There are a lot of rollbacks but no specific errors anymore. I am still however at a loss as to what went wrong. I should not have to use a Windows machine to correct Linux mistakes.
And to edit again: while running install no longer introduced any errors, I still cannot run it. It doesn't run on Homestead/Linux nor on Windows. So I am still stuck.