Giter VIP home page Giter VIP logo

Comments (13)

agnivade avatar agnivade commented on August 25, 2024 3

Sent #103.

The problem is not very easy to solve. Basically what we are trying to achieve here is execute a script after installation. Now everything works fine if you are doing it as non-root. But since its at a global level, usually everyone's /usr/local/bin is under root, therefore people will do sudo npm install -g. Now the problem with this is npm by default will downgrade the user permission for postinstall scripts to nobody when run as root. This is a problem for us because it does not allow to copy files under user's home directory.

There are a couple of solutions -

  1. Do not use the postinstall step at all. So users will have to run 2 commands(install and tldr --update) to get started.
  2. Pass --unsafe-perm=true in the installation step. This will use root permissions while installation which will make the .tldr directory as root. - Not good.
  3. Pass the --user=<username> option which will let npm use that user while executing the postinstall script.

I went with the 3rd option as that seemed to be the most reasonable compromise to me.

P.S. - How was this even pushed in the first place without testing ? The solution mentioned in the README is a complete hack. The wording if you are having problems is untrue. It will always throw an error.

from tldr-node-client.

agnivade avatar agnivade commented on August 25, 2024 2

which is done now too !

from tldr-node-client.

agnivade avatar agnivade commented on August 25, 2024 1

I am working on a fix currently. Will send a PR soon.

from tldr-node-client.

agnivade avatar agnivade commented on August 25, 2024

Hi @xingped , this is a known issue. Please have a look at this https://github.com/tldr-pages/tldr-node-client#installing to solve your problem.

from tldr-node-client.

waldyrious avatar waldyrious commented on August 25, 2024

@zdroid any hints on how to resolve this? I'd also like us to make a new release since tldr-pages/tldr-python-client#7 is blocked on the theme support for the node client, which was introduced in #61 (after the latest release, 1.6.0).

from tldr-node-client.

zlatanvasovic avatar zlatanvasovic commented on August 25, 2024

@waldyrious He just has to do the workaround from README (npm install -g --ignore-scripts tldr && tldr --update) and it'll be installed without errors.

About publishing new release: #101 is useful to be merged before new release is published, as it removes needless files from the package.

from tldr-node-client.

waldyrious avatar waldyrious commented on August 25, 2024

But shouldn't the errors not occur in the first place? Or is this an artifact of a previous installation, or...?

Also, shouldn't we update the obsolete dependencies to get rid of the warnings during installation? Is that something that we can fix by just changing the version numbers, or would we need to actually make changes in the code?

from tldr-node-client.

zlatanvasovic avatar zlatanvasovic commented on August 25, 2024

@waldyrious It's an issue related to how npm scripts are executed, most likely Linux-only. I had the same issue when I tried to install tldr without the workaround.

from tldr-node-client.

waldyrious avatar waldyrious commented on August 25, 2024

I had it too when I tried to update tldr (was on 1.4.0), which failed, so I uninstalled and reinstalled. This was on OS X, so it's not even platform-specific. I don't think the regular npm installation command should fail and require a workaround.

from tldr-node-client.

zlatanvasovic avatar zlatanvasovic commented on August 25, 2024

Agree. Maybe the issue is wrench.js-related, as the installation failed after it reached the wrench.js part? wrench.js is outdated anyway.

from tldr-node-client.

waldyrious avatar waldyrious commented on August 25, 2024

Nice analysis and explanation. I agree with the compromise you picked, seems to be the most reasonable one.

from tldr-node-client.

agnivade avatar agnivade commented on August 25, 2024

README is fixed. Waiting for the patch to be published to npm.

from tldr-node-client.

zlatanvasovic avatar zlatanvasovic commented on August 25, 2024

Well @agnivade, you can close the issue as it's fixed in latest version. It just has to be published.

from tldr-node-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.