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

npm install requires the user to login as root if using /root directory. Cannot sudo to root. #1670

Closed
calr0x opened this issue Jan 6, 2022 · 3 comments
Labels
bug Something isn't working v6 Issue or development for OT-node version 6

Comments

@calr0x
Copy link
Contributor

calr0x commented Jan 6, 2022

Issue description

Expected behavior

Execute npm install in /root/ot-node directory as a sudo user and successfully complete the command.

Actual behavior

At some point the sudo privilege is dropped and the user becomes a regular user and can no longer write/access to the root directory. It does work within the regular users homedir.

Steps to reproduce the problem

  1. Login as regular user and sudo -i to root.
  2. cd ot-node
  3. npm install

Specifications

  • Node version:
  • Platform:
  • Node wallet:
  • Node libp2p identity:

Contact details

  • Email:

Error logs

root@otnode-2:~/ot-node# npm install

> bufferutil@4.0.4 install /root/ot-node/node_modules/bufferutil
> node-gyp-build

sh: 1: node-gyp-build: Permission denied
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! bufferutil@4.0.4 install: `node-gyp-build`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the bufferutil@4.0.4 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!     /root/.npm/_logs/2022-01-06T16_51_23_165Z-debug.log

Disclaimer

Please be aware that the issue reported on a public repository allows everyone to see your node logs, node details, and contact details. If you have any sensitive information, feel free to share it by sending an email to tech@origin-trail.com.

@NZT48 NZT48 added bug Something isn't working v6 Issue or development for OT-node version 6 labels Jan 24, 2022
Y0lan added a commit to Y0lan/ot-node that referenced this issue Feb 9, 2022
@Y0lan
Copy link

Y0lan commented Feb 9, 2022

Pushed a fix here:
#1739

Should work.

Or just run npm config set unsafe-perm true before running npm install

@Y0lan
Copy link

Y0lan commented Feb 9, 2022

More info on my setup:

npm -v
8.3.1
node -v
v16.14.0

On older version of node / npm it may not fix the problem since the command into the install script was run AFTER npm install.

Now with newer version, it is run BEFORE so it can fix the problem.

Either way, I still recommand to block root login on server and run docker rootless + secure user.

@NZT48
Copy link
Member

NZT48 commented Dec 26, 2022

This issue is being closed as inactive due to the date of the last activity on it. If you believe this is still a problem, please create a new issue and confirm that it is reproducible in the current ot-node release version. We are working towards closing open issues that meet specific criteria and ask you to create a new one for those that that are truly bugs in current release. We'll be monitoring those issues so that they are properly managed.

Thank you,
OriginTrail Team

@NZT48 NZT48 closed this as completed Dec 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working v6 Issue or development for OT-node version 6
Projects
None yet
Development

No branches or pull requests

3 participants