WSL icon indicating copy to clipboard operation
WSL copied to clipboard

Permission denied after npm install gulp -g

Open Buashei opened this issue 6 years ago • 6 comments

I was trying to install gulp "npm install gulp -g" i have problem with WSL permission. I was trying to install it with sudo but

sudo npm install gulp -g
sudo: error in /etc/sudo.conf, line 0 while loading plugin "sudoers_policy"
sudo: /usr/lib/sudo/sudoers.so must be owned by uid 0
sudo: fatal error, unable to load plugins

Tried to use chmod, chmod+x on /usr/lib/node_modules/ but it didnt resolve my problem.

Tried to make wsl.conf like Brian Turek said in this link https://www.turek.dev/post/fix-wsl-file-permissions/ but returned to me "/etc/wsl.conf" E212: Can't open file for writing Can anyone help me?

Windows Version:

Major  Minor  Build  Revision
-----  -----  -----  --------
10     0      18363  0

WSL Version: 1

WSL Distribution: Ubuntu

╭─buashei@DESKTOP-S0TFLQ1 ~
╰─$ npm install gulp -g                                                                                             1 ↵
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/gulp/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gulp/node_modules/fsevents/node_modules/abbrev):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/abbrev' -> '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/.abbrev.DELETE'npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gulp/node_modules/fsevents/node_modules/ansi-regex):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/ansi-regex' -> '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/.ansi-regex.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gulp/node_modules/fsevents/node_modules/aproba):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/aproba' -> '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/.aproba.DELETE'npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gulp/node_modules/fsevents/node_modules/balanced-match):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/balanced-match' -> '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/.balanced-match.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gulp/node_modules/fsevents/node_modules/chownr):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/chownr' -> '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/.chownr.DELETE'npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gulp/node_modules/fsevents/node_modules/code-point-at):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/code-point-at' -> '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/.code-point-at.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gulp/node_modules/fsevents/node_modules/concat-map):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/concat-map' -> '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/.concat-map.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gulp/node_modules/fsevents/node_modules/console-control-strings):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/console-control-strings' -> '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/.console-control-strings.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gulp/node_modules/fsevents/node_modules/core-util-is):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/core-util-is' -> '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/.core-util-is.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gulp/node_modules/fsevents/node_modules/deep-extend):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/deep-extend' -> '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/.deep-extend.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gulp/node_modules/fsevents/node_modules/delegates):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/delegates' -> '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/.delegates.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gulp/node_modules/fsevents/node_modules/detect-libc):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/detect-libc' -> '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/.detect-libc.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gulp/node_modules/fsevents/node_modules/fs.realpath):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/fs.realpath' -> '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/.fs.realpath.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gulp/node_modules/fsevents/node_modules/has-unicode):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/has-unicode' -> '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/.has-unicode.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gulp/node_modules/fsevents/node_modules/inherits):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/inherits' -> '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/.inherits.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gulp/node_modules/fsevents/node_modules/ini):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/ini' -> '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/.ini.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gulp/node_modules/fsevents/node_modules/isarray):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/isarray' -> '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/.isarray.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gulp/node_modules/fsevents/node_modules/minimist):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/minimist' -> '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/.minimist.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gulp/node_modules/fsevents/node_modules/ms):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/ms' -> '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/.ms.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gulp/node_modules/fsevents/node_modules/npm-normalize-package-bin):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/npm-normalize-package-bin' -> '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/.npm-normalize-package-bin.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gulp/node_modules/fsevents/node_modules/number-is-nan):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/number-is-nan' -> '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/.number-is-nan.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gulp/node_modules/fsevents/node_modules/object-assign):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/object-assign' -> '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/.object-assign.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gulp/node_modules/fsevents/node_modules/os-homedir):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/os-homedir' -> '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/.os-homedir.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gulp/node_modules/fsevents/node_modules/os-tmpdir):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/os-tmpdir' -> '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/.os-tmpdir.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gulp/node_modules/fsevents/node_modules/path-is-absolute):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/path-is-absolute' -> '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/.path-is-absolute.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gulp/node_modules/fsevents/node_modules/process-nextick-args):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/process-nextick-args' -> '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/.process-nextick-args.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gulp/node_modules/fsevents/node_modules/rc/node_modules/minimist):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/rc/node_modules/minimist' -> '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/rc/node_modules/.minimist.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gulp/node_modules/fsevents/node_modules/safe-buffer):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/safe-buffer' -> '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/.safe-buffer.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gulp/node_modules/fsevents/node_modules/safer-buffer):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/safer-buffer' -> '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/.safer-buffer.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gulp/node_modules/fsevents/node_modules/sax):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/sax' -> '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/.sax.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gulp/node_modules/fsevents/node_modules/semver):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/semver' -> '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/.semver.DELETE'npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gulp/node_modules/fsevents/node_modules/set-blocking):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/set-blocking' -> '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/.set-blocking.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gulp/node_modules/fsevents/node_modules/signal-exit):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/signal-exit' -> '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/.signal-exit.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gulp/node_modules/fsevents/node_modules/strip-json-comments):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/strip-json-comments' -> '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/.strip-json-comments.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gulp/node_modules/fsevents/node_modules/util-deprecate):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/util-deprecate' -> '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/.util-deprecate.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gulp/node_modules/fsevents/node_modules/wrappy):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/wrappy' -> '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/.wrappy.DELETE'npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gulp/node_modules/fsevents/node_modules/yallist):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/yallist' -> '/usr/lib/node_modules/gulp/node_modules/fsevents/node_modules/.yallist.DELETE'

npm ERR! code EACCES
npm ERR! syscall symlink
npm ERR! path ../lib/node_modules/gulp/bin/gulp.js
npm ERR! dest /usr/bin/gulp
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, symlink '../lib/node_modules/gulp/bin/gulp.js' -> '/usr/bin/gulp'
npm ERR!  [OperationalError: EACCES: permission denied, symlink '../lib/node_modules/gulp/bin/gulp.js' -> '/usr/bin/gulp'] {
npm ERR!   cause: [Error: EACCES: permission denied, symlink '../lib/node_modules/gulp/bin/gulp.js' -> '/usr/bin/gulp'] {
npm ERR!     errno: -13,
npm ERR!     code: 'EACCES',
npm ERR!     syscall: 'symlink',
npm ERR!     path: '../lib/node_modules/gulp/bin/gulp.js',
npm ERR!     dest: '/usr/bin/gulp'
npm ERR!   },
npm ERR!   stack: "Error: EACCES: permission denied, symlink '../lib/node_modules/gulp/bin/gulp.js' -> '/usr/bin/gulp'",npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'symlink',
npm ERR!   path: '../lib/node_modules/gulp/bin/gulp.js',
npm ERR!   dest: '/usr/bin/gulp'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /mnt/d/home/.npm/_logs/2020-02-23T22_52_21_828Z-debug.log
╭─buashei@DESKTOP-S0TFLQ1 ~
╰─$ useradd -Um roustem                                                                                                                                                                                      243 ↵
useradd: Permission denied.
useradd: cannot lock /etc/passwd; try again later.

Buashei avatar Feb 23 '20 23:02 Buashei

Thank's for "super community". I've solved problem by myself 🖕.

Buashei avatar Feb 24 '20 08:02 Buashei

I meet the same problem, how did you solved?

Virtycle avatar Nov 10 '20 15:11 Virtycle

I guess you are using VSCode. Close the IDE, enable the terminal on the Windows(find Ubuntu in start) and install everything you need without problems. :) Tell me if it worked

Buashei avatar Nov 10 '20 15:11 Buashei

I have no IDE open when I run the command: npm install gulp -g but I still receive the permission denied errors, any more tips on how to fix this?

auxiliaryjoel avatar Apr 18 '22 00:04 auxiliaryjoel

Maybe too late, but just run your command with "sudo" e.g: sudo npm install --global gulp-cli

Joe3009 avatar Oct 18 '23 13:10 Joe3009

The above worked for me, appreciate it @Joe3009 !!!

abedabadoo avatar Nov 28 '23 01:11 abedabadoo