‘The Journey’ is all about the different tastes and flavours…. wandering among the virtual streets…different Paths and Destinations… from Technology to Gadgets… from Humor to Practical Lessons…from Truth to Fictions… from current issues to market conditions… and wat’s not…
Tuesday, August 11, 2020
'npm' is not recognized as internal or external command, operable program or batch file
Add environment variable
C:\Program Files\nodejs\
To the end of your Path variable on the "User variable" section of the Environment Variables on the System Properties.
After that, reopen your command prompt and type (run cmd as admin.)
npm
- Open the Control Panel (Click the Start button, then click Control Panel)
- Click User Accounts
- Click Change my environment variables
- Select PATH and click the Edit... button
- At the end of the Variable value, add
;C:\Program Files\nodejs - Click Ok on the "Edit User Variable" window, then click Ok on the "Environment Variables" window
- Start a command prompt window (Start button, then type cmd into the search and hit enter)
- At the prompt (
C:\>) type npm and hit enter; you should now see some help text (Usage: npm <command> etc.) rather than "npm is not recognized..."
ExecutionPolicy script is not recognized as an internal or external command
Fix : Run the command from PowerShell! (PowerShell as Administrator )
If above solution does not work - try this
Dont work for me: and in cmd, and powershell, in all cases script was runned with admin permission, but I get the same error.
I`m also try to run it from npm folder where its located.
PS C:\Users\mishelen\AppData\Roaming\npm> npm-windows-upgrade
npm-windows-upgrade 0.5.1
? This tool will upgrade npm. Do you want to continue? Yes
Scripts cannot be executed on this system.
To fix, run the command below as Administrator in PowerShell and try again:
Set-ExecutionPolicy Unrestricted -Scope CurrentUser -ForceRefer: https://github.com/felixrieseberg/npm-windows-upgrade/issues/35
Not able to connect ssh - for AWS server - (error). - keypair.perm permission deny OR keypair.pem does not exist?
Solution to below issue ( in Mac)
Could not find /Users/keypairs/key-pair.pem
Connecting to: server at IP 90.xx.x.xxx with keypair key-pair
Warning: Identity file /Users/key-pair.pem not accessible: No such file or directory.
ec2-user@90.xx.x.xxx : Permission denied (publickey).
Monday, August 10, 2020
Check a String Contains a Substring in JavaScript
Options : Use the indexOf() Method
The simplest and fastest way to check whether a string contains a substring or not in JavaScript is the indexOf() method. This method returns the index or position of the first occurrence of substring within the string, otherwise, it returns -1 if no match found. Here is an example:
<script>// Sample stringvar str = "The quick brown fox jumps over the lazy dog."
// Check if the substring exists inside the stringvar index = str.indexOf("fox");
if(index !== -1){
alert("Substring found!");
} else{alert("Substring not found!");
}
</script>
In ES6 you can use the includes() method to check if a contains a substring. This method simply returns true or false instead of the index. Let's check out an example:
<script>// Sample stringvar str = "The quick brown fox jumps over the lazy dog."
// Check if string contains substringif(str.includes("fox")){
alert("Substring found!");
} else{alert("Substring not found!");
}
</script>
Check out the tutorial on JavaScript ES6 features to learn about new features introduced in ES6.
Further, you can use the search() method to search a particular piece of text or pattern (using regular expression) inside a string. Like indexOf() method the search() method also returns the index of the first match, and returns -1 if no matches were found.
<script>// Sample stringvar str = "Color red looks brighter than color blue."
// Search the string for a matchvar index = str.search(/color/i);
if(index !== -1){
alert("Substring found!");
} else{alert("Substring not found!");
}
</script>
Friday, August 7, 2020
Health Benefits of Cashews
Benefits of Cashews. Healthy food is an integral part of healthy body. Regular exercises such as Yoga and healthy diet is important to...
-
Dialog boxes Controls get the focus in a specific order when the user hits the TAB key. In VC++6 this order is decided through the i...
-
VSFlexGrid Introduction The VSFlexGrid control is a powerful, full-featured grid. It provides new ways to display, edit, format, organi...
-
After searching everywhere, I bet you I never found the implementation of the INTPTR, all thru the internet. I'm trying to put it here ...
