[balena-cli] npm ERR! cb() never called!

(Tymur Kubai) #1

What I Wanted to Do

just want to install global package

What Happened Instead

$ npm install balena-cli -g --production --unsafe-perm
npm WARN deprecated graceful-fs@3.0.11: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated natives@1.1.6: This module relies on Node.js's internals and will break at some point. Do not use it, and update to graceful-fs@4.x.
npm WARN deprecated graceful-fs@1.2.3: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
Unhandled rejection Error: EACCES: permission denied, rename '/home/sirdir/.npm/_cacache/tmp/3e113950' -> '/home/sirdir/.npm/_cacache/content-v2/sha1/44/aa/c65b695b03398968c39f363fee5deafdf1ea'

Unhandled rejection Error: EACCES: permission denied, rename '/home/sirdir/.npm/_cacache/tmp/8485ec6b' -> '/home/sirdir/.npm/_cacache/content-v2/sha1/29/0c/bb232e306942d7d7ea9b83732ab7856f8285'

npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR!     <https://npm.community>

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/sirdir/.npm/_logs/2019-04-13T18_12_51_316Z-debug.log

Reproduction Steps

npm install balena-cli -g --production --unsafe-perm

Details

  1. Firstly when I try to install balena-cli get error
$ npm install balena-cli -g --production --unsafe-perm
npm WARN deprecated graceful-fs@3.0.11: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated natives@1.1.6: This module relies on Node.js's internals and will break at some point. Do not use it, and update to graceful-fs@4.x.
npm WARN deprecated graceful-fs@1.2.3: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN checkPermissions Missing write access to /usr/lib/node_modules
npm WARN resin-register-device@5.0.0 requires a peer of resin-request@^9.0.2 but none is installed. You must install peer dependencies yourself.

npm ERR! path /usr/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/lib/node_modules'
npm ERR!  { [Error: EACCES: permission denied, access '/usr/lib/node_modules']
npm ERR!   stack:
npm ERR!    'Error: EACCES: permission denied, access \'/usr/lib/node_modules\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/lib/node_modules' }
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 (though this is not recommended).

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/sirdir/.npm/_logs/2019-04-13T18_04_42_492Z-debug.log
  1. after that i try to install with sudo

sudo npm install balena-cli -g --production --unsafe-perm

and it print no errors, but still have no access to package after installation

  1. after that Iā€™m delete package with

sudo npm uninstall -g balena-cli

  1. use stackoverflow wisdom https://stackoverflow.com/a/49122289/4577788

  2. Try install package again without sudo npm install balena-cli -g --production --unsafe-perm

and get npm ERR! cb() never called!

Platform Info

$npm --version
6.4.1
$node -p process.platform
linux
$ node -v
v10.15.3
$ uname -a
Linux laptop 4.18.0-17-generic #18~18.04.1-Ubuntu SMP Fri Mar 15 15:27:12 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
0 Likes

(John Gee) #2

At least part of your problem is that installing global packages using sudo has left behind files with the wrong ownership.

The short version is run this to fix the ownership, then try your install again:


sudo chown -R $(whoami) ~/.npm
npm install balena-cli -g --production

Note, the --unsafe-perm was just for sudo so since you are not using sudo now you do not need that either.

0 Likes