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

Allow custom node and npm paths #10

Closed
rhamzeh opened this issue Jun 30, 2017 · 31 comments
Closed

Allow custom node and npm paths #10

rhamzeh opened this issue Jun 30, 2017 · 31 comments

Comments

@rhamzeh
Copy link

rhamzeh commented Jun 30, 2017

This would fix the issue of "NPM not installed" for users who install node to a custom folder, or install multiple versions of node using nvm.

@Eugeny
Copy link
Owner

Eugeny commented Jul 5, 2017

You can specify the path to npm through the npm option on the top level of config file

@sergiopvilar
Copy link

Does not work for me.

❯ which npm
/Users/sergio/.nvm/versions/node/v6.9.1/bin/npm
terminal:
  font: Hack
  shell: /bin/zsh
  background: theme
hotkeys: {}
appearance:
  frame: full
  tabsLocation: top
npm: /Users/sergio/.nvm/versions/node/v6.9.1/bin/npm

@Eugeny Eugeny reopened this Jul 5, 2017
@Eugeny
Copy link
Owner

Eugeny commented Jul 5, 2017

Could you please retry with Alpha 18?

@sergiopvilar
Copy link

The same

same

@Eugeny
Copy link
Owner

Eugeny commented Jul 6, 2017

Does npm exit with code 0 if you run it as /Users/sergio/.nvm/versions/node/v6.9.1/bin/npm -v ?

@sergiopvilar
Copy link

@Eugeny Yes it does:

❯ /Users/sergio/.nvm/versions/node/v6.9.1/bin/npm -v
3.10.8

rpm git/mr-2845-fix-serial-retrieval-url
❯ echo $?
0

@mikesprague
Copy link

Same issue here on Sierra with v1.0.0-alpha.18 (re-re-fixed custom npm path detection).

This definitely appears to be Mac specific. I have Terminus installed on 2 Linux boxes and they pick up npm and allow plugin installation correctly.

@compuguy
Copy link

compuguy commented Jul 17, 2017

Issue is still present on alpha 21, on OSX.

Same with alpha 22. Related to #4

@compuguy
Copy link

Issue is still present with the latest alpha (28).

@ClementParis016
Copy link

I'm having the same issue on alpha 29 using NVM

@compuguy
Copy link

compuguy commented Sep 26, 2017

Alpha 30, 31 and 32 still have this issue (on macos).

@Eugeny
Copy link
Owner

Eugeny commented Oct 7, 2017

@compuguy @ClementParis016 do you mean the automatic NPM detection or the npm config option?

@ClementParis016
Copy link

@Eugeny I was talking about the automatic detection. Though, auto-detection works well on my personal Windows machine with NVM for Windows but it doesn't on my Ubuntu work laptop having NVM. It's may be due to the way they differ on handling the linking of npm & Node executable for the active version.

@dloret
Copy link

dloret commented Oct 17, 2017

Version: 1.0.0-alpha.27
Platform: win32 10.0.15063

In the plugin menu, I see the message 'NPM is not installed':
npm

It is in fact installed in Ubuntu in Windows 10, as I use the bash terminal with Visual Studio Code. Due to other bugs, I had to chose between the Windows installation of NodeJS and NPM, or the Linux installation.

I also added "npm: /usr/bin/npm" in the config.yaml file located in %APPDATA%/Terminus. But it didn't have any effect.

If other people are in the same case, it would perhaps be interesting to address this also ?

Many thanks in advance.
Donatien

@compuguy
Copy link

@Eugeny Automatic npm detection is broken for me on my Mac. Using npm provided by homebrew. The manual npm config option wasn't working on that either. A Ubuntu machine I use has no problems with automatic npm detection, though.

@rhamzeh
Copy link
Author

rhamzeh commented Oct 23, 2017

Both automatic and manual detection are still broken on Alpha 35 (I'm using nvm)

However, it did work once I manually symlinked npm and node to /usr/bin/npm and /usr/bin/node

**
OS: Ubuntu 16.04
Node: 8.4.0

**
Current config:

    terminal:
      bell: 'off'
      shell: /bin/bash
    hotkeys: {}
    appearance:
      tabsLocation: top
      dock: 'off'
      frame: full
    npm: /home/raghd/programs/nvm/versions/node/v8.4.0/bin/npm

@equinusocio
Copy link

Same issue with npm installed with brew

@Eugeny
Copy link
Owner

Eugeny commented May 15, 2018

Could you guys please retest this with the latest alpha? I've added some improvements for the node & npm search paths there. Thanks!

@rhamzeh
Copy link
Author

rhamzeh commented May 15, 2018

@Eugeny Just tried it, it is no longer showing npm not installed, but the app is hanging as soon as I click on plugins.

OS: Ubuntu Linux
OS Version: 18.04
Node Version: 8.11.1
Terminus Version: Alpha 46 (tar.gz file) retrieved from Github Downloads

screenshot from 2018-05-15 11-32-18

@Eugeny
Copy link
Owner

Eugeny commented May 15, 2018

@rhamzeh any idea why the terminal says Stopped?

@rhamzeh
Copy link
Author

rhamzeh commented May 15, 2018

@Eugeny No sorry, it prints that as soon as I click on "Plugins" :/

@RobertDeRose
Copy link

I'm using Windows Subsystem for Linux, and I've used the following value

wsl /usr/bin/npm

which seems to work, plugins are listed, Terminus reports that npm is installed, except that when I attempt to install plugins, everything appears to work, no errors, yet after a restart, nothing was installed.

There are no error logs either.

I noticed when I clicked on the "Plugins Folder" button in the up right corner, that Windows explore said the folder did not exists, so I created, but still nothing is installed. I opened the DevTools, but nothing is logged to the console and no errors appear on the console.

using latest Alpha 62

@Eugeny
Copy link
Owner

Eugeny commented Nov 12, 2018

Robert, on Windows, Terminus requires a win32 NodeJS build with NPM to install plugins. The reason is that the plugin directory is outside of WSL rootfs and that windows-specific package versions should be installed (as opposed to Linux ones that WSL-based NPM would install).

@RobertDeRose
Copy link

That makes sense. Was hoping to not need to install multiple nodejs on the machine.

@Spaxe
Copy link

Spaxe commented Jan 2, 2019

Retested with alpha 67, auto npm detection with homebrew installed npm (symlinked at /usr/local/bin/npm) doesn't work. EDIT: clarification, it's on my $PATH, and still not working.

@jporter-dev
Copy link

Not working for me on alpha 68.

@MircoT
Copy link

MircoT commented Jan 15, 2019

I have the same issue with macOS 10.14.2 and I installed both, Terminus and node with npm using homebrew. With the debugger, I found that the research in PATH is a little bit ambiguous. The PATH variable is not the same in these two points:

https://github.com/Eugeny/terminus/blob/1a258f32b05c66a476ed9668e62ac9de92ea88f7/terminus-plugin-manager/src/services/pluginManager.service.ts#L51

https://github.com/Eugeny/terminus/blob/1a258f32b05c66a476ed9668e62ac9de92ea88f7/terminus-plugin-manager/src/services/pluginManager.service.ts#L46

Probably when it asks for the PATH environment with the current user shell exec('$SHELL -i -c \'echo $PATH\'' something is going bad. But, with this tip I figure out that the script open the user shell and due to this it will expand all user environment. For this reason the PATH I added in my .zshrc config file are present.

So, to fix the problem I simply add the npm and node paths to my .zshrc file like that:

export PATH="/usr/local/bin:$PATH"

Hope this will be helpful.

PS: Of course, the configuration file depends on your shell.

@peterlobster
Copy link

peterlobster commented Jan 27, 2019

I'm using Alpha 69 asdf and npm is installed /Users/$USER/.asdf/shims; which is correctly set up in the $PATH...

$ echo $PATH
/Users/peter/.asdf/shims:/usr/local/opt/asdf/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin 
$ ls /Users/peter/.asdf/shims
node npm  npx

$ npm

Usage: npm <command>

where <command> is one of:
    access, adduser, audit, bin, bugs, c, cache, ci, cit,
    completion, config, create, ddp, dedupe, deprecate,
    dist-tag, docs, doctor, edit, explore, get, help,
    help-search, hook, i, init, install, install-test, it, link,
    list, ln, login, logout, ls, outdated, owner, pack, ping,
    prefix, profile, prune, publish, rb, rebuild, repo, restart,
    root, run, run-script, s, se, search, set, shrinkwrap, star,
    stars, start, stop, t, team, test, token, tst, un,
    uninstall, unpublish, unstar, up, update, v, version, view,
    whoami

npm <command> -h  quick help on <command>
npm -l            display full usage info
npm help <term>   search for help on <term>
npm help npm      involved overview

Specify configs in the ini-formatted file:
    /Users/peter/.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config

npm@6.4.1 /Users/peter/.asdf/installs/nodejs/10.15.0/lib/node_modules/npm

I've specficed the path in my config but still no cigar...

npm: /Users/peter/.asdf/installs/nodejs/10.15.0/lib/node_modules/npm/bin/npm
hotkeys:
  shell: {}
ssh: {}
terminal:
  colorScheme:
    name: Dracula
    foreground: '#f8f8f2'
    background: '#1e1f29'
    cursor: '#bbbbbb'
    colors:
      - '#000000'
      - '#ff5555'
      - '#50fa7b'
      - '#f1fa8c'
      - '#bd93f9'
      - '#ff79c6'
      - '#8be9fd'
      - '#bbbbbb'
      - '#555555'
      - '#ff5555'
      - '#50fa7b'
      - '#f1fa8c'
      - '#bd93f9'
      - '#ff79c6'
      - '#8be9fd'
      - '#ffffff'
  ligatures: true
  background: colorScheme
  environment: {}
  bell: audible
  autoOpen: false
  frontend: hterm
  profiles:
    - name: Headmaster (Lando) - Pantheon
      sessionOptions:
        command: /usr/local/bin/bash
        args:
          - '--login'
        env: {}
        cwd: /Volumes/Scratch/Code/*/website
appearance:
  theme: Standard
  vibrancy: true
  frame: thin
  dock: 'off'
  dockFill: 0.75
pluginBlacklist: []

tried this too...

npm: /Users/peter/.asdf/shims/npm
hotkeys:
  shell: {}
ssh: {}
terminal:
  colorScheme:
    name: Dracula
    foreground: '#f8f8f2'
    background: '#1e1f29'
    cursor: '#bbbbbb'
    colors:
      - '#000000'
      - '#ff5555'
      - '#50fa7b'
      - '#f1fa8c'
      - '#bd93f9'
      - '#ff79c6'
      - '#8be9fd'
      - '#bbbbbb'
      - '#555555'
      - '#ff5555'
      - '#50fa7b'
      - '#f1fa8c'
      - '#bd93f9'
      - '#ff79c6'
      - '#8be9fd'
      - '#ffffff'
  ligatures: true
  background: colorScheme
  environment: {}
  bell: audible
  autoOpen: false
  frontend: hterm
  profiles:
    - name: Headmaster (Lando) - Pantheon
      sessionOptions:
        command: /usr/local/bin/bash
        args:
          - '--login'
        env: {}
        cwd: /Volumes/Scratch/Code/*/website
appearance:
  theme: Standard
  vibrancy: true
  frame: thin
  dock: 'off'
  dockFill: 0.75
pluginBlacklist: []
$ ls .asdf/installs/nodejs/10.15.0/lib/node_modules/npm/bin/
node-gyp-bin npm          npm-cli.js   npm.cmd      npx          npx-cli.js   npx.cmd

I still get...
screen shot 2019-01-27 at 3 48 35 pm
screen shot 2019-01-27 at 3 49 31 pm

@peterlobster
Copy link

Maybe this has something to do with it? @Eugeny

screen shot 2019-01-27 at 11 29 45 pm
screen shot 2019-01-27 at 11 30 48 pm

@Eugeny Eugeny closed this as completed in 59d1a2f Feb 13, 2019
@peterlobster
Copy link

@Eugeny I saw you closed this in 59d1a2f, but I'm still getting the error in 1.0.71. Is there something I'm (we're) supposed to be doing differently to make this work? Thanks for your great effort! 👍

@Eugeny
Copy link
Owner

Eugeny commented Feb 18, 2019

@peterlobster it's not a part of any release yet, but you can grab a nightly build

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

No branches or pull requests