npm ERR! Linux 4.4.0-51-generic npm ERR! argv "/usr/bin/nodejs"
"/usr/bin/npm" "install" "--no-bin-links" npm ERR! node v6.9.2 npm
ERR! npm v4.0.5

npm ERR! Maximum call stack size exceeded npm ERR! npm ERR! If you
need help, you may report this error at: npm ERR!
https://github.com/npm/npm/issues

npm ERR! Please include the following file with any support request:
npm ERR! /home/vagrant/Code/sample/npm-debug.log

在网上找了一下解决方法,记录一下。
1.如果node.js版本不是最新的,可按照官网相关命令安装最新版本。
2.更新npm至最新版本

sudo npm -g install npm@latest

3.切换到项目目录下,执行以下命令

sudo npm cache clear
sudo npm install --force --no-bin-links

4.错误解决之后,在项目目录下执行gulp命令,可能会有以下错误提示

gulp

vagrant@homestead:~/Code/sample$ gulp [01:48:40] Using gulpfile
~/Code/sample/gulpfile.js [01:48:40] Starting 'default'... [01:48:40]
Starting 'sass'... [01:48:40] 'sass' errored after 142 ms [01:48:40]
Error: ENOENT: no such file or directory, scandir
'/home/vagrant/Code/sample/node_modules/node-sass/vendor'
at Error (native)
at Object.fs.readdirSync (fs.js:951:18)
at Object.getInstalledBinaries (/home/vagrant/Code/sample/node_modules/node-sass/lib/extensions.js:121:13)
at foundBinariesList (/home/vagrant/Code/sample/node_modules/node-sass/lib/errors.js:20:15)
at foundBinaries (/home/vagrant/Code/sample/node_modules/node-sass/lib/errors.js:15:5)
at Object.module.exports.missingBinary (/home/vagrant/Code/sample/node_modules/node-sass/lib/errors.js:45:5)
at module.exports (/home/vagrant/Code/sample/node_modules/node-sass/lib/binding.js:15:30)
at Object. (/home/vagrant/Code/sample/node_modules/node-sass/lib/index.js:14:35)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10) [01:48:40] Error in plugin 'run-sequence(sass)' Message:
ENOENT: no such file or directory, scandir '/home/vagrant/Code/sample/node_modules/node-sass/vendor' Details:
errno: -2
code: ENOENT
syscall: scandir
path: /home/vagrant/Code/sample/node_modules/node-sass/vendor Stack: Error: ENOENT: no such file or directory, scandir
'/home/vagrant/Code/sample/node_modules/node-sass/vendor'
at Error (native)
at Object.fs.readdirSync (fs.js:951:18)
at Object.getInstalledBinaries (/home/vagrant/Code/sample/node_modules/node-sass/lib/extensions.js:121:13)
at foundBinariesList (/home/vagrant/Code/sample/node_modules/node-sass/lib/errors.js:20:15)
at foundBinaries (/home/vagrant/Code/sample/node_modules/node-sass/lib/errors.js:15:5)
at Object.module.exports.missingBinary (/home/vagrant/Code/sample/node_modules/node-sass/lib/errors.js:45:5)
at module.exports (/home/vagrant/Code/sample/node_modules/node-sass/lib/binding.js:15:30)
at Object. (/home/vagrant/Code/sample/node_modules/node-sass/lib/index.js:14:35)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10) [01:48:40] Finished 'default' after 172 ms

5.此时需要rebuild node-sass

sudo npm rebuild node-sass --no-bin-links

此时一切恢复正常

vagrant@homestead:~/Code/sample$ gulp [02:11:24] Using gulpfile
~/Code/sample/gulpfile.js [02:11:24] Starting 'default'... [02:11:24]
Starting 'sass'...

Fetching Sass Source Files...

  • resources/assets/sass/app.scss

Saving To...

  • public/css/app.css

[02:11:42] Finished 'default' after 18 s [02:11:44] gulp-notify:
[Laravel Elixir] Sass Compiled! [02:11:44] Finished 'sass' after 20 s