json-server-auth not working when starting - json

i wanted to use json-server-auth but after installing it with npm it does not start.. I get this error:
json-server-auth : The term 'json-server-auth' 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
+ json-server-auth db.json
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (json-server-auth:String) [], CommandNot
FoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Can someone tell me how to resolve this issue and start the json-server-auth because i need it for my angular application because i am learning authentication and i am stuck here because of this error..
Thank you

i used this command to start the server and it started without an issue:
json-server db.json -m ./node_modules/json-server-auth

Related

Persistent error with Newtonsoft.Json.JsonReaderException

I have been attempting to run commands from the AzureAD powershell module, but I am consistently getting Json errors.
The issue is so persistent no matter what commands I run, I am wondering if the Newtonsoft.Json package is misconfigured and needs to be reinstalled.
Example:
New-AzureADServiceAppRoleAssignment -Id "any id" -ResourceId "any id" -ObjectId "any id" -PrincipalID "any id"
Output:
Error reading JToken from JsonReader. Path '', line 0, position 0
At line:1 char:1
New-AzureADServiceAppRoleAssignment -Id ....
CategoryInfo : NotSpecified: (:) [New-AzureADServiceAppRoleAssignment], JsonReaderException
FullyQualifiedErrorId: Newtonsoft.Json.JsonReaderException.Microsoft.Open.AzureAD16.Powershell.NewServicePrincipalAppRoleAssignment.
I tried in my environment and got successfully created a new app role service principal assignments:
Commands:
Connect-AzureAD
New-AzureADServiceAppRoleAssignment -ObjectId $servicePrincipal.ObjectId -PrincipalId $servicePrincipal.ObjectId -ResourceId $resourceApp.ObjectId -Id $permission.Id
Console:
Portal:
Make sure you are using latest version of Newtonsoft.json.
if you are using lower version, try to uninstall and reinstall the latest version by below command:
Install-Module -Name newtonsoft.json -RequiredVersion 1.0.1.2
If the error is still persisting uninstall AzureAD module reinstall the AzureAD-Module confirm all the traffic can be passed the network policy (Firewall) .
Verify if you are using the latest version of Azure AD PowerShell module? Also, validate if your local machine's firewall is restricting the command? Or if you're connected to any VPN or organizational laptop.
If AzureAD module is already installed, Install new version(2.0.2.140).
Command:
Install-Module -Name AzureAD --Allowclobber
Reference:
Getting error when running script · Issue #2 · adrecon/AzureADRecon (github.com)

problem with command template in visual studio code when trying to use mysql

I have downloaded and installed mysql extension on visual studio code and mysql server 2019. Now trying to access mysql via visual studio code cmd template. im using the command "mysql"and getting the following reply: ***mysql : The term 'mysql' 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
mysql
+ CategoryInfo : ObjectNotFound: (mysql:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException***
Am i missing a step in the instillation process on Visual Studio? I am a beginner and help would be appreciated.

Getting "Specify which project file to use..." error when ef scaffolding

When I tried to execute scaffold command in PMC I am getting the following error :
dotnet ef dbcontext scaffold "server=127.0.0.1:3308;uid=root;pwd=root;database=newtest_db" MySql.EntityFrameworkCore -o MySQLDataOperations -f
dotnet : Specify which project file to use because this 'D:\Projects\DotNet5_Docker' contains more than one project file.
At line:1 char:1
dotnet ef dbcontext scaffold "server=127.0.0.1:3308;uid=root;pwd=root
CategoryInfo : NotSpecified: (Specify which p...e project file.:String) [], RemoteException
FullyQualifiedErrorId : NativeCommandError
Also executed by adding -p project name -s project name.
still repeating the same error.
Since this folder contains more than one projects and solution I have created a new project and tried the same then the error became below mentioned:
dotnet : Could not execute because the specified command or file was not found.
At line:1 char:1
dotnet ef dbcontext scaffold "server=127.0.0.1:3308;uid=root;pwd=root ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CategoryInfo : NotSpecified: (Could not execu... was not found.:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
Possible reasons for this include:
You misspelled a built-in dotnet command.
You intended to execute a .NET program, but dotnet-ef does not exist.
You intended to run a
global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
I am using Visual Studio 2019. Tried the same in Powershell also. My intention is to implement data base first approach from an already existing MySQL data base using MySQL.Data.EntityframeworkCore
PMC Error for first project
PMC Error for another project

What is my problem while inputting the script in Visual Studio Code

MY NODEMON IS NOT RUNNING. IT IS SHOWING nodemon : File C:\Users\Mahobano\AppData\Roaming\npm\nodemon.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
+ nodemon index.js
+ ~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
IN RESULT WHEN I INPUT nodemon index.js.
Due to security policies running scripts on vs code is disabled by default, and there is a lengthy process to change the policy to enable particular command, however, there is a shorter way to do that. just follow the below instructions:
Go to: C:\Users\Mahobano\AppData\Roaming\npm
Find nodemon.ps1
and delete this file and now nodemon will work on vs code

Powershell script returns exception when using ADSI

I get exceptions when executing a Power shell script (v1.0) on Windows Server 2008 (32 bit).
It uses ADSI for searching a virtual directory before its deletion.
I get the following exception:
Exception calling "Find" with "2" argument(s): "Exception from HRESULT: 0x80005008"
At line:1 char:29
+ $iisMgr.psbase.children.find <<<< ("MyVirtualDir", $iisMgr.psbase.SchemaClassName)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
This is the code:
$vDirPath = "IIS://localhost/W3SVC/1/Root"
$iisMgr = [adsi]$vDirPath
$iisMgr.psbase.children.find("MyVirtualDir", $iisMgr.psbase.SchemaClassName)
(edit): from several blogs I read that the IIS6 Management Compatibility role service must be enabled to get the ADSI provider installed, and I already have it enabled, still having this exception...
Do you try with only one parameter ?
$iisMgr.psbase.children.find("MyVirtualDir")
I dont know there, but I've this kind of COM error when I invoke a method with the bad number of arguments.
JP
Just some ideas:
Do you authenticate when doing ADSI interaction?
I guess you are not making use of the Global Catalog as per your example of $vDirPath. In any case have a peek at See How to Modify Attributes That Replicate to the Global Catalog
Try running your Powershell session with elevated user rights (Right-Click Run As Administrator)