Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel, elixir and gulp

I've gulpfile.js with content

var gulp = require('gulp');//this is working
gulp.task('default', function() { });//this is working
var elixir = require('laravel-elixir');//this is NOT working

Running "gulp" in cmd I get a message:

C:\myaccount\workspace\todoparrot>gulp
module.js:338
    throw err;
    ^
Error: Cannot find module 'lodash._baseclone'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:286:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (C:\myaccount\workspace\todoparrot\node_modules\laravel-elixir\node_modules\gulp-notify\node_modules\node-notifier\node_modules\lodash.clonedeep\index.js:9:17)
    at Module._compile (module.js:434:26)
    at Object.Module._extensions..js (module.js:452:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)

command gulp is working, but how to set the elixir to work, that gulp is working on it. What is laravel/elixir proper version for writing to file composer.js require {..,"laravel/elixir":"???????",..}. Is it "laravel/elixir" or "laravel-elixir". I'm unable to find sufficient good instructions.

like image 905
user2301515 Avatar asked Oct 10 '15 08:10

user2301515


People also ask

What is elixir in laravel?

Laravel Elixir provides a clean, fluent API for defining basic Gulp tasks for your Laravel application. Elixir supports several common CSS and JavaScript pre-processors, and even testing tools. Using method chaining, Elixir allows you to fluently define your asset pipeline.

What is Gulp in laravel?

Gulp is a javascript task runner, it keeps things simple and makes the complex task manageable. Here I am gonna show you how easy it is to use Gulp with Laravel's Elixir to combine and minify application CSS and JavaScript files.

Can I use node js with laravel?

Installing Node js is installed on your machine. By default, Laravel Homestead includes everything you need; however, if you aren't using Vagrant, then you can easily install Node by visiting their download page. Don't worry, it's quick and easy!


1 Answers

Sometimes npm install fails to install packages due to your machine ram spec or services runing in server , try installing bit by bit the laravel-elixir package dependency in your package.json file then finish by adding the elixir package at the bottom of the file as in below :

{
  "private": true,
  "devDependencies": {
  "gulp": "^3.8.8"
   },
"dependencies": {
"babelify": "^7.2.0",
"browser-sync": "^2.7.10",
"browserify": "^11.2.0",
"del": "^1.2.0",
"glob": "^5.0.14",
"gulp-autoprefixer": "^2.3.1",
"gulp-babel": "^6.1.0",
"babel-preset-es2015": "^6.1.0",
"babel-preset-react": "^6.1.18",
"gulp-batch": "^1.0.5",
"gulp-coffee": "^2.3.1",
"gulp-concat": "^2.6.0",
"gulp-if": "^1.2.5",
"gulp-less": "^3.0.3"
  }
}

ADD ALL DEPENDENCIES BIT BY BIT AS IN THIS FILE https://github.com/laravel/elixir/blob/master/package.json ONCE ALL DEPENCIES HAVE INSTALLED ADD

 "laravel-elixir": "^4.0.0" 

AT THE BOTTOM AND RUN npm install , this should install elixir and all dependencies

like image 60
Jimmy Obonyo Abor Avatar answered Sep 22 '22 03:09

Jimmy Obonyo Abor