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

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

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.

Why after installing vue CLI through npm 6.9.0 dosn't work?

When i use this command bellow :
vue create hello-world
I got this message :
'vue' is not recognized as an internal or external command,
operable program or batch file.
After 1 month I still haven't found the solution..
Some informations:
My OS : Windows 10
NPM version : 6.9.0
vue version : 2.6.10
Vue cli installed version : #vue/cli#3.8.2
==>
0 error message when i installed all these packages.
I correctly added npm path on environement variable.
If you set the path correctly then you need to restart the system once because sometimes environment variables need restart after setting the path.
And Do this (If above not works):
Run command as administrator privileged.
npm install --global vue-cli
Set this path to environment variables:
C:\Users\YourUserName\AppData\Roaming\npm
This one too:
In last, restart the cmd, system and run the vue again. It should work just fine.

always get this error 'express' is not recognized as an internal or external command, operable program or batch file

I have tried many solutions like configuring environment variable, install express and express generator locally and globally
npm install express
npm install -g express-generator.
when I use express testapp or any express command it throws an error:
'express' is not recognized as an internal or external command
I am using window 10.
What can cause this error
and how to resolve it?