'docusaurus-start' is not recognized as an internal or external command - windows-10

When I type in yarn start in myproject.github.io/websites I get this error:
yarn run v1.22.11
warning package.json: No license field
$ docusaurus-start
'docusaurus-start' is not recognized as an internal or external command,
operable program or batch file.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
When I do yarn global list I get this:
yarn global v1.22.11
warning package.json: No license field
info "docusaurus-init#1.14.7" has binaries:
- docusaurus-init
Done in 0.10s.
So Docusarus does appear to me to be installed but I just can't do anything with it. Any ideas?

Doing yarn add docusaurus --dev instead of yarn global add docusaurus-init (which is what https://v1.docusaurus.io/docs/en/tutorial-setup suggests) did the trick.
Maybe yarn global add docusaurus --dev would have been better but alas that is not what I tried.

Related

Yarn:- Exit code:1; Command failed, while trying to create yarn app

I am trying to create a next.js app with tailwindcss, but when I enter the following command:
yarn create next-app -e -tailwindcss demo-app-full
It always results with an error, viz:-
$ yarn create next-app -e -tailwindcss demo-app-full
yarn create v1.22.17
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "create-next-app#12.0.10" with binaries:
- create-next-app
'C:\Users\7386-85615SG' is not recognized as an internal or external command,
operable program or batch file.
error Command failed.
Exit code: 1
Command: C:\Users\7386-85615SG 2913642\AppData\Local\Yarn\bin\create-next-app
Arguments: -e -tailwindcss demo-app-full
Directory: C:\Users\7386-85615SG 2913642\Desktop\HEMANG\Pionauts
Output:
info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.
To bypass this, I have done various steps, which include
1. yarn upgrade
yarn add yarn
yarn info
2. npm install -g npm#latest
nvm install node
npm install -g yarn
Tried using the steps given in this solution:- Yarn Start Command failed with exit code 1
but this also didn't work.
I've had and solved this issue before.
Let's understand why this happens and how to avoid it happening ever again.
Cause:
Windows usernames usually contain a space in the username especially if you set it up using the default windows setup prompt which creates your user based on "FirstName LastName".
Solution(s):
Now editing your username isn't feasible. You could set your yarn proxy and yarn config to some other location like D:\yarnData but that doesn't look pretty and it is a redundancy to folders already created during the yarn setup.
first run these commands:
yarn cache dir
yarn global bin
It will output to something like:
C:\Users\7386-85615SG 2913642\AppData\Local\Yarn\Cache\v6
C:\Users\7386-85615SG 2913642\AppData\Local\Yarn\bin
Solution 1. Use the user directory shorthand
i.e you can set the directory to say say C:\Users\7386-8561~1 that internally is equesl to C:\Users\7386-85615SG 2913642 .
How:
Open CMD
Navigate to C:\Users and run the command dir /x
This should output something like this
Directory of C:\Users
23-06-2022 00:06 <DIR> .
23-06-2022 00:06 <DIR> ..
21-11-2020 13:33 <DIR> Public
28-06-2022 11:50 <DIR> SIDDHA~1 Siddharth Shetty
Note down the alias next to your user. Here in my case it is SIDDHA~1, for you it could be 7386~1
Run commands:
yarn config set cache-folder "C:\Users\SIDDHA~1\AppData\Local\Yarn\Cache" (without the V6)
yarn config set prefix "C:\Users\SIDDHA~1\AppData\Local\Yarn" (without the bin)
Reload your shell and run the commands - it should work.
Solution 2. Set up a shortcut to point to your user folder.
i.e you can create a mklink that sets say C:\Users\NameSurname to point to => C:\Users\7386-85615SG 2913642 .
How:
Open CMD in Administrator mode (not powershell as the command is cmd only)
Create a directory junction (directory hard link) using the mklink command:
mklink /J "C:\Users\NameSurname" "C:\Users\7386-85615SG 2913642"
Run commands:
yarn config set cache-folder "C:\Users\NameSurname\AppData\Local\Yarn\Cache" (without the V6)
yarn config set prefix "C:\Users\NameSurname\AppData\Local\Yarn" (without the bin)
Reload your shell and run the commands it should work.
The path here is most probably the cause C:\Users\7386-85615SG 2913642 Spaces in folder names show up as issues and are not a good idea, try creating a simple structure like C:\MyProject and retry.

'yarn' is not recognized as an internal or external command, operable program or batch file

I installed yarn using the following command
npm install yarn -g
Then it shows the following status:
> yarn#1.22.10 preinstall C:\Users\vdine\AppData\Roaming\npm\node_modules\yarn
> :; (node ./preinstall.js > /dev/null 2>&1 || true)
C:\Users\vdine\AppData\Roaming\npm\yarn -> C:\Users\vdine\AppData\Roaming\npm\node_modules\yarn\bin\yarn.js
C:\Users\vdine\AppData\Roaming\npm\yarnpkg -> C:\Users\vdine\AppData\Roaming\npm\node_modules\yarn\bin\yarn.js
+ yarn#1.22.10
added 1 package in 0.962s
Then I added the yarn path to the environment variable
C:\Users\**path**\AppData\Roaming\npm\node_modules\yarn\bin
but its still shows "'yarn' is not recognized as an internal or external command,
operable program or batch file."
What should I do now?
Updated Jan '21
The recommended method for installation Yarn is now via npm:
npm install --global yarn
https://classic.yarnpkg.com/en/docs/install/
Try adding C:\Users\vdine\AppData\Roaming\npm to your PATH environment variable instead of C:\Users\**path**\AppData\Roaming\npm\node_modules\yarn\bin
Previously
The recommended method for installing Yarn is your OS tools instead of npm, check out the MSI method:
http://web.archive.org/web/20201226122851if_/https://classic.yarnpkg.com/en/docs/install/#windows-stable
remove file C:\Users\vdine\AppData\Roaming\npm\node_modules\yarn
and run npm install -g yarn --force

Trouble in installing loopback on windows

After running the command :
npm install -g loopback-cli
I am getting this output:
C:\>npm install -g loopback-cli npm WARN deprecated swagger-ui#2.2.10:
No longer maintained, please upgrade to swagger-ui#3.
D:\project\IOT-KT\infra\nfr-iot-md\testSpecs\nodejs\node_modules\windows-build-tools\lb
D:\project\IOT-KT\infra\nfr-iot-md\testSpecs\nodejs\node_modules\windows-build-tools\node_modules\loopback-cli\bin\loopback-cli.js
loopback-cli#5.0.2 updated 1 package in 115.326s
C:\>lb 'lb' is not recognized as an internal or external command,
operable program or batch file.
C:\>lb4 'lb4' is not recognized as an internal or external command,
operable program or batch file.
C:\>
But if go to location : D:\project\IOT-KT\infra\nfr-iot-md\testSpecs\nodejs\node_modules\windows-build-tools
and run lb command it is working, I created a project but then I was not able to create model because lb was not available in the project folder.
I am new to node js and learning loopback, please help me install loopback cli correctly on windows.
As after watching the error it's saying that you need to upgrade to swagger-ui#3 that might be reason.
Once above not worked then try below methods:
Steps:
delete node_modules
delete package_lock.json
clear cache either by this (C:\Users\XXXX\AppData\Roaming\npm) and
(C:\Users\admin\AppData\Roaming\npm-cache) or this way
run npm cache clean --force
Then run npm install
If the dependencies at global level then you need to update globally too
npm update -g
From error it also looks you also need to set the PATH too or the path you set need to modify.
Add PATH in Environment Variables: (C:\Users\xxxxxx\AppData\Roaming\npm)
then try to install your desired packages.
Worked for me for Windows error:
C:>lb4 'lb4' is not recognized as an internal or external command,
operable program or batch file.
Update your Environmental Variables, Go to:
Control Panel -> System and Security -> System -> Advanced System Settings -> Environment Variables
Add PATH in Environment Variables: (C:\Users\xxxxx\AppData\Roaming\npm)

after successfully installation of jhipster i am getting 'jhipster' is not recognized as an internal or external command,

problem >> 'jhipster' is not recognized as an internal or external command,
operable program or batch file.
Steps >>
Install Java 8
Install Node.js
install Yarn
install Yeoman: yarn global add yo
Install JHipster:
yarn global add generator-jhipster and yarn add generator-jhipster
after i try to start jhipster i am getting error.
Error1 >>
C:\Users\zycus>jhipster
'jhipster' is not recognized as an internal or external command,
operable program or batch file.
Error2>>
C:\Users\zycus>yo jhipster
'yo' is not recognized as an internal or external command,
operable program or batch file.
enter image description here
Maybe you did not restart your Command prompt or your Windows session after having installed yarn and so your command path has not been updated.
Look at your PATH environment variable and ensure it includes the location returned by yarn global bin. This is where the jhipster.cmd file (and other global node binaries) must have been installed.
In newer versions of jhipster this will likely be an issue with npm not being in your PATH. I was able to resolve this issue by running this command:
export PATH=$PATH:/c/Users/[MY_USER]/AppData/Roaming/npm/
I found the correct folder by searching for jhipster.cmd from my user root folder.

Running karma after installation results in 'karma' is not recognized as an internal or external command

I'm trying to run karma as part as an angular-seed project, after installing karma using
npm install -g karma
I get:
'karma' is not recognized as an internal or external command, operable program or batch file.
when i'm trying to run test.bat from angular-client\scripts, the content of this file is:
set BASE_DIR=%~dp0
karma start "%BASE_DIR%..\config\karma.conf.js" %*
I also tried to navigate to "\AppData\Roaming\npm\node_modules\karma\bin" and saw karma file, when I'm trying to run it I get again:
'karma' is not recognized as an internal or external command, operable program or batch file.
Any suggestions?
If not please suggest how to use jasmine without karma.
Thanks.
The command line interface is in a separate package.
To install this use:
npm install -g karma-cli
karma-cli
It is recommended to install karma with its Command-Line-Interface (karma-cli) which will take care of fetching the appropriate karma. You can also install a different local version specific to each project you're working on and karma-cli will pick the appropriate one.
From the karma installation page:
Typing ./node_modules/karma/bin/karma start sucks so you might find it useful to install karma-cli globally:
npm install -g karma-cli
Now, check that karma was installed by typing:
which karma //echo something like: /usr/local/bin/karma
and check that karma server is working (ctr+c to quit):
karma start
You can also check that karma was installed by going to this directory:
cd /usr/local/lib/node_modules/karma
Good luck!
On windows when you install a npm (non-globally - so without the -g flag), the executable commands are linked in the node_modules\.bin folder.
For example:
powershell> .\node_modules\.bin\karma start
powershell> .\node_modules\.bin\karma run
I had the same issue and fixed it by correcting my PATH environment variable.
STEP 1: go to the following path and ensure karma.cmd is present at the location given below
[Nodejs folder path]\node_modules\.bin <=> C:\Program Files\nodejs\node_modules\.bin
STEP 2: If present go to STEP 3, If not present run the following command npm install -g karma
STEP 3: Open environment variables and edit PATH
STEP 4: Add the following at the end :
[Nodejs folder path]\node_modules\.bin; <=> "C:\Program Files\nodejs\node_modules\.bin"
Log out your session and it will work for sure.
Based upon your directory using \AppData\Roaming, you're on Windows and this error is usually because the path to the npm globals isn't in the Windows PATH or NODE_PATH environment variables.
Use SET to check the values you are using for the paths and if your npm directory isn't listed, that will be the issue.
If you don't want npm to save to this directory, check the npm configuration options and the npm folders docs to see what you can change in this regard...
'karma' is not recognized as an internal or external command, operable
program or batch file.
If the above mentioned solution does not work, than
The cause of issue is previous version of nodejs. So uninstall the previous version of nodejs and re-install the latest version. It will resolve your issue. As I faced the same and by doing above changes it worked for me.
Thanks.
Official documentation at https://karma-runner.github.io/0.12/intro/installation.html is confusing. It implies that npm install -g karma-cli is to install karma globally but it actually required for to run karma from command line.
I had same: 'karma' is not recognized as an internal or external command, operable program or batch file. problem when i tried to install it directly to my project file. When i used npm install -g karma-cli to global install everything worked just fine.

Resources