Skip to main content

Posts

Showing posts from November, 2022

Type string undefined is not assignable to type string

Are you getting this error: “ Type string undefined is not assignable to type string “? Yes, you have come to the right place. Today I will show you how to solve this error . The error “ type undefined is not assignable to type string ” occurs when you assign an undefined value when the string is required. To solve this error, use the non-null assertion operator to make sure that the value is a string before the assignment. Here is an example of this error: interface Employee { id: number; name?: string; salary: number;}const emp: Employee = { id: 1, name: 'Ehtisham', salary: 518,};// type string undefined is not assignable to type string// type 'string' is not assignable to type 'number'// type 'undefined' is not assignable to type 'string'const name: string = emp.name; The ‘ name ‘ property is marked as optional ( You can see the “?” with name ) in the interface named ‘ Employee ‘. This means that the property can store ‘ String ‘ and “

Error:0308010c:digital envelope routines::unsupported

Are you getting the error “ error:0308010c:digital envelope routines::unsupported “? Yes, you have come to the right place. Today I will show you how you can solve this error. The “error: error:0308010c:digital envelope routines::unsupported” occurs after Node v17 . Node version 17 and later use OpenSSL version 3.0, which has some breaking changes. [Solved] digital envelope routines::unsupported To resolve this error, when you run the development server, you should set the ‘ NODE_OPTIONS’ to ‘–OpenSSL-legacy-provider.” You should first try these options, Below are the commands to try this solution. # for Windows Git Bash, macOS or Linuxexport NODE_OPTIONS=--openssl-legacy-provider# for Windows Command Prompt (CMD)set NODE_OPTIONS=--openssl-legacy-provider# for Windows PowerShell$env:NODE_OPTIONS="--openssl-legacy-provider"# for Docker (Add this line in your Dockerfile)ENV NODE_OPTIONS="--openssl-legacy-provider" Make sure to execute the correct command according t

Nodemon: Command not found [Fixed]

Are you facing the “ nodemon: command not found ” error? Don’t worry. Today I will show you how to fix this error: “ command not found nodemon .” Fixed: nodemon: command not found The meaning of this error is that the system is not recognizing your “ nodemon ” command. We can solve this problem using two methods. Let’s discuss both in detail. Method 01: command not found: nodemon [solved] You can fix this error by using ‘ npx ‘ with this command. I think you are using commands like this “ nodemon javascript.js “. You can use ‘ npx ‘ with a command like this “ npx nodemon javascript.js “. npx nodemon@latest server.js Method 02: command not found nodemon [fixed] You can solve this error by installing “ nodemon ” globally. You can use this command to install nodemon globally . Solved: JSONDecodeError: Expecting value: line 1 column 1 (char 0) Install nodemon globally #command to install nodemon globally --> npm install -g nodemon [Fixed] Install nodemon globally permissions If you