checkPermissions Missing write access with file: dependency

registry
priority:low
cli
triaged

(Alexander Pepper) #1

What I Wanted to Do

I do have a git repository with multiple branches. In some branches a file: dependency is existing, in others not.

If I switch the branch and run a npm i I would expect, that npm simply installs (or removes) all packages according to package.json and package-lock.js

What Happened Instead

npm WARN checkPermissions Missing write access to npm_i_bugreport/node_modules/sub_dependency
npm WARN npm_i_bugreport@1.0.0 No description
npm WARN npm_i_bugreport@1.0.0 No repository field.

npm ERR! path npm_i_bugreport/node_modules/sub_dependency
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall access
npm ERR! enoent ENOENT: no such file or directory, access 'npm_i_bugreport/node_modules/sub_dependency'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

It looks like, that this was already reported in permissions for deps installed via file://, but not as a bug-report.

Currently I have to manually remove (rm -rf node_modules/sub_dependency) before npm i, which is quite annoying.

Reproduction Steps

git clone https://github.com/apepper/npm_i_bugreport.git
cd npm_i_bugreport

npm i # on branch master

git checkout origin/file_dependency -b file_dependency
npm i # on branch file_dependency

git checkout master
npm i # on branch master

Details

Platform Info

$ npm --versions
{ npm_i_bugreport: '1.0.0',
  npm: '6.4.1',
  ares: '1.14.0',
  cldr: '33.1',
  http_parser: '2.8.0',
  icu: '62.1',
  modules: '64',
  napi: '3',
  nghttp2: '1.32.0',
  node: '10.9.0',
  openssl: '1.1.0i',
  tz: '2018e',
  unicode: '11.0',
  uv: '1.22.0',
  v8: '6.8.275.24-node.14',
  zlib: '1.2.11' }
$ node -p process.platform
darwin

(Operations Research Engineering Software+) #2

a solution is to rm -rf the entire node_modules folder, but yeah otherwise I dont know why this problem exists.


(Alexander Pepper) #3

I know that deleting the node_modules folder is a workaround. To quote myself:


(Kat Marchán) #4

I feel like this is a duplicate of another post in #bugs but I don’t know which one.