I can't install sanity through VS Code - sanity

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

Related

sh: hardhat: command not found when installing Hardhat

Trying to build a project with Hardhat, I have node v15.14.0, and ran the following commands:
npm init -y
npm install --save-dev hardhat
Terminal gives me:
Then I ran:
npx hardhat
But got an error saying:
sh: hardhat: command not found
You should use NPX.
The Node Package eXecute allows us to directly access and execute a package stored (or not) in $ ./node_modules/.bin/your-package.
Using npx hardhat [GLOBAL OPTIONS] <TASK> everything will works fine!
Running npm install --save-dev hardhat again did it for me.

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.

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

Vue : command not found after installing #vue/cli

I don't know why isn't working for me. I opened powershell as administrator and run npm install -g #vue/cli. I have done uninstalling vue-cli and restalling again doesn't work. Here is my error
PS C:\WINDOWS\system32> npm install -g #vue/cli
npm WARN deprecated cross-spawn-async#2.2.5: cross-spawn no longer requires a build toolchain, use it instead
C:\Users\Lin Aung\AppData\Roaming\npm\vue -> C:\Users\Lin Aung\AppData\Roaming\npm\node_modules\#vue\cli\bin\vue.js
> protobufjs#6.8.8 postinstall C:\Users\Lin Aung\AppData\Roaming\npm\node_modules\#vue\cli\node_modules\protobufjs
> node scripts/postinstall
> nodemon#1.18.10 postinstall C:\Users\Lin Aung\AppData\Roaming\npm\node_modules\#vue\cli\node_modules\nodemon
> node bin/postinstall || exit 0
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.7 (node_modules\#vue\cli\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ #vue/cli#3.5.0
added 680 packages from 509 contributors in 172.749s
PS C:\WINDOWS\system32> vue
vue : The term 'vue' 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
+ vue
+ ~~~
+ CategoryInfo : ObjectNotFound: (vue:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\WINDOWS\system32>
Adding %APPDATA%\npm to the PATH fixed my problem
install using sudo
sudo yarn global add #vue/cli
At windows:
First step: %path%;%appdata%\npm;C:\Program Files\nodejs;C:\Users\User.npm-global;C:\Program Files (x86)\bin\
in environment variable
second step: https://classic.yarnpkg.com/en/docs/install/#windows-stable
install yarn or npm
third step: run window shell as administrator
set-executionpolicy unrestricted
Forth step : yarn global add #vue/cli
Result:
C:\Users\User>vue --version
#vue/cli 4.5.15

How to run npm after installing

I want to run npm pakage after installing
c:/>npm i -g pakagename
c:/>pakagename parameters
but I got error 'packagename' is not recognized as an internal or external command,
operable program or batch file.
try : npm install <package-name> -g
it will install that package globally to your system
then check it by checking its version. like
package --version
then do whatever you want
like : https://stackoverflow.com/a/15157360/6747191
To run your installed package with npm you can run it by this command
npm run-script <command> [-- <args>...]
Alias: npm run <command>
According to this documentation: https://docs.npmjs.com/cli/run-script