6

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.

Patrick Oscity
  • 53,604
  • 17
  • 144
  • 168
user2301515
  • 4,903
  • 6
  • 30
  • 46

3 Answers3

5

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

Jimmy Obonyo Abor
  • 7,335
  • 10
  • 43
  • 71
4

Try running "npm install" first to install dependencies.

Tim Sheehan
  • 3,994
  • 1
  • 15
  • 18
  • I've tried several times npm install and other tricks. Can you give a proper sequence from installing to running. – user2301515 Oct 10 '15 at 08:53
  • Here's a copy of the package.json file I've got from a fresh install of Laravel 5.1, I basically just followed the steps in the documentation and had zero issues - http://pastie.org/10471807 – Tim Sheehan Oct 10 '15 at 08:59
  • Try removing npm completely and installing it locally instead of globally within your project, then going through the same process. It seems some people have had issues with this on Windows specifically. https://github.com/laravel/elixir/issues/266 – Tim Sheehan Oct 10 '15 at 09:02
  • Unfortunately I'm unable to get help from this deficient information and i need perfectly written tutorial for elixir using. Thank you for this help and i decided not to use the commonly nonworking elixir anymore. I make own script somewhere controller. – user2301515 Oct 10 '15 at 11:24
  • None of that makes any sense but sure, off you go then. – Tim Sheehan Oct 11 '15 at 02:48
  • `npm install` reports some dependency errors in my case on Win 7. NodeJs is just installed on clean machine. – Vladimir Vukanac Oct 23 '15 at 09:05
  • Check do you have errors `npm-gly` when `npm install`. Possible cause node is in version v.xxx **-pre** or missing python, or try to run from git bash as admin. – Vladimir Vukanac Oct 23 '15 at 10:02
0

if you read the error message properly it implies that in laravels bid to contact a file in the node-module/ path it encountered an error best solution is to locate such a file and make adjustment to all references made to its "name". I encountered the same issuse when try to run larvel-elixir, problem came out to be "laravel-elix/" was referenced wrongly in my gulfile.js. Relax and try again