Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install.js tries to rename a non existing file #105

Open
dereckson opened this issue Oct 31, 2017 · 2 comments
Open

install.js tries to rename a non existing file #105

dereckson opened this issue Oct 31, 2017 · 2 comments

Comments

@dereckson
Copy link

dereckson commented Oct 31, 2017

On FreeBSD 11, the install.js script tries to rename a file not yet existing:

$ npm install -g dtrace-provider
>  [email protected] install /usr/local/lib/node_modules/dtrace-provider
> node scripts/install.js

fs.js:768
  return binding.rename(pathModule._makeLong(oldPath),
                 ^

Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/dtrace-provider/compile.py' -> '/usr/local/lib/node_modules/dtrace-provider/binding.gyp'
    at Object.fs.renameSync (fs.js:768:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/dtrace-provider/scripts/install.js:14:4)
    at Module._compile (module.js:612:30)
    at Object.Module._extensions..js (module.js:623:10)
    at Module.load (module.js:531:32)
    at tryModuleLoad (module.js:494:12)
    at Function.Module._load (module.js:486:3)
    at Function.Module.runMain (module.js:653:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3

$ ls /usr/local/lib/node_modules/dtrace-provider
ls: /usr/local/lib/node_modules/dtrace-provider: No such file or directory

This issue only occurs with -g: it can install in node_modules/ without any issue.

@AndrewTasso
Copy link

I'm also running into the same issue on MacOS Sierra

$ sudo npm install -g dtrace-provider

> [email protected] install /usr/local/lib/node_modules/dtrace-provider
> node scripts/install.js

fs.js:766
  return binding.rename(pathModule._makeLong(oldPath),
                 ^

Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/dtrace-provider/compile.py' -> '/usr/local/lib/node_modules/dtrace-provider/binding.gyp'
    at Object.fs.renameSync (fs.js:766:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/dtrace-provider/scripts/install.js:14:4)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Function.Module.runMain (module.js:676:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/Andrew/.npm/_logs/2017-12-12T18_34_50_863Z-debug.log

@melloc
Copy link
Collaborator

melloc commented Jan 12, 2018

This looks like the same problem as #110, and seems to be related to how npm drops permissions. I've reworked how the install lifecycle script gets run to hopefully recover from this kind of failure better. If you've continued having the issue, could you please try again and see if it still fails with [email protected]? You may want to run it with V set in the environment so we can see where it fails. For example:

$ V=1 sudo npm install -g dtrace-provider

It's possible that the only way to get the lifecycle scripts to run safely when doing a global install as root is with --unsafe-perm, so you may want to consider using that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants