Laravel Elixir Module Installation

Posted on

To be able to install Electron, Laravel Elixir is needed to be installed. This is where I am getting stuck while executing Electron application.

After getting Electron installed properly on the workstation, it need to be tested by executing the following command :

./node_modules/.bin/electron

Below is the real output of the command execution on bash prompt :

usernamei@hostname:/var/www/html/laravel-electron$ ./node_modules/.bin/electron .
App threw an error during load
Error: Cannot find module 'laravel-elixir'
at Module._resolveFilename (module.js:440:15)
at Function.Module._resolveFilename (/var/www/html/laravel-electron/node_modules/electron-prebuilt/dist/resources/electron.asar/common/reset-search-paths.js:35:12)
at Function.Module._load (module.js:388:25)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/var/www/html/laravel-electron/gulpfile.js:1:93)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
A JavaScript error occurred in the main process
Uncaught Exception:
Error: Cannot find module 'laravel-elixir'
at Module._resolveFilename (module.js:440:15)
at Function.Module._resolveFilename (/var/www/html/laravel-electron/node_modules/electron-prebuilt/dist/resources/electron.asar/common/reset-search-paths.js:35:12)
at Function.Module._load (module.js:388:25)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/var/www/html/laravel-electron/gulpfile.js:1:93)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
^C
username@hostname:/var/www/html/laravel-electron$ 

So, in order for executing Electron apps, laravel-elixir module need to be installed based on the error shown above : “Error: Cannot find module ‘laravel-elixir’”. Below is the step which is needed to be done to install module Laravel Elixir :

  1. Execute the following command :
npm install --global gulp-cli

The command execution can be found in the following output :

username@hostname:/var/www/html/laravel-electron$ npm install --global gulp-cli
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
/usr/local/lib
└─┬ [email protected]
├── [email protected]
├─┬ [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected]
│ ├── [email protected]
│ └── [email protected]
├─┬ [email protected]
│ └── [email protected]
├─┬ [email protected]
│ └─┬ [email protected]
│ └── [email protected]
├── [email protected]
├─┬ [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]
│ │ ├── [email protected]
│ │ └─┬ [email protected]
│ │ └─┬ [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├── [email protected]
│ │ │ ├─┬ [email protected]
│ │ │ │ └── [email protected]
│ │ │ └─┬ [email protected]
│ │ │ └── [email protected]
│ │ └── [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ └─┬ [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├─┬ [email protected]
│ │ │ │ └─┬ [email protected]
│ │ │ │ └── [email protected]
│ │ │ └── [email protected]
│ │ ├── [email protected]
│ │ └─┬ [email protected]
│ │ └── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ └── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ └─┬ [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]
│ │ ├── [email protected]
│ │ ├─┬ [email protected]
│ │ │ └─┬ [email protected]
│ │ │ ├── [email protected]
│ │ │ └── [email protected]
│ │ ├── [email protected]
│ │ └── [email protected]
│ ├─┬ [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]
│ │ ├── [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├─┬ [email protected]
│ │ │ │ └─┬ [email protected]
│ │ │ │ ├── [email protected]
│ │ │ │ ├─┬ [email protected]
│ │ │ │ │ └── [email protected]
│ │ │ │ ├── [email protected]
│ │ │ │ └── [email protected]
│ │ │ ├── [email protected]
│ │ │ └── [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]
│ │ ├── [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├─┬ [email protected]
│ │ │ │ └── [email protected]
│ │ │ └── [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├─┬ [email protected]
│ │ │ │ └── [email protected]
│ │ │ └── [email protected]
│ │ └─┬ [email protected]
│ │ ├── [email protected]
│ │ └── [email protected]
│ └── [email protected]
├── [email protected]
├── [email protected]
├─┬ [email protected]
│ ├── [email protected]
│ └── [email protected]
├─┬ [email protected]
│ └── [email protected]
├─┬ [email protected]
│ └── [email protected]
├─┬ [email protected]
│ ├── [email protected]
│ └── [email protected]
└─┬ [email protected]
├── [email protected]
├─┬ [email protected]
│ └── [email protected]
├── [email protected]
├─┬ [email protected]
│ └─┬ [email protected]
│ └── [email protected]
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected]
│ └── [email protected]
├── [email protected]
└── [email protected]
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
username@hostname:/var/www/html/laravel-electron$

2. I got stuck again when the execution command need to modify ‘/usr/local/lib/node_modules’ generating a permission denied error. So, I have to check the permission on /usr/local/lib/node__modules. Turns out that even I have a root access, the permission of the folder wouldn’t let even ‘root’ to modify it. Below is the permission detail of the folder :

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 Oct 13  2015 node_modules
...
root@hostname:/usr/local/lib#
  1. I have to modify the permission on the folder because it really freaks me out that the folder actually owned by ‘nobody’. So, I have to execute the following command :
chown -Rv root.root /usr/local/lib/node_modules

4. After succesfully altering the permission on the folder and also the files and the folder within. I continue on the installation process by installing another component which is shown in the following command execution :

npm install -no-bin-links
username@hostname:/var/www/html/laravel-electron$ npm install -no-bin-links
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.
npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated [email protected]: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm ERR! fetch failed https://registry.npmjs.org/d/-/d-0.1.1.tgz
npm WARN retry will retry, error on last attempt: Error: tunneling socket could not be established, cause=Parse Error
npm ERR! fetch failed https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.12.tgz
npm WARN retry will retry, error on last attempt: Error: tunneling socket could not be established, cause=Parse Error
npm ERR! fetch failed https://registry.npmjs.org/d/-/d-0.1.1.tgz
npm WARN retry will retry, error on last attempt: Error: tunneling socket could not be established, cause=Parse Error
npm ERR! fetch failed https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.12.tgz
npm WARN retry will retry, error on last attempt: Error: tunneling socket could not be established, cause=Parse Error
npm ERR! Linux 4.4.0-24-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-no-bin-links"
npm ERR! node v4.2.6
npm ERR! npm v3.5.2
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! /var/www/html/laravel-electron/npm-debug.log
username@hostname:/var/www/html/laravel-electron$ npm install -no-bin-links
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]
npm WARN optional Skipping failed optional dependency /gulp-watch/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]
username@hostname:/var/www/html/laravel-electron$

Since the workstation used to install Laravel Elixir module is Linux based distribution and the reference from http://https://www.laravel.com/docs/5.3/elixir stated that the following command :

npm install -no-bin-links

That command is just for Windows or VM Server Workstation so it doesn’t really matter if it is failed.

5. In order to prove Laravel Elixir module has already been installed and can be used, we can just execute the following command :

gulp

Real output display of command execution :

username@hostname:/var/www/html/laravel-electron$ gulp
[15:00:40] Using gulpfile /var/www/html/laravel-electron/gulpfile.js
[15:00:40] Starting 'default'...
[15:00:40] Starting 'sass'...
[15:00:41] 'sass' errored after 66 ms
[15:00:41] Error: ENOENT: no such file or directory, scandir '/var/www/html/laravel-electron/node_modules/node-sass/vend
or'
at Error (native)
at Object.fs.readdirSync (fs.js:808:18)
at Object.getInstalledBinaries (/var/www/html/laravel-electron/node_modules/node-sass/lib/extensions.js:119:13)
at foundBinariesList (/var/www/html/laravel-electron/node_modules/node-sass/lib/errors.js:20:15)
at foundBinaries (/var/www/html/laravel-electron/node_modules/node-sass/lib/errors.js:15:5)
at Object.module.exports.missingBinary (/var/www/html/laravel-electron/node_modules/node-sass/lib/errors.js:45:5)
at Object.<anonymous> (/var/www/html/laravel-electron/node_modules/node-sass/lib/index.js:15:28)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
[15:00:41] Error in plugin 'run-sequence(sass)'
Message:
ENOENT: no such file or directory, scandir '/var/www/html/laravel-electron/node_modules/node-sass/vendor'
Details:
errno: -2
code: ENOENT
syscall: scandir
path: /var/www/html/laravel-electron/node_modules/node-sass/vendor
Stack:
Error: ENOENT: no such file or directory, scandir '/var/www/html/laravel-electron/node_modules/node-sass/vendor'
at Error (native)
at Object.fs.readdirSync (fs.js:808:18)
at Object.getInstalledBinaries (/var/www/html/laravel-electron/node_modules/node-sass/lib/extensions.js:119:13)
at foundBinariesList (/var/www/html/laravel-electron/node_modules/node-sass/lib/errors.js:20:15)
at foundBinaries (/var/www/html/laravel-electron/node_modules/node-sass/lib/errors.js:15:5)
at Object.module.exports.missingBinary (/var/www/html/laravel-electron/node_modules/node-sass/lib/errors.js:45:5)
at Object.<anonymous> (/var/www/html/laravel-electron/node_modules/node-sass/lib/index.js:15:28)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
[15:00:41] Finished 'default' after 76 ms

Another command which can be executed :

gulp --production

Real life output of command executed in bash prompt :

username@hostname:/var/www/html/laravel-electron$ gulp --production
[15:00:53] Using gulpfile /var/www/html/laravel-electron/gulpfile.js
[15:00:53] Starting 'default'...
[15:00:53] Starting 'sass'...
[15:00:53] 'sass' errored after 46 ms
[15:00:53] Error: ENOENT: no such file or directory, scandir '/var/www/html/laravel-electron/node_modules/node-sass/vend
or'
at Error (native)
at Object.fs.readdirSync (fs.js:808:18)
at Object.getInstalledBinaries (/var/www/html/laravel-electron/node_modules/node-sass/lib/extensions.js:119:13)
at foundBinariesList (/var/www/html/laravel-electron/node_modules/node-sass/lib/errors.js:20:15)
at foundBinaries (/var/www/html/laravel-electron/node_modules/node-sass/lib/errors.js:15:5)
at Object.module.exports.missingBinary (/var/www/html/laravel-electron/node_modules/node-sass/lib/errors.js:45:5)
at Object.<anonymous> (/var/www/html/laravel-electron/node_modules/node-sass/lib/index.js:15:28)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
[15:00:53] Error in plugin 'run-sequence(sass)'
Message:
ENOENT: no such file or directory, scandir '/var/www/html/laravel-electron/node_modules/node-sass/vendor'
Details:
errno: -2
code: ENOENT
syscall: scandir
path: /var/www/html/laravel-electron/node_modules/node-sass/vendor
Stack:
Error: ENOENT: no such file or directory, scandir '/var/www/html/laravel-electron/node_modules/node-sass/vendor'
at Error (native)
at Object.fs.readdirSync (fs.js:808:18)
at Object.getInstalledBinaries (/var/www/html/laravel-electron/node_modules/node-sass/lib/extensions.js:119:13)
at foundBinariesList (/var/www/html/laravel-electron/node_modules/node-sass/lib/errors.js:20:15)
at foundBinaries (/var/www/html/laravel-electron/node_modules/node-sass/lib/errors.js:15:5)
at Object.module.exports.missingBinary (/var/www/html/laravel-electron/node_modules/node-sass/lib/errors.js:45:5)
at Object.<anonymous> (/var/www/html/laravel-electron/node_modules/node-sass/lib/index.js:15:28)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
[15:00:53] Finished 'default' after 58 ms
username@hostname:/var/www/html/laravel-electron$

6. For me, to prove whether Laravel Elixir module has already been properly installed or not is by executing Electron. Read about the installation of Electron in this site.

Leave a Reply