You are not logged in.

#1 2021-08-02 08:00:20

aryans
Member
Registered: 2021-07-11
Posts: 4

NodeJS working from different directory after installing heroku-cli

I use nvm for NodeJS. Installed NodeJS 16.6.0 on NVM (As this was a dependency) and tried running 

yay -Sy heroku-cli

It showed me this

:: Checking for conflicts...
:: Checking for inner conflicts...
[Repo:2]  libuv-1.42.0-1  nodejs-16.6.0-1
[Repo Make:5]  nodejs-nopt-5.0.0-2  semver-7.3.5-2  node-gyp-8.1.0-2  npm-7.20.3-1  yarn-1.22.11-1
[Aur:1]  heroku-cli-7.56.1-1

I selected the option that said remove make dependency after install. It returned the following (truncated)

npm: /usr/share/man/man1/npm-whoami.1.gz exists in filesystem
npm: /usr/share/man/man1/npm.1.gz exists in filesystem
npm: /usr/share/man/man1/npx.1.gz exists in filesystem
npm: /usr/share/man/man5/folders.5.gz exists in filesystem
npm: /usr/share/man/man5/install.5.gz exists in filesystem
npm: /usr/share/man/man5/npm-shrinkwrap-json.5.gz exists in filesystem
npm: /usr/share/man/man5/npmrc.5.gz exists in filesystem
npm: /usr/share/man/man5/package-json.5.gz exists in filesystem
npm: /usr/share/man/man5/package-lock-json.5.gz exists in filesystem
npm: /usr/share/man/man7/config.7.gz exists in filesystem
npm: /usr/share/man/man7/developers.7.gz exists in filesystem
npm: /usr/share/man/man7/orgs.7.gz exists in filesystem
npm: /usr/share/man/man7/registry.7.gz exists in filesystem
npm: /usr/share/man/man7/removal.7.gz exists in filesystem
npm: /usr/share/man/man7/scope.7.gz exists in filesystem
npm: /usr/share/man/man7/scripts.7.gz exists in filesystem
npm: /usr/share/man/man7/workspaces.7.gz exists in filesystem
Errors occurred, no packages were upgraded.
error: target not found: nodejs-nopt
error: target not found: semver
error: target not found: node-gyp
error: target not found: npm
error: target not found: yarn

and heroku was not installed. Now, node and npm are not working on my laptop.

$ node
bash: node: command not found
$ npm
/usr/bin/env: ‘node’: No such file or directory

This should look npm in /home/user/.nvm/versions/node/v14.17.3/lib/node_modules/npm instead of /usr/bin/env.

How do I fix this? Also, how do I install heroku-cli without breaking this again?

Offline

#2 2021-08-02 10:07:18

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,310

Re: NodeJS working from different directory after installing heroku-cli

You should not mix your package managers. If you want to maintain node/nvm locally then stick to that and install everything node locally, including heroku.

Right now you've installed at least part of node globally but via npm which breaks pacman and packages that in turn depend on pacman packages.

Since you seem to be surprised about this and your node not present in your PATH, which adjustment did you do to force a "local" nodejs installation and where did you put the relevant environment variables? The PKGBUILD of heroku_cli does indeed try to manipulate the PATH

_append_path() {
  case ":$PATH:" in
    *:"$1":*) ;;

    *)
      PATH="${PATH:+$PATH:}$1"
      ;;
  esac
}

prepare() {
  # Set path to perl scriptdirs if they exist
  # https://wiki.archlinux.org/index.php/Perl_Policy#Binaries_and_scripts
  # Added /usr/bin/*_perl dirs for scripts
  [ -d /usr/bin/site_perl ] && _append_path '/usr/bin/site_perl'
  [ -d /usr/bin/vendor_perl ] && _append_path '/usr/bin/vendor_perl'
  [ -d /usr/bin/core_perl ] && _append_path '/usr/bin/core_perl'

  export PATH

so check whether there are remnants of that. This should be "fixable" by just starting a new terminal.

To fix it more generally see https://wiki.archlinux.org/title/Pacman … )%22_error for what do when you have conflicting files so you can install the pacman packages again.

Offline

#3 2021-08-02 12:14:49

aryans
Member
Registered: 2021-07-11
Posts: 4

Re: NodeJS working from different directory after installing heroku-cli

V1del wrote:

Right now you've installed at least part of node globally but via npm which breaks pacman and packages that in turn depend on pacman packages.

Since you seem to be surprised about this and your node not present in your PATH, which adjustment did you do to force a "local" nodejs installation and where did you put the relevant environment variables?

I think this broke because when I received the option "Packages to cleanbuild", I selected ALL. Not sure though.

Also, I don't get what you mean by installing heroku node locally. Did you mean everytime I have to use heroku, I need to install heroku-cli using npm in the project?

Offline

#4 2021-08-03 10:33:03

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,310

Re: NodeJS working from different directory after installing heroku-cli

That option is a yay interna that is completely irrelevant to anything else.

You need to define what you want. In your opening post you mention installing node versions by hand, fine, but if you do that you should do everything via nvm and not install pacman packages that expect pacman repository packages to be present, or you can fake that you have pacman packages via the --assume-installed flags: e.g. https://wiki.archlinux.org/title/Node.j … tallations .

If you want both, then install pacman packages system wide but keep development/own versions in a local scope (e.g. in your home directory, and then start a dedicated development shell only for that specific project).

Offline

Board footer

Powered by FluxBB