Solution CLI not installing? | XM Community
Skip to main content

tl;dr

When attempting to run solution init in my plugin folder, I’m getting the following:

solution : The term 'solution' is not recognized as the name of a cmdlter, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At lin:1 char:1
+ solution init
+ ~~~~~~~~
+ CategoryInfo : ObjectNotFound: (solution:String) )], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

 

Background
I’m going to preface by saying that I’ve gone through and successfully published an XM Solution to my sandbox brand once before using an individual installation of Node (didn’t use nvm). When I got on about a month later, I became aware of being out-of-date on Node, so after dealing with the unsurety of cleaning things up properly (uninstalling prior version of Node and using new one), I tried to remove all my prior setup and start clean with an nvm installation. Actions taken during my removal of past setup is what I anticipate is now giving me trouble. Here’s where I’m at:

 

I get through creating my extension and its plugin. I navigate to the plugin directory and run the

npm install

and

npm install --location=global @qualtrics/solution-cli

Those both appear to run successfully.

 

Additionally, I have added Solution CLI to the environment path (I’m operating in Windows) -  C:\Users\<username>\AppData\Roaming\npm\bin. I did have it in either the System variables or User variables, but I have put it in both since things weren’t working.

 

The next step is to initialize the Solution CLI, but this is where I got the aforementioned error at the start of my post.

 

I will note that when setting up the environment path, I noticed I didn’t have the npm folder and bin sub-folder in ~\AppData\Roaming, so I manually created the npm folder and contained bin folder. Should those have been automatically created during my npm install step, and the fact that they weren’t already there indicative of my issue?

 

I have used the nvm to uninstall node, removed the nvm, re-installed the nvm, and re-done everything with nvm (allowing Chocolatey to do its thing, as well). I’ve done a version check to make sure I have the most-recent LTS version of Node. I’ve created a new extension folder and plugin, but still got stopped at this point every time.

 

Any ideas to help me out?

Hey @TimR , are you still experiencing this issue?


@product_experience Yes, still having this issue. Any ideas for me?


Both the npm and bin folders should have been created for you by default. When you install node, it should be bundled with npm already, so it should create the %APPDATA%\npm folder by default. When you install @qualtrics/solution-cli, it should create (if not already there) an %APPDATA\npm\bin folder which is NOT added to %PATH% by default (I know you added this to %PATH% already). Dumb question, but you’ve closed and re-opened your PS terminal since changing the PATH right? $Env:Path includes your \bin folder right?

You basically need to find where solution-cli was installed. If you find it and navigate to the folder within PS, can you run the solution.exe command? If that works, and $Env:Path shows the folder where the solution.exe executable is, there’s no reason this wouldn’t work. 

 


@qHubert When I did my first cleanup for a fresh install, I believe I deleted the npm folder in my %APPDATA\Roaming folder. After reinstalling nvm and having it install the latest node, then installing xmt-cli followed by solution-cli, there was no npm folder, so I manually recreated the npm folder with the following path:

%APPDATA\Roaming\npm\bin

Is it correct to be in \Roaming\, or should it be in \Local\?

 

Yes, I have closed and re-opened my PS terminal since changing the PATH.

Yes, $Env:Path includes %APPDATA\Roaming\npm (which wasn’t working, so I also tried to use %APPDATA\Roaming\npm\bin).

 

I found two different location types where there was a solution-cli folder...

  1. Within each of my Qualtrics plugin directories (e.g. %USER%\...\plugins\...\node_modules\@qualtrics\solution-cli)
  2. At %APPDATA\Roaming\nvm\v20.9.0\node_modules\@qualtrics\solution-cli

...but none of those solution-cli folders contained solution.exe.

 

The only place I found solution.exe was in %APPDATA\Roaming\nvm\v20.9.0\bin. I navigated to that directory in PowerShell, and when I attempted to run just “solution”, I received the same error as my original post:

solution : The term 'solution' is not recognized as the name of a cmdlter, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At lin:1 char:1
+ solution init
+ ~~~~~~~~
+ CategoryInfo : ObjectNotFound: (solution:String) :], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

However, I received a suggestion:

Suggestion g3,General]: The command solution was not found, but does exist in the current location. Windows PowerShell does not load commands from the current location by default. If you trust this command, instead type: ".\solution". See "get-help about_Command_Precedence" for more details.

I followed the suggestion and typed in “.\solution”, and it was successful. I just tested, and tried the command “.\solution init” and was finally prompted to log in (the step I’ve been trying to get to this whole time).

Is this just how I need to operate - with “.\” before my solution commands - or is this indicative that there’s something wrong in my environment variables path (i.e. instead of %APPDATA\Roaming\npm I should use %APPDATA\Roaming\nvm)? Also, is there anything wrong with the install of solution-cli given where I’ve indicated solution.exe was found?


Sorry, correction on my last - I first had the Environment Variables Path set to include %APPDATA\Roaming\npm\bin (per the Developer Portal documentation), but I had swapped it to just %APPDATA\Roaming\npm as part of my troubleshooting. Guess I flipped it back with my testing today, but I can verify that neither of them work.

 

I’ve got another question stemming from the Developer Portal documentation. It has that note for Windows users saying to use the AppData\Roaming\npm\bin path, but I don’t know if that’s correct if someone is using a Node Version Manager, as there seems to be nothing installed in that location. My User and System Variables both have a path for %NVM_HOME% and %NVM_SYMLINK%. Should those be covering what seems to be the actual path of %APPDATA\Roaming\nvm\v20.9.0\bin?

 

This might highlight the issue I had this whole time. The Developer Portal documentation worked for me the first time when I simply installed node by myself (WITHOUT use of a node version manager). The PATH for Environment Variables was correct, hence why I successfully got through the solution init step and submitted my first extension. THEN, when I started fresh with a node version manager (nvm), where the install of node rests NOT in the npm folder but in the nvm folder, the instructions might be wrong. I’m not positive, as I’m unexperienced in this realm, but those are the pieces that fit together while mulling this over. If that is correct, then the documentation should probably include different instructions for Windows users with just node and Windows users with a node version manager - PATHS might not be the same.

I don’t know what the nvm PATH ought to be, though, if that’s the case, because I’m seeing a versioned folder inside %APPDATE\roaming\nvm (i.e. “v20.9.0\bin” as of right now), so if we were to use that, I’d have to update my environment variable PATH any time I update node, wouldn’t I? As mentioned before, do the %NVM_HOME% and %NVM_SYMLINK% take effect here? If they did, I’d imagine I wouldn’t have run into the problem I had, so I’m guessing they don’t serve that purpose, but I don’t know.

Either way, should I be seeing the solution.exe in a different directory than where I find my solution-cli folder?

  • %APPDATA\Roaming\nvm\v20.9.0\node_modules\@qualtrics\solution-cli\
  • %APPDATA\Roaming\nvm\v20.9.0\bin\solution.exe

Well, I just proved at least one idea right - set my Environment Variables PATH to include C:\Users\<username>\AppData\Roaming\nvm\<current node version>\bin

So mine looked like C:\Users\<username>\AppData\Roaming\nvm\v20.9.0\bin. Added it to the Path, restarted PowerShell, navigated to my plugin directory, ran npm install and npm install --location=global @qualtrics/solution-cli, then ran solution init and was prompted to log in! I might have figured it out. This leads me to the unpleasant conclusion, though, that I’ll have to update the Environment Variables each time node updates. I tried a generic Path of C:\Users\<username>\AppData\Roaming\nvm already to no avail, so I probably just learned something others already know about how specific paths need to be, which becomes difficult with nvms and changing versions.


Leave a Reply