Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Webinsane's avatar

Use gulp/elixir on Windows

Ok, using Windows 7 for development, I have installed node + npm and they are working (node -v and npm -v return their versions). However when I run npm install in my Windows command prompt I'm getting following error(s)

d:\wwwroot\project>npm install
npm WARN optional dep failed, continuing fsevents@0.3.8
npm WARN optional dep failed, continuing fsevents@0.3.8

> spawn-sync@1.0.13 postinstall d:\wwwroot\project\node_modules\gulp-sa
ss\node_modules\node-sass\node_modules\cross-spawn\node_modules\spawn-sync
> node postinstall

\
> node-sass@3.3.3 install d:\wwwroot\project\node_modules\gulp-sass\nod
e_modules\node-sass
> node scripts/install.js

Binary downloaded and installed at d:\wwwroot\project\node_modules\gulp
-sass\node_modules\node-sass\vendor\win32-x64-46\binding.node

> node-sass@3.3.3 postinstall d:\wwwroot\project\node_modules\gulp-sass
\node_modules\node-sass
> node scripts/build.js

` d:\wwwroot\project\node_modules\gulp-sass\node_modules\node-sass\vend
or\win32-x64-46\binding.node ` exists.
 testing binary.
Binary is fine; exiting.
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v4.1.0
npm ERR! npm  v2.14.3
npm ERR! path C:\Users\Avram\AppData\Roaming\npm-cache\readable-stream\1.0.33\pa
ckage\package.json.281f868242e9f7951c5040cc39d1efed
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename

npm ERR! Error: EPERM: operation not permitted, rename 'C:\Users\Avram\AppData\R
oaming\npm-cache\readable-stream\1.0.33\package\package.json.281f868242e9f7951c5
040cc39d1efed' -> 'C:\Users\Avram\AppData\Roaming\npm-cache\readable-stream\1.0.
33\package\package.json'
npm ERR!     at Error (native)
npm ERR!  { [Error: EPERM: operation not permitted, rename 'C:\Users\Avram\AppDa
ta\Roaming\npm-cache\readable-stream\1.0.33\package\package.json.281f868242e9f79
51c5040cc39d1efed' -> 'C:\Users\Avram\AppData\Roaming\npm-cache\readable-stream\
1.0.33\package\package.json']
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'rename',
npm ERR!   path: 'C:\\Users\\Avram\\AppData\\Roaming\\npm-cache\\readable-stream
\\1.0.33\\package\\package.json.281f868242e9f7951c5040cc39d1efed',
npm ERR!   dest: 'C:\\Users\\Avram\\AppData\\Roaming\\npm-cache\\readable-stream
\\1.0.33\\package\\package.json',
npm ERR!   parent: 'through2' }
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!     d:\wwwroot\project\npm-debug.log

Note that I have run cmd as Administrator. If I run gulp after that, I get this:

d:\wwwroot\project>gulp
module.js:338
    throw err;
    ^

Error: Cannot find module 'laravel-elixir'
    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> (d:\wwwroot\project\gulpfile.js:1:76)
    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)
    at require (module.js:384:17)

Any ideas? Anyone tried this on Windows yet? I've searched forums but the search yielded no results.

0 likes
5 replies
mehany's avatar
mehany
Best Answer
Level 13

@Webinsane Simply remove the current node_modules folder and re-run

npm install // as administrator 

P.S I think you more likely ran npm install once as non-administrator then you tried again as administrator.

1 like
Webinsane's avatar

That's possible, because I was trying to install it yesterday as non administrator and tried again today, but I'm pretty sure I removed node_modules before doing that. Anyway, I did as you said (again) and it worked! I just hope when I start another project in Laravel I'll get it right again :-)

Thanks!

Webinsane's avatar

Well, I started new Laravel project and installing with npm install failed miserably with lots of warning and error messages and with one final message stating that I should run the command again as root/Administrator, even though I was already using command prompt as Administrator.

After a lot of googling I found out how to solve it - I needed to update npm to v.3 by issuing npm install -g npm@3

After that npm install did the job, but when running gulp it said I needed to rebuild node-sass component, so simple npm rebuild node-sass did the trick - after that I was able to run gulp without receiving any errors.

1 like
wuelcas's avatar

@Webinsane thank you, this worked for me! I was having the exact same problem. Also, I updated npm and then checked the version with npm -v and it showed me the old version, this is a problem with windows, npm is upgraded with no problems but somehow if you want to see the version, it stills shows the old version. If you want to see the newest version when running npm -v follow this steps: Upgrading npm on windows

1 like

Please or to participate in this conversation.