Saturday 3 June 2017

WSL - Cannot install gulp locally in /var/www

I am running an apache2 web application on Bash on Windows - WSL. The project has following node dependencies described in package.json

{
    "name": "xxx",
    "version": "1.0.0",
    "private": true,
    "dependencies": {
    },
    "devDependencies": {
    "gulp": "^3.9.1",
    "gulp-uglify": "^1.5.1",
      "gulp-concat": "^2.6.0",
      "gulp-sourcemaps": "^2.4.0"
    },
  "engines": {
    "node": ">=4"
  }
}

Doing a simple npm install gives errors similar to the one below. So, I used sudo npm install -g on all the packages manually. Since gulp still needs a local copy in the project directory, it needs npm install gulp --save-dev commands. This generated following error.

user@DESKTOP:/var/www/xxx/xxx$ sudo npm install gulp --save-dev
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm ERR! path /var/www/xxx/xxx/node_modules/gulp

npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename '/var/www/xxx/xxx/node_modules/gulp' -> '/var/www/xxx/xxx/node_modules/.gulp.DELETE'

npm ERR! enoent This is related to npm not being able to find a file.

npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/user/.npm/_logs/2017-06-04T06_06_31_779Z-debug.log

Also, by default all files and directories in /var/www in WSL have root:root user:group. Local node_modules/ directory is always empty.



via stWrong

No comments:

Post a Comment