npm-install-version icon indicating copy to clipboard operation
npm-install-version copied to clipboard

fails to install module when executed in cli using a postinstall script for a globally installed module

Open borisdiakur opened this issue 8 years ago • 2 comments

I’m trying to install and require major versions of lodash using a postinstall script for n_. However npm-install-version fails to install lodash. Here is how to reproduce the issue:

$ npm install [email protected] -g ; n_3

Here is the result:

$  ~/Workspace/n_ (master)$ ls -alh /usr/local/lib/node_modules/n_/node_modules/lodash\@\^3.10.1/
total 0
drwxr-xr-x  3 boris  admin   102B Dec 22 17:14 .
drwxr-xr-x  8 boris  admin   272B Dec 22 17:14 ..
drwxr-xr-x  2 boris  admin    68B Dec 22 17:14 node_modules
$ ls -alh /usr/local/lib/node_modules/n_/node_modules/lodash\@\^3.10.1/node_modules/
total 0
drwxr-xr-x  2 boris  admin    68B Dec 22 17:14 .
drwxr-xr-x  3 boris  admin   102B Dec 22 17:14 ..

References: https://github.com/borisdiakur/n_/issues/18

borisdiakur avatar Dec 22 '16 16:12 borisdiakur

Thanks @borisdiakur, I'll look into this

scott113341 avatar Dec 23 '16 14:12 scott113341

I believe I've hit the same issue. Invoking 'nvi' from a postinstall script works on the first invocation of npm install, but all subsequent invocations of npm install fail with:

$ npm i                                                                                                                                                                 (perf✱)
npm ERR! path [...]/clarinet/node_modules/npm/node_modules/dezalgo
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename '[...]/clarinet/node_modules/npm/node_modules/dezalgo' -> '[...]/clarinet/node_modules/npm/node_modules/.dezalgo.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/danlehen/.npm/_logs/2019-01-04T15_44_15_175Z-debug.log

To recover, I deleted my package-lock.json and /node_modules/.

Full repro:

$ git clone https://github.com/DLehenbauer/clarinet.git
$ cd clarinet
$ git checkout nvi-repro
$ npm i
$ npm i

The first npm i works as expected. The second fails as described above.

MacOS v10.14.2 node v8.11.4 npm v5.6.0

DLehenbauer avatar Jan 04 '19 17:01 DLehenbauer