'Gradle task :installGulp - error EEXIST with gulp.cmd file
I have seen the questions on this site already with npm install giving the error above.
This is NOT the same question. In this case, the :installGulp task runs when I try to run my application(runs on its own; not part of my build.gradle file), and since npm install also installs Gulp from my npm dependencies, it finds the gulp.cmd file and complains thus:
npm ERR! path yourproject\node_modules\.bin\gulp.cmd
npm ERR! code EEXIST
npm ERR! Refusing to delete yourproject\node_modules\.bin\gulp.cmd: is outside yourproject\node_modules\gulp and not a link
npm ERR! File exists: yourproject\node_modules\.bin\gulp.cmd
npm ERR! Move it away, and try again.
Why doesn't it simply detect it and move on? Why crash?
For now, I have to manually rename the gulp.cmd file to something else to run the application. But I'm looking for a less brittle solution than this.
NOTE: There's also some differences between the old(npm install file) and new(:installGulp file) gulp.cmd files. This is for gulp version 4.0.2.
Old gulp.cmd:
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\gulp\bin\gulp.js" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b
New gulp.cmd:
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "%~dp0\..\gulp\bin\gulp.js" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node "%~dp0\..\gulp\bin\gulp.js" %*
)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
