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
└─┬ gulp-cli@1.2.2
├── archy@1.0.0
├─┬ chalk@1.1.3
│ ├── ansi-styles@2.2.1
│ ├── escape-string-regexp@1.0.5
│ ├─┬ has-ansi@2.0.0
│ │ └── ansi-regex@2.0.0
│ ├── strip-ansi@3.0.1
│ └── supports-color@2.0.0
├─┬ fancy-log@1.2.0
│ └── time-stamp@1.0.1
├─┬ gulplog@1.0.0
│ └─┬ glogg@1.0.0
│ └── sparkles@1.0.0
├── interpret@1.0.1
├─┬ liftoff@2.3.0
│ ├── extend@3.0.0
│ ├─┬ findup-sync@0.4.2
│ │ ├─┬ detect-file@0.1.0
│ │ │ └── fs-exists-sync@0.1.0
│ │ ├── is-glob@2.0.1
│ │ └─┬ resolve-dir@0.1.1
│ │ └─┬ global-modules@0.2.3
│ │ ├─┬ global-prefix@0.1.4
│ │ │ ├── ini@1.3.4
│ │ │ ├─┬ osenv@0.1.3
│ │ │ │ └── os-tmpdir@1.0.1
│ │ │ └─┬ which@1.2.10
│ │ │ └── isexe@1.1.2
│ │ └── is-windows@0.2.0
│ ├─┬ fined@1.0.1
│ │ ├── expand-tilde@1.2.2
│ │ ├── lodash.assignwith@4.2.0
│ │ ├── lodash.isarray@4.0.0
│ │ ├── lodash.isempty@4.4.0
│ │ ├── lodash.pick@4.4.0
│ │ └─┬ parse-filepath@1.0.1
│ │ ├─┬ is-absolute@0.2.5
│ │ │ ├─┬ is-relative@0.2.1
│ │ │ │ └─┬ is-unc-path@0.1.1
│ │ │ │ └── unc-path-regex@0.1.2
│ │ │ └── is-windows@0.1.1
│ │ ├── map-cache@0.2.2
│ │ └─┬ path-root@0.1.1
│ │ └── path-root-regex@0.1.2
│ ├── flagged-respawn@0.3.2
│ ├── lodash.mapvalues@4.6.0
│ ├── rechoir@0.6.2
│ └── resolve@1.1.7
├── lodash.isfunction@3.0.8
├── lodash.isplainobject@4.0.6
├── lodash.isstring@4.0.1
├── lodash.sortby@4.7.0
├─┬ matchdep@1.0.1
│ ├─┬ findup-sync@0.3.0
│ │ └─┬ glob@5.0.15
│ │ ├─┬ inflight@1.0.5
│ │ │ └── wrappy@1.0.2
│ │ ├── inherits@2.0.1
│ │ ├─┬ minimatch@3.0.3
│ │ │ └─┬ brace-expansion@1.1.6
│ │ │ ├── balanced-match@0.4.2
│ │ │ └── concat-map@0.0.1
│ │ ├── once@1.3.3
│ │ └── path-is-absolute@1.0.0
│ ├─┬ micromatch@2.3.11
│ │ ├─┬ arr-diff@2.0.0
│ │ │ └── arr-flatten@1.0.1
│ │ ├── array-unique@0.2.1
│ │ ├─┬ braces@1.8.5
│ │ │ ├─┬ expand-range@1.8.2
│ │ │ │ └─┬ fill-range@2.2.3
│ │ │ │ ├── is-number@2.1.0
│ │ │ │ ├─┬ isobject@2.1.0
│ │ │ │ │ └── isarray@1.0.0
│ │ │ │ ├── randomatic@1.1.5
│ │ │ │ └── repeat-string@1.5.4
│ │ │ ├── preserve@0.2.0
│ │ │ └── repeat-element@1.1.2
│ │ ├─┬ expand-brackets@0.1.5
│ │ │ └── is-posix-bracket@0.1.1
│ │ ├── extglob@0.3.2
│ │ ├── filename-regex@2.0.0
│ │ ├── is-extglob@1.0.0
│ │ ├─┬ kind-of@3.0.4
│ │ │ └── is-buffer@1.1.4
│ │ ├── normalize-path@2.0.1
│ │ ├─┬ object.omit@2.0.0
│ │ │ ├─┬ for-own@0.1.4
│ │ │ │ └── for-in@0.1.5
│ │ │ └── is-extendable@0.1.1
│ │ ├─┬ parse-glob@3.0.4
│ │ │ ├─┬ glob-base@0.3.0
│ │ │ │ └── glob-parent@2.0.0
│ │ │ └── is-dotfile@1.0.2
│ │ └─┬ regex-cache@0.4.3
│ │ ├── is-equal-shallow@0.1.3
│ │ └── is-primitive@2.0.0
│ └── stack-trace@0.0.9
├── mute-stdout@1.0.0
├── pretty-hrtime@1.0.2
├─┬ semver-greatest-satisfied-range@1.0.0
│ ├── semver@4.3.6
│ └── semver-regex@1.0.0
├─┬ tildify@1.2.0
│ └── os-homedir@1.0.1
├─┬ v8flags@2.0.11
│ └── user-home@1.1.1
├─┬ wreck@6.3.0
│ ├── boom@2.10.1
│ └── hoek@2.16.3
└─┬ yargs@3.32.0
├── camelcase@2.1.1
├─┬ cliui@3.2.0
│ └── wrap-ansi@2.0.0
├── decamelize@1.2.0
├─┬ os-locale@1.4.0
│ └─┬ lcid@1.0.0
│ └── invert-kv@1.0.0
├─┬ string-width@1.0.2
│ ├─┬ code-point-at@1.0.0
│ │ └── number-is-nan@1.0.0
│ └── is-fullwidth-code-point@1.0.0
├── window-size@0.1.4
└── y18n@3.2.1

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 minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated lodash@1.0.2: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.
npm WARN deprecated graceful-fs@1.2.3: 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 tough-cookie@2.2.2: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
npm WARN deprecated minimatch@1.0.0: 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: fsevents@1.0.14
npm WARN optional Skipping failed optional dependency /gulp-watch/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.14
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