Angular serve error encounted when the ng --open serve command types on VS - angular8

When I create angular project on desktop/angular8/firstapp and type the following serve command in visual studio code
PS C:\Users\User\Desktop\angular8\firstapp> ng --open serve
I get the following error
ng : File C:\Users\User\AppData\Roaming\npm\ng.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see
about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ ng --open serve
+ ~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
What is the reason for this, how can I get rid of this. Thanks in advance

I have found the answer
because powershell doesn't support for the angular commands. Then you have to do is,
Remove ng.ps1 from the directory C:\Users\%username%\AppData\Roaming\npm\ then try clearing the npm cache at C:\Users\%username%\AppData\Roaming\npm-cache\

Related

I can't install sanity through VS Code

When I try to install Sanity with the offered command (npm install -g #sanity/cli sanity init --coupon javascriptmastery2022) from the web page(https://www.sanity.io/javascriptmastery2022) through CLI it doesn't work, I receive this information on CLI:
Unrecognized token in source text.
At line:1 char:16
+ npm install -g <<<< #sanity/cli
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordExce
ption
+ FullyQualifiedErrorId : UnrecognizedToken
The command on the website includes && between the npm install command and the sanity init command. Are you including it?
If you're on Windows, you may need to run them as two separate commands:
npm install -g #sanity/cli
Then once that's done:
sanity init --coupon javascriptmastery2022

React native expo init issue

I want to learn react native and now I'm stuck when I run command: expo init my-app.
I have installed node and expo in my computer but when I want to create a new react native app, receive an error:
expo : The term 'expo' is not recognized as the name of a cmdlet, 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 line:1 char:1
expo
+ CategoryInfo : ObjectNotFound: (expo:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
What should I do to fix that problem?
Thank you guys!
Run npm i -g expo-cli or npm install --global expo-cli in the terminal.
Install Expo globally first. This error occurred because expo was not installed globally.
Also, check whether you have npm folder added correctly to your path under Environment Variables

How do I install discord.js on Visual Studio Code?

I tried installing discord.js on my terminal in Visual Studio Code. But whenever I run npm init -y or npm install discord.js, I get an error message that says this every time:
npm : The term 'npm' is not recognized as the name of a cmdlet,
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 line:1 char:1
npm
+ CategoryInfo : ObjectNotFound: (npm:String)
[], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
How do I fix this and install discord.js?
It seems like you dont have Node.js installed on your machine.
You can download it here.
When installed, just use npm i discord.js.

Unrecognized token in source text

Can somebody help me with this one? I really don't know why is this happening.
Unrecognized token in source text.
At line:1 char:13
+ npm install <<<< #babel/core #babel/cli --save-dev
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnrecognizedToken
Got the same error. You could try enclosing the text containing at-sign within apostrophes ('), like this:
npm install --save-dev '#babel/core' '#babel/cli'
Got the answer right here: https://github.com/ng-select/ng-select/issues/1114
Hope you ran the below from npm prompt
npm install --save-dev #babel/core #babel/cli

I have installed express and express-generator but still its not working however i can see both the folders in node_modules

After installing express and express-generator I am not able to use 'express' keyword.
Tried this command
npm install express
and
npm install express-generator
cmd> express --v
when checking express --v in cmd it should display installed version but i am getting the below error.
express : The term 'express' is not recognized as the name of a cmdlet, 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 line:1 char:1
+ express --v
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (express:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
to be able to use express in terminal , you need to install the package globally.
npm i -g express
express
if you don't install it globally then you can access it only within your project scope from package.json scripts.
for reference checkout the link -> https://docs.npmjs.com/misc/scripts