Laravel, elixir and gulp

user2301515 picture user2301515 · Oct 10, 2015 · Viewed 9k times · Source

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.

Answer

Jimmy Obonyo Abor picture Jimmy Obonyo Abor · Dec 1, 2015

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