Skip to content

Command "npm install -g" causes "ERR! Cannot read property 'path' of null" #437

Open
@gdennie

Description

@gdennie

attempting to enhance this image by installing Elm globally but encountering issues. It would appear that the installation process for npm is user 500 and owns and restricts access to /usr/local/lib/node_modules by default. Seems like an unnecessary constraint to impose on an already isolated environment.

Investigation revealed:

4337 error Linux 4.4.0-21-generic
4338 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "elm"
4339 error node v7.8.0
4340 error npm  v4.2.0
4341 error path /usr/local/lib/node_modules
4342 error code EACCES
4343 error errno -13
4344 error syscall access
4345 error Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
4345 error  { Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
4345 error   errno: -13,
4345 error   code: 'EACCES',
4345 error   syscall: 'access',
4345 error   path: '/usr/local/lib/node_modules' }
4346 error Please try running this command again as root/Administrator.
4347 verbose exit [ -13, true ]

and

ls -al /usr/local/lib/node_modules
total 12
drwxrwxr-x  3 500 500 4096 Mar 29 01:27 .
drwxrwxr-x  4 500 500 4096 Mar 29 01:27 ..
drwxrwxr-x 11 500 500 4096 Mar 29 01:27 npm

where

id -nu 500
id: 500: no such user

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions