I am trying to install Laravel Elixir when I stumbled upon this site : https://www.laravel.com/docs/5.3/elixir. It is actually explained clearly on the site how to install Laravel Elixir.
It is can be done with the help of npm. But to ensure that we have already npm installed in our local workstation for those who can access their bash prompt, just do it by typing the following command :
root@hostname:/var/www/html# npm -v v3.5.2 root@hostname:/var/www/html#
Clearly that node is already installed in the local workstation. So, the next thing which is stated in the guidance on https://www.laravel.com/docs/5.3/elixir as the next step is to execute the following command :
npm install --global gulp-cli
But I suddenly faced the error below :
root@hostname:/var/www/html/laravel-electron$ npm install --global gulp-cli npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
Another error message corresponds with the execution of the command :
npm ERR! Linux 4.4.0-24-generic npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "--global" "gulp-cli" npm ERR! node v4.2.6 npm ERR! npm v3.5.2 npm ERR! path /usr/local/lib/node_modules npm ERR! code EACCES npm ERR! errno -13 npm ERR! syscall access npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules' npm ERR! at Error (native) npm ERR! { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'access', npm ERR! path: '/usr/local/lib/node_modules' } npm ERR! npm ERR! Please try running this command again as root/Administrator. npm ERR! Please include the following file with any support request: npm ERR! /var/www/html/laravel-electron/npm-debug.log
Clearly the culprit is the permission of the node_modules file exist in /usr/local/lib/node_modules although I have execute the command as root.
I shocked myself to find out that the permission of the file cannot be executed as root as follows :
root@hostname:/usr/local/lib# ls -al total 28 drwxr-xr-x 7 root root 4096 Jan 9 2016 . drwxr-xr-x 13 root root 4096 Jun 25 08:59 .. drwxr-xr-x 3 nobody root 4096 Okt 13 2015 node_modules ... root@hostname:/usr/local/lib#
I fixed the error as the solution as follows :
Change the permission of the node_modules directory by executing the following command on bash prompt :
root@soulreaper:/usr/local/lib# chown -Rv root.root node_modules/
And I re-execute the command as follows :
root@hostname:/var/www/html/laravel-electron# npm install --global gulp-cli npm ERR! Linux 4.4.0-24-generic npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "--global" "gulp-cli" npm ERR! node v4.2.6 npm ERR! npm v3.5.2 npm ERR! code ECONNRESET npm ERR! network tunneling socket could not be established, cause=write EPROTO npm ERR! network This is most likely not a problem with npm itself npm ERR! network and is related to network connectivity. npm ERR! network In most cases you are behind a proxy or have bad network settings. npm ERR! network npm ERR! network If you are behind a proxy, please make sure that the npm ERR! network 'proxy' config is set properly. See: 'npm help config' npm ERR! Please include the following file with any support request: npm ERR! /var/www/html/laravel-electron/npm-debug.log root@hostname:/var/www/html/laravel-electron#
Voila …. yes ! praise the lord ! I have no previous error shown. But err… another new error comes up. Well, I will came up with the solution of this error in another article.