'ANY_NODE_APP' is not recognized as an internal or external command, operable program or batch file on windows 10 - visual-studio-code

I use windows 10 OS . I already try :
npm i -g tslint
also local install.
I use visual code terminal (power shell , git bash and cmd ) no help in any variant.
Where is the execution file for tslint ? I will put path intro the PATH env var.

It is probably caused by the version conflict between global and project's TsLint. You can see your version by: tslint -v
Then you can reinstall Tslint globally to latest version by:
npm install tslint typescript -g
Then use following command in your project directory to even up versions.
npm install tslint typescript --save-dev
And also you can search in your json files if there is a specification about Tslint version.

Related

How do I run an npm script directly in VS code terminal

I am trying to follow this MS tutorial.
So I install the CLI from the VS code terminal: npm install #azure/static-web-apps-cli
Works.
But following the instructions using "swa init" in the terminal I get this response:
swa : The term 'swa' is not recognized.... etc.
Adding the command to package.json as a script will work, but how do I run it directly from the terminal without adding it to package.json?
npx swa init would pull the swa package and execute it as if it was run from within package.json. You can read more about it on npmjs.com/package/npx
Alternatively, you could have the swa package installed globally with npm i -g #azure/static-web-apps-cli

How to set the extension and path for the output file in JetBrains File Watcher with Babel? [Linux]

I am trying to set up PhpStorm to work with Babel instead of UglifyJS. I need the minifed output file to be written with a different extension to the same directory where the source script is located.
I changed argument line in the File Watchers settings for Babel to the following: $FilePathRelativeToProjectRoot$ --out-dir dist --out-file-extension .min.js --source-maps --presets minify
This is works, but output file is saved to /dist directory (without specifying --out-dir dist everything stops working) and --out-file-extension option is completely ignored. I suspect this is due to the old version of Babel 6.2, which I can't manage to update.
This "Output paths to refresh" field changes also don't work: $FileNameWithoutExtension$.min.js
Please explain how to change the arguments to solve this problem.
For me this solution works, which saves the output files .min.js at the same location, as the original file:
Install Babel global sudo npm install --save-dev -g #babel/core
Install Babel Minify global sudo npm install babel-preset-minify --save-dev -g
Setup PhpStorm Watcher with the following parameters:
Programm:
/usr/local/lib/node_modules/#babel/cli/bin/babel.js
Arguments:
$FilePathRelativeToProjectRoot$ --out-file $FileDir$/$FileNameWithoutExtension$.min.js --presets /usr/local/lib/node_modules/babel-preset-minify
PhpStorm Watcher Setup

Protractor still not available after global npm installation

Now I'm having other issues where Protractor is not found after installing using npm -g .
Some background:
I was previously having issues with npm installs, but it works now that I have set the correct proxy settings at the client site - i.e. .npmrc file exists under c:\Users(myUserName) which contains the registry and proxy keys.
For example, I install Protractor as follows :
C:\Projects\prot-test>npm install -g protractor
C:\Users\...\AppData\Roaming\npm\webdriver-manager -> C:\Users \...\AppData\Roaming\npm\node_modules\protractor\bin\webdriver-manager
C:\Users\...\AppData\Roaming\npm\protractor -> C:\Users\...\AppDataRoam
ing\npm\node_modules\protractor\bin\protractor
C:\Users\...\AppData\Roaming\npm `-- protractor#4.0.9
However, as soon as I check the installation, it cannot find it :
C:\Projects\prot-test>protractor --version
'protractor' is not recognized as an internal or external command, operable program or batch file.
****** UPDATE ******
It does appear to be a Win 7 environment issue with PATH not getting updated (i.e. I'm pretty much on lock-down at the client site).
For example, manually navigating to ..\npm directory seems to be required :
C:\Users\..\AppData\Roaming\npm>protractor --version
Version 4.0.9
C:\Users\..\AppData\Roaming\npm>
Your advice is appreciated....
Bob
Yes, its a PATH issue on Windows machines.Make sure if you have below configured in your system variables.
PATH
C:\Program Files\nodejs;C:\Users\<<user>>\AppData\Roaming\npm;
NODE_PATH
C:\Users\<<user>>\AppData\Roaming\npm\node_modules
If it still doesn't work for you still, check if you have all the path semi-colon seperated

VS Code Tslint library failed to load

Whenever I start VS Code the tslint library gives me this error
Failed to load tslint library. Please install tslint in your workspace
I have reinstalled it and but again it gives me the same error.
The current version of tslint I'm using is 0.5.24
I have tried by enabling tslint globally so it should be available to all workspaces followed by Microsoft vscode tslint issues but it also doesn't help me.
I enabled "tslint.enable": true, in vscode workspace settings. but again I have got same results.
Install globally with npm:
npm install typescript -g
npm install tslint -g
Switch to the root of your TypeScript project and generate a starting tslint.jsonconfig file:
cd path/to/my/project
tslint --init
Lint your TypeScript files!
tslint -c path/to/tslint.json path/to/typescript/file.ts
Checkout full usage guide for more.

ionic is not recognized as an internal or external command operable program or batch file

I have tried to install ionic framework. I was done with my first step by executing the command (installed node.js).
First command: npm install -g cordova ionic
But the second command is not executing instead stating"ionic is not recognized as an internal or external command operable program or batch file "
Second command:ionic start myApp tabs
I request to help me out
I'm using windows 10 for developing, I solved it by adding the npm global packages folder:
%USERPROFILE%\AppData\Roaming\npm
to the environment variable Path
I assume you are trying to install ionic in windows.
I think you could try to install it alone, without cordova, and then try it again.
npm install -g ionic
Regards
İf "ionic" is installed;
1-Download and upgrade nodejs to latest version.
download nodejs
2- run command:
npm uninstall -g ionic
3-Clear these files:
C:\Users\user\AppData\Roaming\npm
C:\Users\user\AppData\Roaming\npm-cache
3-run command:
npm install -g #ionic/cli
İt is done:)
SET PATH=C:\Program Files\Nodejs;%PATH%
Is worked for me on Windows 10 :)