1

A lot of people have this problem but it always starts out with "I installed NVM for windows and now NPM won't work". That is not my issue. NPM works fine. My problem is with installing packages, but I should prefix this by saying that I'm new to npm, git, etc so I may be missing something.

I've been handed a DOMO project and I was instructed to install this ryuu package to the app's local node_modules directory -- but that I need to use NVM to switch between node versions (not sure if that's their requirement or best practice, seems like the latter). Regardless, I install NVM, and install the version of node required by the .nvmrc file - and when I go to install the ryuu package it downloads locally to the node_modules directory as expected.

The problem is when I run the domo login command -- 'domo' is not recognized. I can see the executable script in the app's local node_modules/.bin directory though. Yet, when I install the package globally, it installs in appdata/roaming/nvm/<node version>/node_modules and when I run the command domo login, I get a message saying:

[ERROR] The domo cli tool has experienced an error. As it is
[ERROR] possible this bug has already been fixed, please try updating
[ERROR] using `npm install -g ryuu` and run this command again. If this
[ERROR] does not fix the issue, please contact your MajorDomo.
[ERROR] error message: Unexpected token {

I'm assuming this package is broken or NVM is messing with it, but it seems I've successfully hit the global executable script.

When I run npm root I see it points to the local node_modules directory but when I run nvm root it points to the appdata/roaming path. My best guess is that NVM is looking in the wrong place (global) to execute the (local) domo script, but I'm not sure how to change that path.

I looked at environment variables, and there is one pointing to a nodejs directory in C:/Program Files but it is a symlink for the current version of node that NVM is using, and it goes right back to the appData/Roaming directory which I understand to be the way it *should work. I also believe this is why I can execute globally installed packages but not local ones, and why NPM works (because it is installed globally).

So, how do I tell NVM to look in the app's local node_modules directory instead of the global one, or can this not be done? I read that NVM for windows is not the same as NVM, so this may be one of those variances in how it works?

==========================================================
EDIT:
Just in case anyone sees this, I haven't solved the root cause of this issue, but I have found a way around it.

If you cd into the app's local directory, then in the terminal you can run any script command by doing

node_modules/.bin/<scriptname> command
Rich
  • 181
  • 1
  • 5
  • If i'm not mistaken, nvm use a global node_modules for each version that you have to install the global packages there. There is also a new NVM-like version https://github.com/tj/n, maybe you can try with that one. Are you installing if globally using which version of node?? – DGomez Aug 18 '20 at 16:28
  • I mean, at least in linux you have a hidden dir that contains all the installed versions and in each one is each global installed, not sure if thre are shared among versions. – DGomez Aug 18 '20 at 16:30
  • That seems consistent with Windows 10 -- AppData/Roaming/nvm is where nvm puts all versions of node, with each version containing its own node_modules dir like you described. When I install global, I seem to be able to at least 'hit' the script but if it's local to the app, it's like NVM has no idea about the local node_modules dir. I'll look at this new version though, thanks – Rich Aug 18 '20 at 16:36

1 Answers1

0

To avoid issues with people's different versions of node and different operating systems, the recommended approach for using the domo apps CLI is to download the executables instead of node scripts. For windows you can just use chocolatey. For Mac you can use Homebrew: https://developer.domo.com/docs/dev-studio/set-up#Windows

The chocolatey command is choco install domo.

The homebrew command is brew install DomoApps/ryuu/domo.

You can still install via npm if you want to use canary / beta builds, but using these executables are more stable across environments.

jasonleehodges
  • 191
  • 2
  • 13