NPM not recognised in WebStorm and unable to go back to past commands - node.js

I am using a mac and currently have node and npm installed. This works fine if I use the normal terminal. But it is not recognised in my Webstorm (using Ultimate version) terminal. Getting following output:
$ node
/bin/ksh: node: not found
$ npm
/bin/ksh: npm: not found
$
Also if I try to click up to go back to past commands, it doesn't work either. I end up with following output:
^[[A
If I try with others such as Java, it works fine as follows:
$ java -version
java version "1.8.0_162"
Java(TM) SE Runtime Environment (build 1.8.0_162-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode)
Noticed that Webstorm is definitely picking up my node path considering it is visible when I try to create a new project as shown in following image:
What am I doing wrong? I have seen setups in colleagues laptops and they do not have node/npm set up in bash_profile but everything still works. Could I get some help with this please. Thanks.

It's to do with the choice of your shell. looks like you have chosen to use ksh. Switch it back to something like bash.
I would suggest to do this gobally so that you don't have to keep doing this every time you open a new project.
Thus close your project, click Configure on bottom left and choose Preferences.
Select Tools -> Terminal
Under Application Settings, change your Shell path to /bin/bash (it should be /bin/ksh currently).
Apply and ok. Open your project and try to perform above actions which should work now.

Related

How do you get past the Windows Script Host error when trying to call `nvm use 16.19.0`

I need to set the node version to an older version for a new project I am working on. I am on Windows 11 Pro. This is a new computer that I setup yesterday and is pretty clean from a node perspective.
I have just removed nodejs and installed nvm (v 1.1.10).
After calling nvm install 16.19.0, I tried to call nvm use 16.19.0 and recieved the following error popup:
Here is the CLI history:
I was expecting this to set my current node version to 16.19.0.
I was trying to do this while running git-bash from Visual Studio Code so when I loaded up git-bash as Administrator I was able to get the nvm use call to work correctly.
Sorry for the stupid question, but I didn't see it answered on here anywhere else, so hopefully it will be useful to someone else.

Odoo Mac OSX installation get error "Could not execute command lessc" in PyCharm Community Edition

I installed Odoo 9 on Mac OSX using Homebrew virtual environment.
I installed npm, less and less-plugin-clean-css.
Finally if I launch Odoo from the Mac Terminal, using the appropriate parameters, everything goes well and I can enter my odoo with localhost:8069.
I then setup PyCharm Community Edition for odoo development, but when I run odoo from within PyCharm I get the error:
"Could not execute command lessc"
and obviously the web layout is totally wrong.
I saw here NodeJS plugin in IntelliJ Community Edition does not work that you cannot use NodeJS plugin with PyCharm CE.
My question then is: "How to enable PyCharm CE to use less and get rid of the error?".
If you are in Pycharm in getting error Could not execute command lessc and you have installed less which you can check by entering lessc command in terminal
Fix:
If you are using virtualenv then activate virtualenv from terminal and restart the server again from terminal, this time it won't give any error.
If you are not using virutalenv then you can just run from terminal server without any problems
I'm not sure why this problem is specific to PyCharm.
I had the same issue from PyCharm Professional, but I solve this issue with this way
When i finish installing the PyCharm pro ,then i set the environment variables in the 'run/debug configuraition'
(/usr/loca/bin)
which value(path) i found is using command "which lessc" in the terminal
Then I think the PyCharm can find lessc, and finnally I get rid of this nightmare
`Could not execute command 'lessc'
For me, updating the node was the solution. It was version 0.10.33. Now it's 6.1.12.
Check out this answer. You must uninstall node and reinstall it in a certain order:
https://stackoverflow.com/a/36395799?noredirect=1
At least that is what worked for me.

How to install/use Meteor with Babun Windows Shell

so I have a problem here with this custom cmd shell for windows called Babun and using it with meteor. To be honest, I am still a beginner when it comes to the cmd etc... but here is the situation.
So I am working on a meteor website and I am using WebStorm for this, meteor is already installed on my computer and the meteor commands are recognized on the windows cmd. I don't really like the default look of the windows cmd and add to the fact that I have to force it into legacy code mode in order for it to properly work as a terminal for WebStorm. That's why I searched for a more 'feature - rich' cmd and came across Babun which seems pretty handy.
I got as far as getting Babun to work within WebStorm without any problems, but its not recognizing meteor at all like my default windows cmd. This is the error I keep receiving from the console: zsh: command not found: meteor
Which is funny because my default windows cmd can pick it up, why can't Babun or this "oh-my-zsh".
I already tried adding the meteor plugin as instructed here: https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins but meteor is still not being recognized for me. I'm running windows 10 if that helps with the latest versions of both Meteor JS and WebStorm.
If anyone could shed some light into this issue I'm having that would be greatly appreciated!
Did you add the path in the .zshrc file? See how to add path in cygwin. A lot of Babun issue can be resolved by using cygwin solution.
You can confirm by running: which meteor

Can't find Git or Cordova on your path (Windows/Netbeans), Can't find GitHub under AppData/Local, FIX 2015

Error: NetBeans cannot find git or cordova on your path.
When trying to create a new Cordova Application in Netbeans.
How to fix? > THE ANSWER CAN BE FOUND BELOW :)
If anyone wants to know how to get Cordova working in Netbeans anno 2015/2016 here is the fix:
I have installed:
Git version: 2.5.1 for Windows 64 bit
Cordova version: 4.3.1 for Windows 64 bit
Node.js version: 0.12.0 for Windows 64 bit
Netbeans version: 8.0.2 x86
In Netbeans when I start a new project and select HTML5>Cordova Application then I will get this error:NetBeans cannot find git or cordova on your path.
After some searching on the good old internet, I found some pieces of information hither and thither which was correct but which didn't solve my problem. The reason for this was that it was old or slightly different than my problem. So I did the following to fix this problem:
I checked where my Cordova/npm files where and I happily found them in: C:\Users\\AppData\Roaming\npm
Next I had to find my Git.exe which FOR ME is located in: C:\Program Files\Git\bin (FOR SOME PEOPLE IT CAN BE FOUND IN: C:\Users\\AppData\Local\GitHub\PortableGit_)
Now I found out that Netbeans is using the windows PATH VARIABLES to locate git and cordova. For those who don't where to find or set the system Path Variables this website will help you find or set it: https://java.com/en/download/help/path.xml
I use windows 7 so I did this to change my path variables:"
-Select Computer from the Start menu
-Choose System Properties from the context menu
-Click Advanced system settings > Advanced tab
-Click on Environment Variables, under System Variables, find PATH, and click on it.
-In the Edit windows, modify PATH by adding the location of the class to the value for PATH. If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the class as the value.
SO edit path and then you see like C:/apath;C:/asdas; < enter here your git path;<enter here your cordova path and save it by clicking the OK button.
Restart Netbeans and now it has to work.
:)
For those getting here and the solution from #bboni did not work - as it did for me:
Make sure everything is installed correctly by opening a command prompt (open start-menu and type cmd).
Type the following commands git --version, cordova -v and node -v.
For me it looked like this:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. Alle Rechte vorbehalten.
C:\Users\JohnDoe>git --version
git version 2.8.4.windows.1
C:\Users\JohnDoe>cordova -v
6.2.0
C:\Users\JohnDoe>node -v
v4.4.5
That makes sure everything is installed correctly. If one or more commands result in an error, then it's either not installed or not added to PATH as described by #bboni.
Now open your Netbeans and go to Tools → Options → HTML/JS → Mobile Platforms and check if you can see somethink like Installed Cordova version: 6.2.0. This is to make sure Netbeans is basically able to detect Cordova.
At that point all the tutorials I found online ended. I came up with the idea to check if Netbeans' own Terminal would be able to execute the command above as well: Tools → Open in Terminal
I got an error telling me I'd need Cygwin to use the Terminal. So I installed it, restarted Netbeans, opened the Terminal, checked the commands above and they worked.
I checked Configure Cordova again - the error was gone and I could finally ran my app directly from Netbeans as I wanted to.   :)

Did I break phonegap when adjusting environment variables on Windows 7?

Installed node.js
Installed phonegap: npm install -g phonegap
Created the example app: phonegap create hello com.example.hello HelloWorld
Used the run command to test in Android: phonegap run android
What happened next is it didn't detect the Android SDK, so it asked me for build.phonegap.com account. I went ahead and created an account and entered user/pw and like magic, it created the app in the cloud. I pointed my qr code scanner to the screen and it installed on my Android phone. Cool, but...
I wanted to develop locally using the Android emulator. So I followed the instructions (http://docs.phonegap.com/en/3.0.0/guide_platforms_android_index.md.html#Android%20Platform%20Guide) to install Android SDK, change PATH variables, etc.
When I went back to command line and cd to my phonegap root folder, suddenly "'phonegap' is not recognized as an internal or external command...'. I tried to reinstall phonegap with npm and it looks like it installs just fine again, but even when restarting cmd.exe, phonegap commands do not work.
Any ideas? Changing environment variables shouldn't affect phonegap already installed, right? The only other thing I can think is I had to install Ant and made an ANT_HOME system variable..
Apologies for the noob question. I'm sure I'm just messed up something simple here..
Figured this out. I accidentally DELETED the environment variables for node.js when I was trying to APPEND additional environment variables manually for android sdk & Ant. Since phonegap was installed as a node package, it wasn't recognized.
Better reinstall using the Msysgit and give the correct path. In my case envi variable path is as follows,
C:\Program Files\nodejs\; ->NodeJS path
F:\windows_adt\sdk\platform-tools; ->SDK Platform Tools
F:\windows_adt\sdk\tools; ->SDK Tools
C:\msysgit\bin; ->Bin Folder
C:\msysgit\git; ->git
C:\msysgit\libexec\git-core; ->git-core, if you want.
To reduce further errors use the recommended msysgit shell.

Resources