Skip to content

[BUG] npm doctor erroneously reports permissions problem for nonexistent ~/node_modules & /.bin #2856

@luckman212

Description

@luckman212

Environment:

  • OS: macOS 11.3
  • Node: 16.0.0
  • npm: 7.11.2

There's a problem with npm doctor reporting not ok Check the permissions of files in $HOME/node_modules (should be owned by current user) for Perms check, even when those directories don't exist. Started around 7.5.x I believe, sorry not sure exactly which version. But continues as of 7.11.2.

image

$ pwd
/Users/luke

$ npm doctor
npm WARN checkFilesPermission error getting info for /Users/luke/node_modules
npm WARN checkFilesPermission error getting info for /Users/luke/node_modules/.bin
Check                               Value   Recommendation/Notes
npm ping                            ok
npm -v                              ok      current: v7.11.1, latest: v7.11.1
node -v                             ok      current: v16.0.0, recommended: v16.0.0
npm config get registry             ok      using default registry (https://registry.npmjs.org/)
which git                           ok      /usr/local/bin/git
Perms check on cached files         ok
Perms check on local node_modules   not ok  Check the permissions of files in /Users/luke/node_modules (should be owned by current user)
Perms check on global node_modules  ok
Perms check on local bin folder     not ok  Check the permissions of files in /Users/luke/node_modules/.bin
Perms check on global bin folder    ok
Verify cache contents               ok      verified 3148 tarballs

npm ERR! Some problems found. See above for recommendations.

$ stat /Users/luke/node_modules
stat: /Users/luke/node_modules: stat: No such file or directory
$ stat /Users/luke/node_modules/.bin
stat: /Users/luke/node_modules/.bin: stat: No such file or directory

Metadata

Metadata

Assignees

Labels

Bugthing that needs fixingPriority 1high priority issueRelease 7.xwork is associated with a specific npm 7 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions