2

So it's been a burden I carried for long.
With the way I set npm up, I unconsciously did the installing process with sudo, and thus can't use npm properly without a sudo.
Is there a rather not convoluted way to set it back up so I don't have to use sudo again for that?

Comments
  • 0
    uninstall it and install without root?
  • 0
    @IAmAnIssue Will it mean I'll have to reinstall each node module globally installed one by one again?
  • 0
    @KuroTenshi67 I don't know. I don't use node often enough to know.
  • 0
    Delete the stupid global node-module dir, and try again.
    This time - don't give random node code root to your system.
  • 0
    @KuroTenshi67 find the global directory and use chown. Do the same with the binaries.
  • 0
    find the package.json in the folder, the global node_modules is in. Back it up. Wipe node_modules. Check if there's a package-lock.jsonm If yes, delete it, too. After that, make sure the package.json is still there (or there again) and do a npm i -g (without sudo).
  • 0
    @magicMirror @Cultist @Vuetiful Sorry for the late reply, I was busy lately with preparing some birthday parties and resting from some undesired aftermaths ^^'
    In any case, it worked after doing sudo chown -R $USER:$GROUP on the .npm folders. I have tried reinstalling it without sudo, but I seem to not be able to do that with either apt-get or dpkg, which worries me a bit. But I'll figure out how to fix that someday, I suppose.
    Anyway, thank you for your help :)
  • 0
    @KuroTenshi67 use nvm or any node version manager (like « n » by tj) to properly manage your node setup.

    Apt will be outdated and can't scale when you work on multiple project.

    Or use docker.
  • 0
    @KuroTenshi67 What are you trying to do with apt? install npm packages?

    please step away from the keyboard. sleep it off, and come back later when not so drunk.
  • 0
    @magicMirror No, I meant install npm in the first place. That was my reflex whenever I saw a package to download.
    And then I learnt npm could be bundled with nodejs or downloaded from git, cause it's been a long time since I DLed npm, and during that time, I wasn't all fresh on all the ways to get packages lol
    Of course to get things from npm, I do npm i [-g] <package_name> (... except I had to do this with sudo, because I couldn't otherwise because I'm a dumbass, that's why)
  • 0
    @KuroTenshi67 but... you need root to install npm, and node...
    nm. you seem much sober now. I, however, need to go get drunk.
Add Comment