When I setting up Laravel 5.6.7 on PHP 7.1.15 encountered error while the npm install. I think this is not laravel problem. But If this hasn’t soleved, can’t development vue.js. So, I will share a hint.

Environments:

[root@localhost nginx]# php -v
PHP 7.1.15 (cli) (built: Feb 28 2018 14:06:54) ( NTS )

[root@localhost app]# php artisan –version
Laravel Framework 5.6.7

[root@localhost app]# npm –version
5.6.0

[root@localhost app]# node –version
v8.9.4

This is a log when run “npm install”. As you can see, WARN happened forever…
“gyp WARN EACCES user “root” does not have permission to access the dev dir “/usr/share/nginx/app/node_modules/node-sass/.node-gyp/8.9.4”.

[root@localhost app]# npm install
npm WARN deprecated gulp-util@3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5

> node-sass@4.7.2 install /usr/share/nginx/app/node_modules/node-sass
> node scripts/install.js

Unable to save binary /usr/share/nginx/app/node_modules/node-sass/vendor/linux-x64-57 : { Error: EACCES: permission denied, mkdir '/usr/share/nginx/app/node_modules/node-sass/vendor'
    at Object.fs.mkdirSync (fs.js:885:18)
    at sync (/usr/share/nginx/app/node_modules/mkdirp/index.js:71:13)
    at Function.sync (/usr/share/nginx/app/node_modules/mkdirp/index.js:77:24)
    at checkAndDownloadBinary (/usr/share/nginx/app/node_modules/node-sass/scripts/install.js:111:11)
    at Object.<anonymous> (/usr/share/nginx/app/node_modules/node-sass/scripts/install.js:154:1)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
  errno: -13,
  code: 'EACCES',
  syscall: 'mkdir',
  path: '/usr/share/nginx/app/node_modules/node-sass/vendor' }

> uglifyjs-webpack-plugin@0.4.6 postinstall /usr/share/nginx/app/node_modules/we
bpack/node_modules/uglifyjs-webpack-plugin
> node lib/post_install.js


> node-sass@4.7.2 postinstall /usr/share/nginx/app/node_modules/node-sass
> node scripts/build.js

Building: /usr/bin/node /usr/share/nginx/app/node_modules/node-gyp/bin/node-gyp.
js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsa
ss_library=
gyp info it worked if it ends with ok
gyp verb cli [ '/usr/bin/node',
gyp verb cli   '/usr/share/nginx/app/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library=' ]
gyp info using node-gyp@3.6.2
gyp info using node@8.9.4 | linux | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` succeeded python2 /bin/python2
gyp verb check python version `/bin/python2 -c "import platform; print(platform.python_version());"` returned: "2.7.5\n"
gyp verb get node dir no --target version specified, falling back to host node version: 8.9.4
gyp verb command install [ '8.9.4' ]
gyp verb install input version string "8.9.4"
gyp verb install installing version: 8.9.4
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/8.9.4"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/share/nginx/app/node_modules/node-sass/.node-gyp"
gyp verb tmpdir == cwd automatically will remove dev files after to save disk space
gyp verb command install [ '8.9.4' ]
gyp verb install input version string "8.9.4"
gyp verb install installing version: 8.9.4
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 8.9.4
gyp verb ensuring nodedir is created /usr/share/nginx/app/node_modules/node-sass/.node-gyp/8.9.4
gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/share/nginx/app/node_modules/node-sass/.node-gyp/8.9.4"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/share/nginx/app/node_modules/node-sass/.node-gyp"
gyp verb tmpdir == cwd automatically will remove dev files after to save disk space
gyp verb command install [ '8.9.4' ]
gyp verb install input version string "8.9.4"
gyp verb install installing version: 8.9.4
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 8.9.4
gyp verb ensuring nodedir is created /usr/share/nginx/app/node_modules/node-sass/.node-gyp/8.9.4
gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/share/nginx/app/node_modules/node-sass/.node-gyp/8.9.4"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/share/nginx/app/node_modules/node-sass/.node-gyp"
gyp verb tmpdir == cwd automatically will remove dev files after to save disk space
.
.
.

After this happened, This time should be fine.

[root@localhost app]# rm -rf node_modules/
[root@localhost app]# npm install --unsafe-perm
[root@localhost app]# npm run dev
[root@localhost app]#

modify welcome.blade.php, see this page.

[root@localhost app]# vi resources/views/welcome.blade.php

@extends('layouts.app')

@section('content')
    <example-component></example-component>
@endsection

Check see if vue.js is running. go to http://192.168.33.10/

Hope this will help you 😗