Explore all Server open source software, libraries, packages, source code, cloud functions and APIs.

Popular New Releases in Server

electron

electron v19.0.0-alpha.4

node

2022-04-19, Version 18.0.0 (Current), @BethGriggs

deno

v1.20.6

angular

v14.0.0-next.14

TypeScript

TypeScript 4.7 Beta

Popular Libraries in Server

JavaGuide

by Snailclimb doticonjavadoticon

star image 110287 doticonApache-2.0

「Java学习+面试指南」一份涵盖大部分 Java 程序员所需要掌握的核心知识。准备 Java 面试,首选 JavaGuide!

electron

by electron doticonc++doticon

star image 101364 doticonMIT

:electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS

30-seconds-of-code

by 30-seconds doticonjavascriptdoticon

star image 92600 doticonCC-BY-4.0

Short JavaScript code snippets for all your development needs

node

by nodejs doticonjavascriptdoticon

star image 86998 doticonNOASSERTION

Node.js JavaScript runtime :sparkles::turtle::rocket::sparkles:

deno

by denoland doticonrustdoticon

star image 81698 doticonMIT

A modern runtime for JavaScript and TypeScript.

angular

by angular doticontypescriptdoticon

star image 80840 doticonMIT

The modern web developer’s platform

TypeScript

by microsoft doticontypescriptdoticon

star image 79882 doticonApache-2.0

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

nodebestpractices

by goldbergyoni doticonjavascriptdoticon

star image 76719 doticonCC-BY-SA-4.0

:white_check_mark: The Node.js best practices list (March 2022)

laravel

by laravel doticonphpdoticon

star image 69346 doticon

Laravel is a web application framework with expressive, elegant syntax. We’ve already laid the foundation for your next big idea — freeing you to create without sweating the small things.

Trending New libraries in Server

zx

by google doticonjavascriptdoticon

star image 30481 doticonApache-2.0

A tool for writing better scripts

fiber

by gofiber doticongodoticon

star image 19407 doticonMIT

⚡️ Express inspired web framework written in Go

dogehouse

by benawad doticontypescriptdoticon

star image 9175 doticonMIT

Taking voice conversations to the moon 🚀

htmx

by bigskysoftware doticonjavascriptdoticon

star image 5943 doticonBSD-2-Clause

</> htmx - high power tools for HTML

go-admin

by go-admin-team doticongodoticon

star image 5884 doticonMIT

基于Gin + Vue + Element UI的前后端分离权限管理系统脚手架(包含了:多租户的支持,基础用户管理功能,jwt鉴权,代码生成器,RBAC资源控制,表单构建,定时任务等)3分钟构建自己的中后台项目;文档:https://doc.go-admin.dev Demo: https://www.go-admin.dev Antd beta版本:https://preview.go-admin.dev

Bili.Uwp

by Richasy doticoncsharpdoticon

star image 4927 doticonMIT

适用于新系统UI的哔哩

SteamTools

by SteamTools-Team doticoncsharpdoticon

star image 4384 doticonGPL-3.0

🛠「Steam++」是一个包含多种Steam工具功能的工具箱。

1loc

by phuoc-ng doticontypescriptdoticon

star image 4176 doticonMIT

What's your favorite JavaScript single LOC (line of code)?

aleph.js

by alephjs doticontypescriptdoticon

star image 3932 doticonMIT

The Full-stack Framework in Deno.

Top Authors in Server

1

Apress

226 Libraries

star icon2892

2

jonschlinkert

219 Libraries

star icon4063

3

sindresorhus

184 Libraries

star icon36300

4

microsoft

157 Libraries

star icon123166

5

PacktPublishing

129 Libraries

star icon3091

6

symfony

113 Libraries

star icon177734

7

mafintosh

101 Libraries

star icon6817

8

substack

94 Libraries

star icon31056

9

vaadin

86 Libraries

star icon5284

10

googlearchive

82 Libraries

star icon7166

1

226 Libraries

star icon2892

2

219 Libraries

star icon4063

3

184 Libraries

star icon36300

4

157 Libraries

star icon123166

5

129 Libraries

star icon3091

6

113 Libraries

star icon177734

7

101 Libraries

star icon6817

8

94 Libraries

star icon31056

9

86 Libraries

star icon5284

10

82 Libraries

star icon7166

Trending Kits in Server


Node.js is a flexible and lightweight platform that allows developers to build fast and scalable applications that work brilliantly in real-time. Its event-driven, non-blocking I/O model makes it highly efficient for data-intensive applications that need to run across multiple devices. Ecommerce applications often run on Node payment processing software components. These components work towards ensuring the integration of payment gateways, thereby enabling multiple payment options and risk-free authentication. Some of these payment processing platforms may include PayPal, Apple Pay, Google Pay, UnionPay, and similar applications. JavaScript’s dynamic and flexible environment ensures that every payment system runs smoothly and efficiently in real-time. Here are our picks of the 15 best JavaScript Node.js payment processing libraries that are open source in 2022. expressCart - fully functioning Node.js shopping cart; stripe-node - Node.js library for the Stripe API; stripe-billing-typographic - Typographic is a complete, full-stack example of a Stripe Billing integration.

PHP is a popular open-source programming language that is widely used for developing web applications. It helps developers to create dynamic content for websites and mobile apps. PHP Testing is one of the most important parts of PHP development. It allows you to test your code, check the performance of your product, and find bugs. The best PHP testing tools allow developers to run tests in a simple way, from unit tests to functional testing. To make your life easier, we’ve prepared a list of 7 best PHP Testing Open Source libraries in 2022 in our kit, laravel-generator - CRUD Laravel Generator; php-quickcheck - generative testing for PHP; phpunit-skeleton-generator - generate skeleton test classes from production code classes.

NFT's or Non Fungible Token's are a new technology phenomenon allowing clear ownership and easy transferability of digital art. This property means each token is unique and cannot be swapped identically for another token ever. NFT can be most anything digital, such as art, images, videos, music, memes, and tweets. The process of creating NFTs is “minting”, similar in concept to metal coins that are minted (stamped) to confirm their legitimacy. Minting an NFT produces a one-of-a-kind token on the blockchain and an electronic certificate of authenticity. NFT Marketplace for Images is used to generate the cryptoboy using the NFT, Blockchain, Cryptocurrency. The generated cryptoboy can be sold and they can see who is the token owner and also token metadata.

Training and Certification - NFT Marketplace for Images

Watch this self-guided tutorial on NFT Marketplace for Images. This includes an understanding of Metamask; a chrome extension used as a crypto wallet, Ganache-Truffle Suite a personal Ethereum Blockchain for distributed application development to build your own NFT Marketplace for CryptoBoy Images Completed the training? Apply for your Participation Certificate and Achievement Certificate now! Tag us on social media with a screenshot or video of your working application for a chance to be featured as an Open Source Champion and get a verified badge.

Installation Guide

⬇️Download, extract and double-click kit installer file to install the kit. Note: Do ensure to extract the zip file before running it.

Development Environment

VSCode is used for development and debugging. Node.js is an open-source, cross-platform, JavaScript runtime environment. It executes JavaScript code outside of a browser, whereas VSCode is used to get a typical experience of IDE for developers.

Tools

To make a Crypto boy you need to install truffle, Ganache CLI, npm, Metamask. Truffle framework is used as a testing framework and asset pipeline for blockchains using the Ethereum Virtual Machine (EVM). Ganache-CLI is the latest version of TestRPC and a fast and customizable blockchain emulator. npm is the default package manager for the JavaScript runtime environment Node.js. MetaMask is a software cryptocurrency wallet used to interact with the Ethereum blockchain.

Support

If you need help to use this kit, you can email us at kandi.support@openweaver.com or direct message us on Twitter Message Message @OpenWeaverInc.


Social-analyzer is used to analyze and find a person's profile across +1000 social media or websites. It includes detection modules and different analyses, and you can choose which modules to use during the investigation process.

Development Environment

VSCode is used for development and debugging. Node.js is an open-source, cross-platform, JavaScript runtime environment. It executes JavaScript code outside of a browser, whereas VSCode is used to get a typical experience of IDE for developers. npm is the default package manager for the JavaScript runtime environment Node.js.

Development Tools

The CLI (or npm client) is a tool installed on a developer’s machine that allows you to publish packages, install packages, and update packages.Node-gyp is a cross-platform command-line tool written in Node.js for compiling native addon modules for Node.js.

Support

If you need help to use this kit, you can email us at kandi.support@openweaver.com or direct message us on Twitter Message @OpenWeaverInc .

kandi 1-Click Install

It creates a tf-idf matrix from a corpus of text. Tf-idf (term frequency-inverse document frequency) is a numerical statistic intended to reflect how important a word is to a document in a corpus.


The applications involve working with text data, such as text classification, text clustering, text retrieval, and text summarization. In these applications, the tf-idf values can be used as features for machine learning algorithms or as a representation of the text data for other purposes. Tf-idf is a commonly used technique in text analysis and information retrieval, as it provides a numerical representation of the importance of each word in each document.


  • TfidfVectorizer: This class implements the tf-idf (term frequency-inverse document frequency) method for text feature extraction. It is used to convert a collection of raw documents to a matrix of tf-idf values, which can then be used as features for machine learning algorithms.
  • CountVectorizer: This class implements a tokenizing and counting method for text feature extraction. It is used to convert a collection of raw documents to a matrix of token counts, which can be used as features for machine learning algorithms.
  • normalize: This function is used to normalize a matrix, typically by dividing each row by the sum of its elements


The TfidfVectorizer and CountVectorizer classes and the normalize function are useful in natural language processing (NLP) and text analysis. They are part of the scikit-learn library, a widely used machine-learning library in Python.  

Preview of the output that you will get on running this code from your IDE

Code

In this solution we have used TfidfVectorizer .

  1. Copy the code using the "Copy" button above, and paste it in a Python file in your IDE.
  2. Run the file to get the output


I hope you found this useful. I have added the link to dependent libraries, version information in the following sections.


I found this code snippet by searching for "Check the tf-idf scores of sklearn in python" in kandi. You can try any such use case!

Environment Tested

I tested this solution in the following versions. Be mindful of changes when working with other versions.


  1. The solution is created in Python 3.7.15 version
  2. The solution is tested on scikit-learn 1.0.2 version


Using this solution, we are able calculate the TF-IDF values using Scikit learn library in Python with simple steps. This process also facilities an easy to use, hassle free method to create a hands-on working version of code which would help calculate the TF-IDF values using sklearn in Python.

Dependent Library

If you do not have Scikit-learn and pandas that is required to run this code, you can install it by clicking on the above link and copying the pip Install command from the Scikit-learn page in kandi.

You can search for any dependent library on kandi like Scikit-learn , Pandas

Support

  1. For any support on kandi solution kits, please use the chat
  2. For further learning resources, visit the Open Weaver Community learning page.


A contour plot is a type of data visualization. It represents 3D data in a 2D space using contour lines or filled color regions. It is used in data analysis. It displays the variation and patterns of a continuous variable over a 2D domain. It represents different levels of the variable through contour lines or filled regions. It is where each line or region corresponds to a specific value.  

 

The contour lines connect points with equal values. It helps create smooth curves that follow the shape of the underlying data. The spacing between the lines indicates the variable's rate of change or gradient. It visually represents the data, revealing patterns and interest regions.  

 

It is useful in Topographic Analysis, Heatmaps, Data Interpolation, Optimization, and Decision-Making. They help analyze patterns, relationships, and variations in continuous variables. It makes them valuable for data exploration, scientific analysis, and decision-making. It can be plotted using a contour plot, including numeric and categorical data.  

 

Contour plots are most employed with numeric data. It is where the variable of interest is continuous and can take any numeric value. While contour plots are designed for numeric data, there are adaptations. It allows the visualization of categorical data as well. One approach is to use a contour or heatmap to represent categorical data on a 2D grid. Categorical data can include use types, species distribution, or customer segments.  

 

Contour plots help identify regions with high or low occurrences of specific categories. It reveals spatial patterns and highlights areas of interest. In Matplotlib, there are several contour plots that you can create to visualize your data. These include simple contour plots, smooth contour plots, and filled contour plots. When customizing this plot, various parameters help achieve the appearance.  

 

You can customize Line Style, Contour Interval, Color Map, Colorbar, Labels, and Titles. There are extra parameters for controlling colors, colorbar formatting, shading, transparency, and more. By experimenting with these parameters, you can tailor the contour plot. It suits your specific requirements and achieves the desired visual representation.  

 

In conclusion, contour plots are a powerful data visualization tool. It analyzes and interprets patterns in two-dimensional data. They help identify trends, variations, and relationships within continuous numeric data. It can also be adapted for representing categorical data.  

 

By connecting points of equal value, it provides a visual representation. It facilitates data analysis and decision-making. The contour plots help showcase the spatial distribution of a variable. It captures intricate patterns and gradients.  


Here is an example of creating contour plots with contour lines and levels.



Fig1: Preview of the output when the code is run in IDE.

Code


In this solution, we're creating contour plot with contour lines and levels.

Instructions

Follow the steps carefully to get the output easily.

  1. Install Jupyter Notebook on your computer.
  2. Open the terminal and install the required libraries with the following commands.
  3. Install Numpy - pip install numpy
  4. Install matplotlib - pip install matplotlib
  5. Copy the snippet using the 'copy' button and paste it into that file.
  6. Remove the 'n' present in line number 6 to avoid any errors.
  7. Run the file using run button.


I hope you found this useful. I have added the link to dependent libraries, and version information in the following sections.


I found this code snippet by searching for "Errors while making counter plot with contourf and levels" in kandi. You can try any such use case!

Dependent Libraries

You can also search for any dependent libraries on kandi like "matplotlib / numpy"

Environment Tested


I tested this solution in the following versions. Be mindful of changes when working with other versions.

  1. The solution is created in Python3.9.6.
  2. The solution is tested on numpy 1.21.5 version.
  3. The solution is tested on matplotlib 3.5.2 version.


Using this solution, we are able to create contour plot with contour lines and levels.


This process also facilities an easy to use, hassle free method to create a hands-on working version of code which would help us to create contour plot with contour lines and levels.

Support


  1. For any support on kandi solution kits, please use the chat
  2. For further learning resources, visit the Open Weaver Community learning page.

FAQ:  

1. What are filled contour plots, and how can they be used in matplotlib?  

Filled contour plots are also known as filled contour or heatmaps. They are a variation of contour plots where the regions between lines are filled with colors. It represents the magnitude or density of the underlying data. They provide a visual representation of the variable distribution across a 2D domain. Filled contour plots are useful for various applications, including:  

  • Visualizing density or concentration of phenomena. It includes population density, pollutant levels, or crop yields across a geographical region.  
  • Representing spatial data, such as elevation, temperature, or precipitation, on a map.  
  • Analyzing scientific data, such as contouring meteorological measurements, experimental results, or simulation outputs.  


2. How is a surface plot different from a three-dimensional graph?  

A surface plot is also known as a 3D surface plot or a 3D plot. It visualizes a continuous surface in a three-dimensional space. It represents the relationship between three continuous variables. They can be two independent variables on the x and y-axis and dependent on the z-axis. The surface plot displays the surface's shape, curvature, and variations. It helps in the visualization of complex three-dimensional relationships.  

 

But a 3D graph is also called a 3D or a 3D scatter plot. It represents data points in a three-dimensional space. It visualizes the relationship between three variables. It is where each data point is defined by its values along the x, y, and z axes. Unlike a surface plot, a 3D graph presents individual data points in space. It allows for the examination of their positions and patterns.  

 

3. How do I create a color map on my contour plot using matplotlib?  

In Matplotlib, you can create a color map using the contourf() function and a specified color map. Here's a step-by-step guide on how to achieve this:  

  • Import the necessary libraries.  
  • Generate the data for the contour plot.  
  • Create the contour plot with a color map.  
  • Add a color bar.  
  • Customize the plot (optional).  
  • Display or save the plot.  

 

4. What kind of data should be plotted along the vertical axis of a contour plot?  

In a contour plot, the vertical axis represents a continuous or a response variable. It is being analyzed or predicted. The choice of data to be plotted along the vertical axis. It depends on the nature of the problem, or the type of data being analyzed. Here are a few examples of the types of data plotted along the vertical axis in contour plots:  

  • Elevation or Height  
  • Time or Date  
  • Response or Dependent Variable  
  • Concentration or Intensity  

 

5. How can I customize the color scale for my contour plot in matplotlib?  

You can customize the color scale by adjusting the color map to map the variable values to colors. Here are some ways to customize the color scale:  

  • Choosing a Built-in Color Map  
  • Creating a Custom Color Map  
  • Controlling the Color Range 

Here are some of the famous NodeJs Math Libraries. Some use cases of NodeJs Math Libraries include Scientific Computing, Data Analysis, Statistical Analysis, and Machine Learning.

 

Node.js math libraries refer to libraries that provide mathematical functions and utilities for Node.js applications. These libraries can perform calculations, create graphs, and more. Some of these libraries include mathjs, math-expression-evaluator, math-expression-parser, and mathjs-expression-parser.  


Let us look at the libraries in detail below. 

Math.js 

  • Library that covers a wide range of topics from basic arithmetic to advanced calculus.  
  • Provides intuitive syntax for expressing mathematical expressions.  
  • Offers various functions for performing mathematical operations, including linear algebra, calculus, and statistical operations.

JStat 

  • Faster and easier to understand and use than other math libraries written in other languages. 
  • Well-documented and provides helpful examples. 
  • Open-source, developers can contribute and extend the library to their own needs.  

Numeral-js 

  • Optimized for modern JavaScript runtimes. 
  • Built on top of the popular math.js library, providing an easy transition from other math libraries.  
  • Supports multiple precision types, including BigInt, BigDecimal, and Number.  

stdlib 

  • More than just lines of code are needed to create a wide range of mathematical algorithms.   
  • Provides basic and advanced operations.  
  • Is designed to provide high-performance calculations, making it ideal for applications requiring fast results.   

fcal 

  • Offer optimized functions and vector operations.  
  • Offers comprehensive linear algebra support, including matrix operations and advanced numerical algorithms.  
  • Offers support for complex numbers and quaternions. 

clumsy 

  • Written in pure JavaScript and is not dependent on any external libraries.  
  • Allows the creation of custom-made mathematical equations that can be used in the code.  
  • Allows incorporation of numerical integration and optimization. 

KaTex 

  • Is faster than other nodejs math libraries, with its rendering time around 10ms. 
  • Reliable than other nodejs math libraries, as it is more robust and provides more consistent results. 
  • Better typography for mathematical expressions than other nodejs math libraries. 

prime-num 

  • Only the Node.js library offers a fast and simple prime number generation algorithm.  
  • Well-tested and reliable, and accurate   
  • A built-in caching system that allows for quick lookups of previously generated prime numbers. 

primeupto 

  • Has an extensive test suite that ensures that results are accurate.  
  • Functions for generating prime numbers up to a specific limit and detecting prime numbers.   
  • Supports both synchronous and asynchronous calculations. 

Math-PKG 

  • Written in pure JavaScript and designed to perform Mathematical operations efficiently.   
  • Powerful API for developers to create their own custom functions.  
  • Compatible with the latest version of Node.js and can be used with other popular frameworks. 

Here are some famous NodeJs Telegram Bot Libraries. Some of the use cases of NodeJs Telegram Bot Libraries include automating customer service, creating interactive experiences, automating workflow, and creating analytics dashboards.

 

Node.js Telegram Bot Libraries are libraries written in JavaScript that can be used to create custom Telegram bots. They provide a convenient way to write code that interacts with the Telegram Bot API, allowing developers to quickly create and deploy bots that can listen for commands, respond to messages, and perform other tasks.


Let us look at the libraries in detail below.

node-telegram-bot-api

  • Has built-in support for multiple programming languages.
  • Comprehensive API documentation.
  • Automated message queueing system.

nlp.js

  • Offers an advanced Natural Language Processing (NLP) engine.
  • Highly modular and customizable.
  • Built on the Node.js platform, so it is lightweight and fast.

telebot 

  • Provides an all-in-one solution for creating, managing, and deploying Telegram bots. 
  • Supports inline query and inline keyboard. 
  • Provides a unified API for all Telegram API endpoints. 

LiveBot 

  • Offers a powerful webhook system. 
  • Has a built-in analytics system. 
  • Allows developers to easily deploy and manage bots on popular hosting services. 

telegram-bot-api 

  • You do not need to know any programming language to get started. 
  • Makes it easier to build bots that can react quickly to incoming messages. 
  • Wide range of API methods for creating bots and interacting with users. 

telegram-client 

  • You can quickly get a bot up and running with minimal effort. 
  • With a built-in command processor. 
  • Used to send out mass messages or schedule messages to be sent at specific times.

teleapi 

  • Provides an easy way to create and manage multiple bots using a single interface. 
  • Offers an intuitive GUI for quickly setting up your bots and customizing their behavior. 
  • Lightweight and simple library that lets you quickly and easily build bots. 

BocchiBot 

  • Modern and extendable architecture. 
  • Extensive library of custom plugins. 
  • Integrated analytics system. 

instauto 

  • Includes an easy-to-use query builder. 
  • Provides an easy and secure authentication process for users. 
  • Provides unique methods such as the getStarted method which can be used to quickly set up the bot and get started. 

mtproto-core 

  • Supports the full MTProto protocol, which is a binary protocol developed by Telegram. 
  • Designed for both client and server sides, allowing developers to use the same library for both sides of the connection. 
  • Designed to be highly performant, allowing for fast and efficient communication between the bot and Telegram servers. 

Here are some famous NodeJs Redis Libraries. Some use cases of NodeJs Redis Libraries include Caching, Session Management, Real-time Analytics, Queuing, and Leaderboards.  


Node.js Redis libraries are the programming interfaces that enable developers to easily access the features of the Redis data structure store from a Node.js application. These libraries can be used for various tasks such as caching, session management, user authentication, and message queuing.  


Let us look at the libraries in detail below. 

redis-node-client 

  • A fast and lightweight binary protocol for data communication is optimized for high performance.  
  • Simple to use and allows you to get up and running with Redis quickly.   
  • Provides built-in support for cluster management and auto-failover. 

ioredis 

  • Supports connection pooling out of the box 
  • Supports all of Redis' advanced features, such as clustering, transactions, and Lua scripting.  
  • Well-tested and backed by a large community of contributors. 

node-Redis 

  • A comprehensive set of monitoring and debugging tools.  
  • Supports a wide range of commands for interacting with Redis. 
  • Well-maintained and actively developed.  

denque 

  • Thread-safe and supports both synchronous and asynchronous operations.  
  • Supports advanced features such as transactions and Lua scripting.  
  • Great documentation and a helpful community of developers. 

Taskco 

  • Supports a wide range of data types, including strings, hashes, lists, sets, and sorted sets. 
  • Robust and reliable fault tolerance system.  
  • Designed to be highly scalable. 

redis-json 

  • Requires minimal configuration and provides efficient data storage and retrieval.  
  • Highly scalable and can handle large data volumes without any performance degradation. 
  • Robust authentication and authorization mechanism. 

crud-bones 

  • Designed to be straightforward and unopinionated.  
  • Fast and reliable, as it is written in pure JavaScript. 
  • Provides a convenient way to monitor the performance of Redis operations. 

cacheman-redis 

  • Handle thousands of requests in the same amount of time as other libraries.  
  • Provides automatic connection pooling, which means it can handle large amounts of concurrent connections without managing them manually.   
  • Provides support for optional serialization and deserialization. 

connect-redis 

  • Supports Redis Cluster, allowing for distributed session storage across multiple Redis nodes. 
  • Optimized for speed and throughput. 
  • Supports various types of data storage, including JSON, strings, and hashes.  

redis-queue 

  • Offers a clear separation between the application and the queue code. 
  • Reliable allows tasks to be queued up and processed reliably and predictably. 
  • Provides an API for handling job errors. 

redis-stream 

  • Supports data structures such as lists, sets, and hashes. 
  • Provides an efficient pub/sub messaging system, enabling communication between multiple instances of Redis.  
  • Optimized for low latency, making it suitable for real-time applications. 

Here are some famous NodeJS UUID Libraries. Some of the use cases of NodeJS UUID Libraries include Generating unique IDs for authentication tokens, Generating IDs for distributed databases, Generating IDs for files, and Generating IDs for API requests.


Node.js UUID libraries are libraries created for the Node.js platform that allow developers to generate Universally Unique Identifiers (UUIDs). UUIDs are used to identify objects or records, and are generated in a way that ensures they are unique across all environments and databases. These libraries make it easy to generate UUIDs in Node.js applications.


Let us look at these libraries in detail.

nanoid

  • Uses a smaller alphabet and length than other UUID libraries.
  • Built-in random generator that is cryptographically secure.
  • Simple to use, requiring only one line of code to generate an ID.

cuid

  • Ideal for applications that need to store or transfer smaller amounts of data.
  • Extremely low chance of collision due to its use of a combination of characters, numbers, and symbols.
  • optimized for performance, making it faster than other uuid libraries.

uuid-js

  • Lightweight JavaScript library which makes it easy to generate UUIDs from within a browser.
  • Uses a cryptographically secure random number generator to generate UUIDs.
  • Provides functions for converting UUIDs to strings and vice versa.

js-shortid

  • Creates short, non-sequential, URL-friendly IDs.
  • Lightweight, and has no dependencies.
  • aster than UUID libraries and can generate up to 1 million unique IDs per second.

uuid-mongodb

  • Enables developers to generate and use MongoDB’s ObjectIds as UUIDs.
  • Provides a range of options for generating UUIDs.
  • supports custom UUIDs, allowing developers to specify exactly what type of UUID.

uuid

  • Able to generate cryptographically secure random UUIDs.
  • Useful when creating a unique identifier for a user or other sensitive data.
  • Supports the generation of v4, v5 and v6 UUIDs.

instauuid

  • Designed to be more efficient and faster than other Node.js UUID libraries.
  • Supports the generation of multiple UUIDs in parallel.
  • Offers the ability to create and manage a database of UUIDs.

Here are some of the famous Nodejs WhatsApp API Libraries. These Libraries are used for Creating interactive bots, Creating chatbots, Sending automated messages, and Integrating with other applications.


Node.js WhatsApp API Libraries are libraries that allow developers to create applications and services that interact with the WhatsApp messaging service. These libraries provide access to the WhatsApp API, allowing developers to create custom tools and applications that communicate with WhatsApp users. These libraries can be used to build bots, create custom chat experiences, and more.


Let us look at these libraries in detail below.

whatsapp-web.js

  • Auto-detection of incoming messages, allowing developers to respond quickly.
  • Built-in media upload and download support.
  • Built-in webhooks for automated responses.

Chat-API

  • Allows developers to build applications that integrate with multiple messaging platforms.
  • Provides support for multi-user chat rooms.
  • Allows developers to receive notifications whenever messages are sent or received.

sulla

  • Offers a wide range of analytics and reporting capabilities.
  • Integrates with other third-party services, such as Slack.
  • Powerful set of APIs for automating the WhatsApp messaging experience.

whats2api

  • Full control over incoming messages.
  • Event-driven notifications.
  • Flexible API calls and built-in security features.

whatsapi

  • Highly secure and provides end-to-end encryptions for all messages sent and received.
  • Provides a comprehensive set of features for managing contacts, groups, and conversations.
  • Allows developers to access and control the WhatsApp API directly from their applications.

wasapbot

  • Easy-to-use platform that allows you to quickly build a WhatsApp bot without the need to write any code.
  • Provides a user-friendly interface with a drag-and-drop editor to create sophisticated chatbots.
  • Handle complex conversations and can work with multiple users at the same time.

whatbot

  • Allows users to customize their conversations using a variety of built-in templates.
  • Provides an intuitive interface to set up automated messages and bot responses.
  • Ability to process incoming messages, and send and receive images and videos etc.

Here are some of the famous JavaScript ChatGPT Libraries. Some JavaScript ChatGPT Libraries' use cases include Live Chat Support, Online Shopping, Educational Platforms, Healthcare, and Banking.  


Javascript chatgpt libraries are collections of code that provide developers with tools for creating and deploying chatgpt applications. They are designed to simplify the development and deployment of a chatbot, making it easier for developers to create a conversational interface that can provide a robust user experience. These libraries offer a variety of components and features, such as natural language processing, dialog management, text-to-speech and speech-to-text, and AI-based decision-making.  


Let us have a look at the libraries in detail. 

pusher-js

  • Provides real-time communication.
  • Pusher-js will reconnect the user to the chat room if the connection is somehow lost. 
  • Supports multiple platforms, including JavaScript, iOS, Android, Ruby, and Python.

cometchat-pro-react-sample-app

  • Supports group messaging, allowing users to create and join group conversations.
  • Built-in moderation system that allows admins to control conversations and enforce rules.
  • End-to-end encryption ensures that all conversations are private. 

ChatKit

  • Provides synchronized user data across multiple clients, allowing for a more seamless chat experience.
  • Built-in support for native push notifications.
  • Built-in support for bots, making it easier to automate conversations.

LiveChat

  • Integrates with various external services, such as CRM tools, helpdesks, and more. 
  • Offers automation tools to help agents respond faster to customer queries.
  • Provides analytics and reporting features to help agents understand their customer base.

SimpleWebRTC

  • Designed to be highly scalable, allowing large numbers of users to connect at once.  
  • Provides video and audio support, making communicating with friends and family easier.  
  • Requires no servers and very little code, allowing for a quick and easy setup. 

pubnub-api

  • Provides several advanced features, including message history, presence detection, file streaming, and more.
  • Provides global coverage for its APIs.
  • Provides the ability to send and receive messages in real time. 

RTCMultiConnection

  • Offers a customizable UI, allowing developers to create a unique look and feel for their applications.
  • Secure and scalable library with support for WebSockets, WebRTC, and third-party APIs. 
  • Supports data streaming, file sharing, text chat, voice and video conferencing, and screen sharing.

kuzzle

  • Built to scale to millions of concurrent users and devices.
  • Secure, distributed, and highly available data storage layer.
  • Advanced search and analytics capabilities.

JavaScript audio player libraries support many formats, like MP3, WAV, and OGG. This versatility ensures compatibility across various browsers and devices. It allows developers to provide their users with a seamless audio playback experience.  


These libraries offer an array of features for audio playback. The features include playback speed adjustment, looping capabilities, and volume control. These features empower developers to create interactive and customized audio player interfaces.  


Following best practices for playing audio files is important when using this library. They help Understand the code and library configuration and implement error handling to ensure smooth playback. Customization options can enhance and integrate the player's appearance into the design.  

We can use JavaScript audio player libraries in various web development scenarios. We can employ it in creating audio players for websites, allowing users to play and control. Furthermore, we can leverage it to develop more complex audio player applications. It helps with applications like music streaming platforms or interactive web games.  


We recommend selecting audio files to make the most of a JavaScript audio player library. We should choose the optimized ones for playback, balancing size, and audio quality. Additionally, integrating the library can expand its capabilities. It provides a more robust audio player solution.  

When writing about these libraries, we must cover their historical significance. We should cover its ability to play audio files, features, and customization options. We should understand their versatility in scenarios and the benefits of integrating them.  


JavaScript audio player libraries provide seamless audio playback, enabling interactive features. It supports its versatility, browser compatibility, and extensive feature aim to deliver high-quality audio experiences. It helps in enhancing user engagement.  

howler.js:  

  • This library helps in creating interactive audio players in JavaScript.  
  • It supports playing and pausing audio and controlling volume. It supports seeking specific positions and handling audio events.  
  • It provides a robust foundation for building custom audio player interfaces.  

plyr:  

  • This library is a versatile media player that supports audio and video playback.  
  • It supports play/pause, seeking, volume control, and fullscreen mode. It provides a complete solution for media playback.  
  • It helps in creating customizable audio players with a sleek and modern interface.  

Tone.js:  

  • This library focuses on audio synthesis and processing in JavaScript.  
  • It helps create dynamic and interactive audio players. It helps make it suitable for music composition, sound design, and game development.  
  • It supports various audio effects, MIDI integration, and precise timing control.  

wavesurfer.js:  

  • This library supports audio waveform visualization and playback in JavaScript.  
  • It helps create audio players with waveform displays. It allows visualization and interaction with the audio.  
  • It supports features like zooming, scrolling, and highlighting specific waveform sections. It helps in enhancing the user experience.  

SoundJS:  

  • This library is part of the CreateJS suite. It provides a powerful audio playback solution for web applications.  
  • It supports audio preloading and playback control. It also supports HTML5 audio elements and Web Audio API integration.  
  • It helps create interactive players with audio playback and synchronization across many sounds.

jPlayer:  

  • This library provides a versatile audio player solution for HTML and JavaScript.  
  • It helps in creating cross-browser-compatible audio players with customizable skins and themes. 
  • It supports various formats, playlist management, and repeat, shuffle, and volume control features. It helps in catering to different audio playback requirements.  

react-soundplayer:

  • This library is specifically designed for building audio players in React applications.  
  • It supports features like play/pause, volume control, and seeking. It provides a user-friendly interface for audio playback.  
  • It integrates well with React's component-based architecture. It supports customization through props and callbacks.  

buzz:  

  • This lightweight audio library helps in simple audio playback scenarios.  
  • It supports audio player features like play, pause, volume control, and event handling.  
  • It is easy to use, making it suitable for audio players without complex customization.  

FAQ 

1. What is the most beautiful HTML5 music player?  

The beauty of an HTML5 music player is subjective. It can vary based on personal preferences and design choices. The choice depends on the UI design, animations, color schemes, and aesthetics. Many visually appealing HTML5 music player implementations are available.  

  

2. How does JavaScript Audio Player work in modern browsers?  

JavaScript Audio Player leverages the capabilities through the Web Audio API & HTML5 element. In modern browsers, these APIs provide a robust foundation for audio playback. It allows developers to control playback and adjust the volume. It helps handle events and apply audio effects and filters.  

  

3. What are the features of a custom audio player library?  

Custom audio player libraries offer various features to enhance the audio playback experience. These features include play/pause, next/previous track navigation, and volume control. It includes seeking within the audio, looping, and playlist management. It includes visualization effects, equalizer settings, and integration with other media platforms.  

  

4. How lightweight is the JavaScript library for creating an HTML5 audio/video player?  

JavaScript libraries for creating HTML5 audio/video players prioritize lightweight implementations. They design these libraries to minimize file size and external dependencies. It helps ensure optimal performance and fast loading times. It results in efficient and streamlined code that does not add unnecessary bloat to the web page.  

  

5. Are specific playback controls necessary to create an HTML5 video player?  

HTML5 video players need specific playback controls to provide a seamless user experience. Common controls include play or pause buttons, volume controls, and progress bars. It also includes fullscreen mode and options for adjusting playback speed. We can customize the controls and their appearance based on the needs and design.  

  

6. Can modern browsers handle a play button that triggers audio content on requests?  

Modern browsers can handle a play button that triggers audio content on requests. JavaScript code can initiate the playback when the user interacts with a play button. We can do so by playing the <audio> element or creating and playing audio using the Web Audio API. Modern browsers support such interactions, ensuring a smooth and responsive audio playback experience. 

Here are some of the famous NodeJs Accounting Libraries. Some use cases of NodeJs Accounting Libraries include Financial Reporting and Auditing, Tax Compliance, Bookkeeping, Invoicing, Budgeting, and Forecasting.  

Node.js accounting libraries are collections of code that allow developers to use Node.js to access and manipulate accounting data. These libraries can be used to create accounting applications and tools and can be used to integrate accounting data into other Node.js applications.  

Let us look at the libraries in detail below. 

ledger-js  

  • Highly secure and provides a solid foundation for developing accounting applications. 
  • Fast and efficient, reducing the time needed to develop applications. 
  • Well documented and provides detailed instructions for implementing its features. 

accounting.js 

  • Simple API that makes it easy to implement into any application.  
  • Supports double-entry accounting. 
  • Supports both single- and double-entry ledgers .

TeslaJs 

  • Intuitive, user-friendly library. 
  • Secure encryption and authentication to protect your data from unauthorized access.  
  • Designed to scale to meet the needs of large organizations with complex accounting needs.  

node-sparkpost 

  • High-performance API for sending emails. 
  • Easy to use and integrate into existing Node.js applications.  
  • Allows you to test different designs and content to see which works best. 

money.js 

  • Provides a powerful, intuitive API for performing complex financial calculations with ease. 
  • Supports multiple currencies, including Bitcoin. 
  • Correct rounding and exchange rates for accurate calculations.  

telegraf 

  • Provides a wide range of features such as data validation, auditing, tracking, and reporting.  
  • Supports multiple databases and also offers a wide range of payment gateways.  
  • Constantly updated to ensure the best performance.  

node 

  • Easy to learn, and its syntax is similar to JavaScript.  
  • Used to create real-time web applications with push capabilities.  
  • Offers a large library of modules and components. 

Numeral-js 

  • Lightweight and fast library.  
  • Support for a wide variety of mathematical functions. 
  • Can be integrated with existing Node.js applications.  

Here are some of the famous NodeJs VPN Libraries. Some of the use cases of NodeJs VPN Libraries include: 

  • Securely accessing a private network over the internet. 
  • Creating a virtual private network (VPN). 
  • Bypassing internet censorship. 
  • Securing data in transit.  

Node.js VPN libraries enable developers to create applications that use a virtual private network (VPN). These libraries provide functions for connecting to a VPN server, establishing secure tunnels, encrypting and decrypting data, and managing the connection. They can be used to create applications such as secure file sharing, remote access, and encrypted communication.  

Let us look at the libraries in detail below. 

node-vpn

  • Easy-to-use API that makes it simple to set up and manage a secure VPN connection.  
  • Highly secure, utilizing strong encryption algorithms and offering secure tunneling protocols. 
  • Supports multiple platforms, including Windows, Mac, Linux, iOS, and Android.  

Strong-VPN 

  • Supports a wide range of protocols, including OpenVPN, IKEv2, and SSTP. 
  • Fast and reliable server connections. 
  • Compatible with most major operating systems, including Windows, macOS, iOS, Android, and Linux.  

node-openvpn 

  • Highly secure, as it uses the OpenVPN protocol. 
  • Highly configurable, allowing users to customize the setup for their specific needs.   
  • Supports both IPv4 and IPv6 addressing. 

fried-fame 

  • Easy to get started quickly compared to other VPN libraries.  
  • Designed with security in mind, using the latest encryption algorithms and techniques. 
  • An open-source project, so anyone can contribute and benefit from the development.   

vpngate 

  • Offers an extra security layer for your data and connection.  
  • Offers longer connection times and faster speeds than other nodejs VPN libraries.  
  • Reliable, as it is regularly updated with the latest security protocols. 

expressvpn 

  • Offers unrestricted access to streaming services, social media, and websites.  
  • Features a kill switch and other advanced features to protect your data. 
  • Offers a 30-day money-back guarantee. 

algo 

  • Allows you to customize different VPN profiles for different devices or locations.  
  • Is designed to leverage strong encryption algorithms and secure authentication methods.  
  • Allows you to choose which ports and protocols are used for your VPN connection.  

strongswan 

  • More secure than other nodejs vpn libraries. 
  • Tested and audited by independent experts, and is used by many organizations.  
  • Easy to set up and configure, and can be used on multiple operating systems and devices. 

Here are some famous Python Data Caching Libraries. Some of the Python Data Caching Libraries' use cases include Pre-computing expensive calculations, Caching API responses, Data warehouse optimization, Caching web pages.


Python data caching libraries are software libraries that provide a way to store and quickly access data temporarily. Caching libraries can be used to store the results of expensive operations such as database queries or remote API calls so that they can be reused more quickly later. This can improve the performance of a program by reducing the time spent waiting on slow operations.


Let us have a look at some of the Python Data Caching Libraries in detail.

redis-py

  • Provides a robust set of data structures for caching and managing data.
  • Provides a high-performance server-side cache for Python applications.
  • Offers built-in support for transactions and atomic operations

django-cacheops

  • Automatically invalidates caches when the underlying models are changed.
  • Seamlessly integrates with the Django ORM, allowing for easy integration of caching into existing Django applications.
  • Allows for custom caching rules to be defined, allowing for more complex caching behaviors.

cachetools

  • Guarantees atomic operations on read/write of cached data, ensuring that data is never corrupted by concurrent access.
  • Provides thread-safe access to cached data, reducing the risk of race conditions.
  • Provides the ability to specify a variety of expiration policies, such as time-based, size-based, or manual expiration.

flask-caching

  • Allows you to configure the cache behavior, such as the type of caching to use.
  • Supports caching backends such as Redis, Memcached, SimpleCache, and more.
  • Allows you to use multiple levels of caching, such as page, application, and session caching.

pickledb

  • Supports both synchronous and asynchronous mode.
  • Provides an interface for querying data efficiently with its query() method.
  • Extremely flexible and allows users to store any type of data, including strings, lists, dictionaries, and objects.

beaker

  • Supports multiple caching regions, allowing data to be cached separately in different regions.
  • Supports both simple key/value caching and more complex object caching.
  • Built-in support for plugins, allowing developers to easily extend the library to support additional caching backends.

python-memcached

  • Easy to deploy and is written in pure Python, making it highly portable.
  • Supports both binary and text-based protocol for communication with the cache.
  • Supports both distributed and local caching, making it suitable for both development and production deployments.

shelves

  • Persistent storage system, meaning that the data is stored in a file and will remain in the file even after the program exits.
  • Supports concurrent access to data, allowing multiple clients to access and modify the data at the same time.
  • Offers advanced features such as transaction support, versioning, and expiration.

Here are some of the famous Python WebSocket Utilities Libraries. Some use cases of Python WebSocket Utilities Libraries include Real-time Chat and Messaging Applications, Online Gaming, IoT Applications, and Real-time Data Visualization and Dashboards.


Python WebSocket utilities libraries are collections of code that provide a set of utilities to help developers create and manage WebSocket connections in Python. These libraries typically provide methods to simplify WebSocket connection setup, message sending, message receiving and connection management. They can also provide additional features such as authentication and SSL/TLS support.


Let us have a look at some of these libraries in detail below.

tornado

  • Can handle up to 10,000 simultaneous open connections, making it ideal for applications with high levels of concurrent users.
  • Can handle multiple requests simultaneously without blocking requests.
  • One of the few web frameworks that supports WebSocket connections.

gevent

  • Based on greenlet and libevent, making it extremely fast, lightweight and efficient.
  • Highly extensible and can be easily integrated with other Python libraries and frameworks.
  • Provides a high level of concurrency, allowing multiple requests to be handled at the same time.

twisted

  • Event-driven architecture makes it easy to build highly concurrent applications.
  • Can be used to build distributed applications, which can be used to connect multiple machines over the network.
  • Provides a low-level interface which makes it easier to work with websockets.

websockets

  • Data can be sent and received quickly, allowing for real-time communication.
  • Enable bidirectional communication between the client and the server.
  • Use the secure websocket protocol (WSS) which encrypts all data sent over the connection.

websocket-client

  • Built on top of the standard library's asyncio module, which allows for asynchronous communication with websockets.
  • Supports secure websocket connections via TLS/SSL, as well as binary messages and fragmented messages.
  • Supports custom headers and subprotocols, making it easy to communicate with specific services that require specific headers or subprotocols.

WebSocket-for-Python

  • Supports multiple protocols such as WebSocket, HTTP, and TCP, allowing for more flexible usage.
  • Has built-in security features such as authentication and encryption, allowing you to securely communicate with other applications.
  • Is written in Python, making it easy to use and integrate with existing Python applications.

socketIO-client

  • Supports multiple transports, including long polling, WebSockets and cross-browser support.
  • Support for namespaces, allowing for multiple independent connections to the same server.
  • Allows for subscribing to multiple events, allowing for a more efficient implementation of your application.

pywebsocket

  • Supports both server-side and client-side websocket connections.
  • Provides support for websocket extensions.
  • Supports both connection-oriented and connectionless websockets, making it a versatile tool for developers.

Here are some famous Swift Webserver Libraries. Swift Webserver Libraries use cases include Building a custom web server, Creating a content delivery network (CDN), Hosting a web application, and Developing a mobile application backend.


Swift web server libraries are libraries that are designed to enable developers to create web applications using the Swift programming language. These libraries provide tools to help developers with server-side development tasks such as routing, templating, and data handling.


Let us look at these libraries in detial.

vapor

  • Provides a type-safe, declarative framework for writing web applications.
  • Built-in support for asynchronous programming.
  • Offers an integrated authentication and authorization system.

Moya

  • Supports advanced authentication methods, such as OAuth2, Basic Auth, Client Certificate Authentication and Bearer Tokens.
  • Provides an easy way to mock network requests for testing and development.
  • Allows for custom header, query, and request body encoding for each request.

Perfect

  • Provides a scalable, high-performance web server that is optimized for Swift applications.
  • Offers built-in support for TemplateKit, a powerful templating engine for producing dynamic web content.
  • Has a robust set of development tools and libraries, including an integrated debugger and profiler.

Kitura

  • Built with a modular architecture that supports pluggable components to customize the server’s functionality.
  • Kitura-Stencil template engine allows you to write HTML templates in Swift, making it easier to create dynamic webpages.
  • Supports cloud deployment, allowing you to easily deploy your applications to the cloud.

swifter

  • Built-in security features such as TLS encryption and sandboxing.
  • Designed to be easy to setup and get up and running quickly.
  • Highly extensible and allows developers to customize the server to their own needs.

Zewo

  • Built with an asynchronous, non-blocking I/O model.
  • Optimized for both OS X and Linux and is fully compatible with Swift Package Manager.
  • Built-in support for HTTP/2, TLS/SSL, and other security features.

blackfire

  • Provides support for both synchronous and asynchronous requests.
  • Offers a range of deployment options, including Docker and Kubernetes.
  • Built-in support for the most popular web development frameworks, such as Laravel, Symfony, and Express.

Kitura-NIO

  • Makes it easy to define routes and map them to specific functions.
  • Uses non-blocking I/O operations.
  • Provides native support for secure communication over TLS.

ChatGPT is a variant of the GPT-3 language model for conversational language generation.


Here are the top Python ChatGPT libraries that you can use for

  • text generation based on a prompt or seed text,
  • text completion,
  • text classification,
  • question answering,
  • virtual assistants,
  • customer service chatbots,
  • knowledge management systems,
  • machine translation,
  • named-entry recognition,
  • summarization, and more. 


A large-scale language generation model is ChatGPT. Based on a prompt or context that the user offers, ChatGPT produces writing that resembles a human. ChatGPT has received widespread adoption in NLP and is employed in several applications. 


The top 15 Python ChatGPT libraries are shown below. Here is a detailed review of libraries:

ChatGPT:

  • Is a lightweight package to interact with ChatGPT’s API created by OpenAI.
  • Uses reverse engineering official API. 
  • Is a deep learning model that pertains to a large text corpus that is fine-tuned for natural language generation tasks. 
  • Help open an OpenAI API key for working on your Python programming skills.  

nonebot2:

  • Is a Python framework for building chatbots on different messaging platforms like Telegram, Discord, and QQ. 
  • Offers a high-level interface to create chatbots.
  • Helps focus on writing bot logic without worrying about low-level details.
  • Supports plugin-based architecture to extend and customize the bot’s functionalities.

PyChatGPT:

  • ChatGPT API will help with conversation tracking, auto token regeneration, and proxy support. 
  • Offers proxy support and saves conversations to a file.
  • Resumes conversations even after closing the program.
  • Allows you to automatically grab Access Token and log in without involving a browser.

chatgpt-wrapper:

  • Is an open source unofficial Python API, Flask API, and Power CLI, which lets you interact with ChatGPT. 
  • Let you use the powerful ChatGPT bot on the command line or your Python Scripts.
  • Will make leveraging its functionality in your projects easy. 
  • Is an API that helps interact with ChatGPT using Python and Shell.

chatgpt-mirai-qq-bot:

  • Is a Python library used to create a chatbot using the OpenAI GPT model
  • Integrates it with QQ, a popular messaging platform in China. 
  • Allows you to create a chatbot to generate natural language responses for user inputs. 
  • We can integrate the bot with QQ, allowing users to interact with the bot through chat messages.

chatGPT-discord-bot:

  • Is a Python library for creating a chatbot using the OpenAI GPT model
  • Integrats ot with Discord, a popular voice and messaging platform.  
  • Allows us to create a chatbot to generate natural language responses for user inputs. 
  • The OpenAI GPT model pertained to a massive corpus of text and fine-tuned it for language generation tasks.

QChatGPT:

  • Offers support for black and white list system, user management, custom word style
  • And also, persona, rate limiting, and private and group chats.
  • Support sensitive word filtering to avoid account risks; replies will fit perfectly with the context. 
  • Offers perfect multi-API-key management, automatic switching of excess quota,
  • Supports present command texts.  

ChineseAIDungeonChatGPT:

  • Is a Python library that uses an AI dungeon with ChatGPT for creating a storytelling model. 
  • Designed to be used with a game, ‘AI Dungeon’, which will allow players to generate text-based game scenarios using the GPT models.  
  • Offers a high-level interface to create chatbots.
  • Help you generate natural language responses for user inputs. 

Openaibot:

  • Is a Python library for creating chatbots using the OpenAI GPT model
  • Offers a high-level interface to build chatbots which generate natural language responses.
  • Offers an easy-to-use interface that will help interact with the OpenAI API to start building chatbots. 
  • Includes built-in support for handling request throttling and user authentication.

chatgpt-api: 

  • Is an unofficial ChatGPT API based on Daniel Gross’s WhatsApp GPT. 
  • Uses chromium and playwright for opening browser and parsing HTML. 
  • Used for development purposes only. 

chatgpt-python: 

  • Is an unofficial Python SDK for OpenAI’s ChatGPT. 
  • Is a library which will allow developers to easily integrate the ChatGPT into their Python based projects.  
  • Generates error codes for explaining what went wrong with the ChatGPT. 

chatgpt-conversation: 

  • Let us have a conversation with ChatGPT with our voice and let it talk back to us.  

stackexplain: 

  • Is a Python library which is used in Server and Runtime Environment applications.  

TextRL:

  • Can do text generation with reinforcement learning with the help of huggingface’s transformer.
  • Reinforcement Learning with Human Feedback’s implementation of ChatGPT of human interaction
  • For improving generation model with reinforcement learning.

JavaScript testing framework library helps developers automate the testing process for their applications. It provides various functionalities and utilities to write, execute, and manage tests.  

 

With a JavaScript testing framework library, developers can perform various tests. It can be unit tests, integration tests, and end-to-end tests. These tests help ensure that the components and functionality are working as expected.  

 

JavaScript testing framework libraries offer various features. It helps support testing. It includes built-in assertion libraries for making test assertions. It helps in reporting tools to generate test coverage reports. It helps in debugging capabilities to identify and troubleshoot issues in the code.  

 

You must set up the testing environment when using the JavaScript testing framework library. It includes installing the necessary dependencies and configuring the library for the project. Writing effective tests involves 

  • understanding the library's syntax and APIs, 
  • organizing test files, and 
  • creating relevant and comprehensive test cases.  


To improve the quality of tests, developers should strive for clear and concise code. They should follow best practices and consider mocking or stubbing dependencies. It helps isolate specific components for testing.  

 

A JavaScript testing framework library is a valuable tool for web developers. It helps automate the testing process. It provides various features to support testing needs. It encourages best practices in writing and managing tests. Using this library, developers can enhance the reliability and quality of their applications.  

 

In conclusion, a JavaScript testing framework library plays a crucial role in development. It will simplify and enhance the testing process. It gives developers the tools, features, and guidance to write effective tests. It ensures the robustness of their JavaScript applications. By adopting these libraries, developers can reduce errors and deliver higher-quality software.  

cypress:  

  • Cypress is a comprehensive end-to-end testing framework for modern web applications.  
  • It provides a complete testing environment. 
  • It has built-in assertions, an interactive test runner, and real-time reloading.  
  • Cypress enables developers to write tests that simulate user interactions. 
  • It helps verify application behavior across browsers and devices.  

jest:  

  • It supports unit testing, integration testing, and snapshot testing.  
  • Jest is great for testing JavaScript applications, from small modules to large-scale projects.  
  • It provides test assertions, mocking, code coverage reporting, and parallel test execution. 

mocha:  

  • Mocha is a flexible and extensible JavaScript testing framework. 
  • It supports synchronous and asynchronous testing styles.  
  • It provides an intuitive API for defining test suites and cases. 
  • Mocha can test browser-based applications, server-side applications, and even asynchronous JavaScript code. 

ava:  

  • Ava is a lightweight and concurrent JavaScript testing framework emphasizing performance and simplicity.  
  • It runs tests, which can reduce test execution time.  
  • Ava supports test isolation and automatic parallelization. It has a concise API for writing tests.  
  • It is particularly useful for testing JavaScript modules and libraries.  

enzyme:  

  • It is a JavaScript testing utility for React applications.  
  • It provides various intuitive APIs for interacting with React components. 
  • It makes assertions about their behavior.  
  • Enzyme simplifies the process of testing React components by offering methods. 
  • It allows shallow rendering, mounting, and traversing of the component tree. 

jasmine:  

  • Jasmine is a behavior-driven development (BDD) sting framework focusing on readability and simplicity.  
  • It provides a clean and expressive syntax for defining tests and expectations.  
  • Jasmine is suitable for testing JavaScript applications of any size. 
  • It helps with front and back end testing.  

karma:  

  • Karma is a JavaScript test runner.  
  • It allows you to execute tests in many real browsers or browser-like environments.  
  • It helps run tests, capture browser instances, and generate test reports.  
  • Karma is well-suited for continuous integration environments and supports many testing frameworks.  

tape:  

  • Tape is a minimalist JavaScript testing framework that focuses on simplicity and modularity.  
  • It provides a small and lightweight API for writing tests and assertions. 
  • It helps small projects or developers who prefer a minimalistic testing approach.  

intern:  

  • Intern helps test modern JavaScript applications at various levels of the testing pyramid.  
  • It has a powerful test runner, assertion library, and support for end-to-end testing.  
  • It supports testing across different environments, including browsers, Node.js, and mobile devices.  

qunit:  

  • QUnit is a JavaScript unit testing framework developed by the jQuery team.  
  • It offers a simple and easy-to-use API for writing tests and assertions. 
  • QUnit is especially suitable for testing jQuery plugins and other jQuery-related projects.  

FAQ 

1. What are the top 9 JavaScript testing frameworks?  

The top 9 JavaScript testing frameworks include:  

  • Jest  
  • Mocha  
  • Jasmine  
  • Karma  
  • Cypress  
  • Puppeteer  
  • Enzyme  
  • Ava  
  • Tape  
  •  

2. What is a popular open-source productive testing environment?  

A popular open-source productive testing environment is Cypress. It provides: 

  • a complete end-to-end testing solution for web applications, 
  • offering a powerful and intuitive testing interface, 
  • automatic waiting and retrying, 
  • real-time reloading, and 
  • built-in debugging capabilities.  
  •  

3. How does React Testing Library work?  

React Testing Library is a popular testing library for React components. It tests the rendered output and behavior from a user's perspective. It works by simulating user interactions and asserting the expected behavior of components.  

 

4. What are some of the popular testing frameworks available for JavaScript?  

Some testing frameworks available are Jest, Mocha, Jasmine, and Karma. These frameworks offer various features and support various testing styles. They have a large community of developers contributing to their development and maintenance.  

 

5. What is Headless Browser Testing, and why is it important in JavaScript testing?  

Headless Browser Testing is where we execute tests without a visible user interface. It is vital as it allows for the testing of web applications in a controlled manner. It enables developers to run tests lightweight. It makes it suitable for continuous integration and automated testing workflows.  

 

6. How can Test Automation Frameworks help to reduce time and improve quality assurance?  

Test Automation Frameworks provide a systematic approach to automate the test case execution. They help reduce development time and improve quality assurance. By automating time-consuming tests, developers can focus on critical aspects of software development. It offers reusable components, standardized testing methodologies, and built-in reporting and logging capabilities. It will ensure ensuring consistent and reliable testing of their JavaScript applications. 

Trending Discussions on Server

psql: error: connection to server on socket &quot;/tmp/.s.PGSQL.5432&quot; failed: No such file or directory

Error: require() of ES modules is not supported when importing node-fetch

Could not GET 'play-services-location/maven-metadata.xml'. Received status code 502 from server: Bad Gateway

The unauthenticated git protocol on port 9418 is no longer supported

CentOS through a VM - no URLs in mirrorlist

Java, Intellij IDEA problem Unrecognized option: --add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED

Springboot 2.6.0 / Spring fox 3 - Failed to start bean 'documentationPluginsBootstrapper'

ESlint - Error: Must use import to load ES Module

throwError(error) is now deprecated, but there is no new Error(HttpErrorResponse)

How to open emulators in different windows at Android Studio (Bumblebee | 2021.1.1)?

QUESTION

psql: error: connection to server on socket &quot;/tmp/.s.PGSQL.5432&quot; failed: No such file or directory

Asked 2022-Apr-04 at 15:46

Not really sure what caused this but most likely exiting the terminal while my rails server which was connected to PostgreSQL database was closed (not a good practice I know but lesson learned!)

I've already tried the following:

  1. Rebooting my machine (using MBA M1 2020)
  2. Restarting PostgreSQL using homebrew brew services restart postgresql
  3. Re-installing PostgreSQL using Homebrew
  4. Updating PostgreSQL using Homebrew
  5. I also tried following this link but when I run cd Library/Application\ Support/Postgres terminal tells me Postgres folder doesn't exist, so I'm kind of lost already. Although I have a feeling that deleting postmaster.pid would really fix my issue. Any help would be appreciated!

ANSWER

Answered 2022-Jan-13 at 15:19
Resetting PostgreSQL

My original answer only included the troubleshooting steps below, and a workaround. I now decided to properly fix it via brute force by removing all clusters and reinstalling, since I didn't have any data there to keep. It was something along these lines, on my Ubuntu 21.04 system:

1sudo pg_dropcluster --stop 12 main
2sudo pg_dropcluster --stop 14 main
3sudo apt remove postgresql-14
4sudo apt purge postgresql*
5sudo apt install postgresql-14
6

Now I have:

1sudo pg_dropcluster --stop 12 main
2sudo pg_dropcluster --stop 14 main
3sudo apt remove postgresql-14
4sudo apt purge postgresql*
5sudo apt install postgresql-14
6$ pg_lsclusters
7Ver Cluster Port Status Owner    Data directory              Log file
814  main    5432 online postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
9

And sudo -u postgres psql works fine. The service was started automatically but it can be done manually with sudo systemctl start postgresql.

Incidentally, I can recommend the PostgreSQL docker image, which eliminates the need to bother with a local installation.

Troubleshooting

Although I cannot provide an answer to your specific problem, I thought I'd share my troubleshooting steps, hoping that it might be of some help. It seems that you are on Mac, whereas I am running Ubuntu 21.04, so expect things to be different.

This is a client connection problem, as noted by section 19.3.2 in the docs.

The directory in my error message is different:

1sudo pg_dropcluster --stop 12 main
2sudo pg_dropcluster --stop 14 main
3sudo apt remove postgresql-14
4sudo apt purge postgresql*
5sudo apt install postgresql-14
6$ pg_lsclusters
7Ver Cluster Port Status Owner    Data directory              Log file
814  main    5432 online postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
9$ sudo su postgres -c &quot;psql&quot;
10psql: error: connection to server on socket &quot;/var/run/postgresql/.s.PGSQL.5432&quot; failed: No such file or directory
11        Is the server running locally and accepting connections on that socket?
12

I checked what unix sockets I had in that directory:

1sudo pg_dropcluster --stop 12 main
2sudo pg_dropcluster --stop 14 main
3sudo apt remove postgresql-14
4sudo apt purge postgresql*
5sudo apt install postgresql-14
6$ pg_lsclusters
7Ver Cluster Port Status Owner    Data directory              Log file
814  main    5432 online postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
9$ sudo su postgres -c &quot;psql&quot;
10psql: error: connection to server on socket &quot;/var/run/postgresql/.s.PGSQL.5432&quot; failed: No such file or directory
11        Is the server running locally and accepting connections on that socket?
12$ ls -lah /var/run/postgresql/
13total 8.0K
14drwxrwsr-x  4 postgres postgres  160 Oct 29 16:40 .
15drwxr-xr-x 36 root     root     1.1K Oct 29 14:08 ..
16drwxr-s---  2 postgres postgres   40 Oct 29 14:33 12-main.pg_stat_tmp
17drwxr-s---  2 postgres postgres  120 Oct 29 16:59 14-main.pg_stat_tmp
18-rw-r--r--  1 postgres postgres    6 Oct 29 16:36 14-main.pid
19srwxrwxrwx  1 postgres postgres    0 Oct 29 16:36 .s.PGSQL.5433
20-rw-------  1 postgres postgres   70 Oct 29 16:36 .s.PGSQL.5433.lock
21

Makes sense, there is a socket for 5433 not 5432. I confirmed this by running:

1sudo pg_dropcluster --stop 12 main
2sudo pg_dropcluster --stop 14 main
3sudo apt remove postgresql-14
4sudo apt purge postgresql*
5sudo apt install postgresql-14
6$ pg_lsclusters
7Ver Cluster Port Status Owner    Data directory              Log file
814  main    5432 online postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
9$ sudo su postgres -c &quot;psql&quot;
10psql: error: connection to server on socket &quot;/var/run/postgresql/.s.PGSQL.5432&quot; failed: No such file or directory
11        Is the server running locally and accepting connections on that socket?
12$ ls -lah /var/run/postgresql/
13total 8.0K
14drwxrwsr-x  4 postgres postgres  160 Oct 29 16:40 .
15drwxr-xr-x 36 root     root     1.1K Oct 29 14:08 ..
16drwxr-s---  2 postgres postgres   40 Oct 29 14:33 12-main.pg_stat_tmp
17drwxr-s---  2 postgres postgres  120 Oct 29 16:59 14-main.pg_stat_tmp
18-rw-r--r--  1 postgres postgres    6 Oct 29 16:36 14-main.pid
19srwxrwxrwx  1 postgres postgres    0 Oct 29 16:36 .s.PGSQL.5433
20-rw-------  1 postgres postgres   70 Oct 29 16:36 .s.PGSQL.5433.lock
21$ pg_lsclusters
22Ver Cluster Port Status                Owner    Data directory              Log file
2312  main    5432 down,binaries_missing postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log
2414  main    5433 online                postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
25

This explains how it got into this mess on my system. The default port is 5432, but after I upgraded from version 12 to 14, the server was setup to listen to 5433, presumably because it considered 5432 as already taken. Two alternatives here, get the server to listen on 5432 which is the client's default, or get the client to use 5433.

Let's try it by changing the client's parameters:

1sudo pg_dropcluster --stop 12 main
2sudo pg_dropcluster --stop 14 main
3sudo apt remove postgresql-14
4sudo apt purge postgresql*
5sudo apt install postgresql-14
6$ pg_lsclusters
7Ver Cluster Port Status Owner    Data directory              Log file
814  main    5432 online postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
9$ sudo su postgres -c &quot;psql&quot;
10psql: error: connection to server on socket &quot;/var/run/postgresql/.s.PGSQL.5432&quot; failed: No such file or directory
11        Is the server running locally and accepting connections on that socket?
12$ ls -lah /var/run/postgresql/
13total 8.0K
14drwxrwsr-x  4 postgres postgres  160 Oct 29 16:40 .
15drwxr-xr-x 36 root     root     1.1K Oct 29 14:08 ..
16drwxr-s---  2 postgres postgres   40 Oct 29 14:33 12-main.pg_stat_tmp
17drwxr-s---  2 postgres postgres  120 Oct 29 16:59 14-main.pg_stat_tmp
18-rw-r--r--  1 postgres postgres    6 Oct 29 16:36 14-main.pid
19srwxrwxrwx  1 postgres postgres    0 Oct 29 16:36 .s.PGSQL.5433
20-rw-------  1 postgres postgres   70 Oct 29 16:36 .s.PGSQL.5433.lock
21$ pg_lsclusters
22Ver Cluster Port Status                Owner    Data directory              Log file
2312  main    5432 down,binaries_missing postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log
2414  main    5433 online                postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
25$ sudo su postgres -c &quot;psql --port=5433&quot;
26psql (14.0 (Ubuntu 14.0-1.pgdg21.04+1))
27Type &quot;help&quot; for help.
28
29postgres=#
30

It worked! Now, to make it permanent I'm supposed to put this setting on a psqlrc or ~/.psqlrc file. The thin documentation on this (under "Files") was not helpful to me as I was not sure on the syntax and my attempts did not change the client's default, so I moved on.

To change the server I looked for the postgresql.conf mentioned in the documentation but could not find the file. I did however see /var/lib/postgresql/14/main/postgresql.auto.conf so I created it on the same directory with the content:

1sudo pg_dropcluster --stop 12 main
2sudo pg_dropcluster --stop 14 main
3sudo apt remove postgresql-14
4sudo apt purge postgresql*
5sudo apt install postgresql-14
6$ pg_lsclusters
7Ver Cluster Port Status Owner    Data directory              Log file
814  main    5432 online postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
9$ sudo su postgres -c &quot;psql&quot;
10psql: error: connection to server on socket &quot;/var/run/postgresql/.s.PGSQL.5432&quot; failed: No such file or directory
11        Is the server running locally and accepting connections on that socket?
12$ ls -lah /var/run/postgresql/
13total 8.0K
14drwxrwsr-x  4 postgres postgres  160 Oct 29 16:40 .
15drwxr-xr-x 36 root     root     1.1K Oct 29 14:08 ..
16drwxr-s---  2 postgres postgres   40 Oct 29 14:33 12-main.pg_stat_tmp
17drwxr-s---  2 postgres postgres  120 Oct 29 16:59 14-main.pg_stat_tmp
18-rw-r--r--  1 postgres postgres    6 Oct 29 16:36 14-main.pid
19srwxrwxrwx  1 postgres postgres    0 Oct 29 16:36 .s.PGSQL.5433
20-rw-------  1 postgres postgres   70 Oct 29 16:36 .s.PGSQL.5433.lock
21$ pg_lsclusters
22Ver Cluster Port Status                Owner    Data directory              Log file
2312  main    5432 down,binaries_missing postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log
2414  main    5433 online                postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
25$ sudo su postgres -c &quot;psql --port=5433&quot;
26psql (14.0 (Ubuntu 14.0-1.pgdg21.04+1))
27Type &quot;help&quot; for help.
28
29postgres=#
30port = 5432
31

Restarted the server: sudo systemctl restart postgresql

But the error persisted because, as the logs confirmed, the port did not change:

1sudo pg_dropcluster --stop 12 main
2sudo pg_dropcluster --stop 14 main
3sudo apt remove postgresql-14
4sudo apt purge postgresql*
5sudo apt install postgresql-14
6$ pg_lsclusters
7Ver Cluster Port Status Owner    Data directory              Log file
814  main    5432 online postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
9$ sudo su postgres -c &quot;psql&quot;
10psql: error: connection to server on socket &quot;/var/run/postgresql/.s.PGSQL.5432&quot; failed: No such file or directory
11        Is the server running locally and accepting connections on that socket?
12$ ls -lah /var/run/postgresql/
13total 8.0K
14drwxrwsr-x  4 postgres postgres  160 Oct 29 16:40 .
15drwxr-xr-x 36 root     root     1.1K Oct 29 14:08 ..
16drwxr-s---  2 postgres postgres   40 Oct 29 14:33 12-main.pg_stat_tmp
17drwxr-s---  2 postgres postgres  120 Oct 29 16:59 14-main.pg_stat_tmp
18-rw-r--r--  1 postgres postgres    6 Oct 29 16:36 14-main.pid
19srwxrwxrwx  1 postgres postgres    0 Oct 29 16:36 .s.PGSQL.5433
20-rw-------  1 postgres postgres   70 Oct 29 16:36 .s.PGSQL.5433.lock
21$ pg_lsclusters
22Ver Cluster Port Status                Owner    Data directory              Log file
2312  main    5432 down,binaries_missing postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log
2414  main    5433 online                postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
25$ sudo su postgres -c &quot;psql --port=5433&quot;
26psql (14.0 (Ubuntu 14.0-1.pgdg21.04+1))
27Type &quot;help&quot; for help.
28
29postgres=#
30port = 5432
31$ tail /var/log/postgresql/postgresql-14-main.log
32...
332021-10-29 16:36:12.195 UTC [25236] LOG:  listening on IPv4 address &quot;127.0.0.1&quot;, port 5433
342021-10-29 16:36:12.198 UTC [25236] LOG:  listening on Unix socket &quot;/var/run/postgresql/.s.PGSQL.5433&quot;
352021-10-29 16:36:12.204 UTC [25237] LOG:  database system was shut down at 2021-10-29 16:36:12 UTC
362021-10-29 16:36:12.210 UTC [25236] LOG:  database system is ready to accept connections
37

After other attempts did not succeed, I eventually decided to use a workaround: to redirect the client's requests on 5432 to 5433:

1sudo pg_dropcluster --stop 12 main
2sudo pg_dropcluster --stop 14 main
3sudo apt remove postgresql-14
4sudo apt purge postgresql*
5sudo apt install postgresql-14
6$ pg_lsclusters
7Ver Cluster Port Status Owner    Data directory              Log file
814  main    5432 online postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
9$ sudo su postgres -c &quot;psql&quot;
10psql: error: connection to server on socket &quot;/var/run/postgresql/.s.PGSQL.5432&quot; failed: No such file or directory
11        Is the server running locally and accepting connections on that socket?
12$ ls -lah /var/run/postgresql/
13total 8.0K
14drwxrwsr-x  4 postgres postgres  160 Oct 29 16:40 .
15drwxr-xr-x 36 root     root     1.1K Oct 29 14:08 ..
16drwxr-s---  2 postgres postgres   40 Oct 29 14:33 12-main.pg_stat_tmp
17drwxr-s---  2 postgres postgres  120 Oct 29 16:59 14-main.pg_stat_tmp
18-rw-r--r--  1 postgres postgres    6 Oct 29 16:36 14-main.pid
19srwxrwxrwx  1 postgres postgres    0 Oct 29 16:36 .s.PGSQL.5433
20-rw-------  1 postgres postgres   70 Oct 29 16:36 .s.PGSQL.5433.lock
21$ pg_lsclusters
22Ver Cluster Port Status                Owner    Data directory              Log file
2312  main    5432 down,binaries_missing postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log
2414  main    5433 online                postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
25$ sudo su postgres -c &quot;psql --port=5433&quot;
26psql (14.0 (Ubuntu 14.0-1.pgdg21.04+1))
27Type &quot;help&quot; for help.
28
29postgres=#
30port = 5432
31$ tail /var/log/postgresql/postgresql-14-main.log
32...
332021-10-29 16:36:12.195 UTC [25236] LOG:  listening on IPv4 address &quot;127.0.0.1&quot;, port 5433
342021-10-29 16:36:12.198 UTC [25236] LOG:  listening on Unix socket &quot;/var/run/postgresql/.s.PGSQL.5433&quot;
352021-10-29 16:36:12.204 UTC [25237] LOG:  database system was shut down at 2021-10-29 16:36:12 UTC
362021-10-29 16:36:12.210 UTC [25236] LOG:  database system is ready to accept connections
37ln -s /var/run/postgresql/.s.PGSQL.5433 /var/run/postgresql/.s.PGSQL.5432
38

This is what I have now:

1sudo pg_dropcluster --stop 12 main
2sudo pg_dropcluster --stop 14 main
3sudo apt remove postgresql-14
4sudo apt purge postgresql*
5sudo apt install postgresql-14
6$ pg_lsclusters
7Ver Cluster Port Status Owner    Data directory              Log file
814  main    5432 online postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
9$ sudo su postgres -c &quot;psql&quot;
10psql: error: connection to server on socket &quot;/var/run/postgresql/.s.PGSQL.5432&quot; failed: No such file or directory
11        Is the server running locally and accepting connections on that socket?
12$ ls -lah /var/run/postgresql/
13total 8.0K
14drwxrwsr-x  4 postgres postgres  160 Oct 29 16:40 .
15drwxr-xr-x 36 root     root     1.1K Oct 29 14:08 ..
16drwxr-s---  2 postgres postgres   40 Oct 29 14:33 12-main.pg_stat_tmp
17drwxr-s---  2 postgres postgres  120 Oct 29 16:59 14-main.pg_stat_tmp
18-rw-r--r--  1 postgres postgres    6 Oct 29 16:36 14-main.pid
19srwxrwxrwx  1 postgres postgres    0 Oct 29 16:36 .s.PGSQL.5433
20-rw-------  1 postgres postgres   70 Oct 29 16:36 .s.PGSQL.5433.lock
21$ pg_lsclusters
22Ver Cluster Port Status                Owner    Data directory              Log file
2312  main    5432 down,binaries_missing postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log
2414  main    5433 online                postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
25$ sudo su postgres -c &quot;psql --port=5433&quot;
26psql (14.0 (Ubuntu 14.0-1.pgdg21.04+1))
27Type &quot;help&quot; for help.
28
29postgres=#
30port = 5432
31$ tail /var/log/postgresql/postgresql-14-main.log
32...
332021-10-29 16:36:12.195 UTC [25236] LOG:  listening on IPv4 address &quot;127.0.0.1&quot;, port 5433
342021-10-29 16:36:12.198 UTC [25236] LOG:  listening on Unix socket &quot;/var/run/postgresql/.s.PGSQL.5433&quot;
352021-10-29 16:36:12.204 UTC [25237] LOG:  database system was shut down at 2021-10-29 16:36:12 UTC
362021-10-29 16:36:12.210 UTC [25236] LOG:  database system is ready to accept connections
37ln -s /var/run/postgresql/.s.PGSQL.5433 /var/run/postgresql/.s.PGSQL.5432
38$ ls -lah /var/run/postgresql/
39total 8.0K
40drwxrwsr-x  4 postgres postgres  160 Oct 29 16:40 .
41drwxr-xr-x 36 root     root     1.1K Oct 29 14:08 ..
42drwxr-s---  2 postgres postgres   40 Oct 29 14:33 12-main.pg_stat_tmp
43drwxr-s---  2 postgres postgres  120 Oct 29 16:59 14-main.pg_stat_tmp
44-rw-r--r--  1 postgres postgres    6 Oct 29 16:36 14-main.pid
45lrwxrwxrwx  1 postgres postgres   33 Oct 29 16:40 .s.PGSQL.5432 -&gt; /var/run/postgresql/.s.PGSQL.5433
46srwxrwxrwx  1 postgres postgres    0 Oct 29 16:36 .s.PGSQL.5433
47-rw-------  1 postgres postgres   70 Oct 29 16:36 .s.PGSQL.5433.lock
48

This means I can now just run psql without having to explicitly set the port to 5433. Now, this is a hack and I would not recommend it. But in my development system I am happy with it for now, because I don't have more time to spend on this. This is why I shared the steps and the links so that you can find a proper solution for your case.

Source https://stackoverflow.com/questions/69754628

QUESTION

Error: require() of ES modules is not supported when importing node-fetch

Asked 2022-Mar-28 at 07:04

I'm creating a program to analyze security camera streams and got stuck on the very first line. At the moment my .js file has nothing but the import of node-fetch and it gives me an error message. What am I doing wrong?

Running Ubuntu 20.04.2 LTS in Windows Subsystem for Linux.

Node version:

1user@MYLLYTIN:~/CAMSERVER$ node -v
2v14.17.6
3

node-fetch package version:

1user@MYLLYTIN:~/CAMSERVER$ node -v
2v14.17.6
3user@MYLLYTIN:~/CAMSERVER$ npm v node-fetch
4
5node-fetch@3.0.0 | MIT | deps: 2 | versions: 63
6A light-weight module that brings Fetch API to node.js
7https://github.com/node-fetch/node-fetch
8
9keywords: fetch, http, promise, request, curl, wget, xhr, whatwg
10
11dist
12.tarball: https://registry.npmjs.org/node-fetch/-/node-fetch-3.0.0.tgz
13.shasum: 79da7146a520036f2c5f644e4a26095f17e411ea
14.integrity: sha512-bKMI+C7/T/SPU1lKnbQbwxptpCrG9ashG+VkytmXCPZyuM9jB6VU+hY0oi4lC8LxTtAeWdckNCTa3nrGsAdA3Q==
15.unpackedSize: 75.9 kB
16
17dependencies:
18data-uri-to-buffer: ^3.0.1 fetch-blob: ^3.1.2         
19
20maintainers:
21- endless &lt;jimmy@warting.se&gt;
22- bitinn &lt;bitinn@gmail.com&gt;
23- timothygu &lt;timothygu99@gmail.com&gt;
24- akepinski &lt;npm@kepinski.ch&gt;
25
26dist-tags:
27latest: 3.0.0        next: 3.0.0-beta.10  
28
29published 3 days ago by endless &lt;jimmy@warting.se&gt;
30

esm package version:

1user@MYLLYTIN:~/CAMSERVER$ node -v
2v14.17.6
3user@MYLLYTIN:~/CAMSERVER$ npm v node-fetch
4
5node-fetch@3.0.0 | MIT | deps: 2 | versions: 63
6A light-weight module that brings Fetch API to node.js
7https://github.com/node-fetch/node-fetch
8
9keywords: fetch, http, promise, request, curl, wget, xhr, whatwg
10
11dist
12.tarball: https://registry.npmjs.org/node-fetch/-/node-fetch-3.0.0.tgz
13.shasum: 79da7146a520036f2c5f644e4a26095f17e411ea
14.integrity: sha512-bKMI+C7/T/SPU1lKnbQbwxptpCrG9ashG+VkytmXCPZyuM9jB6VU+hY0oi4lC8LxTtAeWdckNCTa3nrGsAdA3Q==
15.unpackedSize: 75.9 kB
16
17dependencies:
18data-uri-to-buffer: ^3.0.1 fetch-blob: ^3.1.2         
19
20maintainers:
21- endless &lt;jimmy@warting.se&gt;
22- bitinn &lt;bitinn@gmail.com&gt;
23- timothygu &lt;timothygu99@gmail.com&gt;
24- akepinski &lt;npm@kepinski.ch&gt;
25
26dist-tags:
27latest: 3.0.0        next: 3.0.0-beta.10  
28
29published 3 days ago by endless &lt;jimmy@warting.se&gt;
30user@MYLLYTIN:~/CAMSERVER$ npm v esm
31
32esm@3.2.25 | MIT | deps: none | versions: 140
33Tomorrow's ECMAScript modules today!
34https://github.com/standard-things/esm#readme
35
36keywords: commonjs, ecmascript, export, import, modules, node, require
37
38dist
39.tarball: https://registry.npmjs.org/esm/-/esm-3.2.25.tgz
40.shasum: 342c18c29d56157688ba5ce31f8431fbb795cc10
41.integrity: sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==
42.unpackedSize: 308.6 kB
43
44maintainers:
45- jdalton &lt;john.david.dalton@gmail.com&gt;
46
47dist-tags:
48latest: 3.2.25  
49
50published over a year ago by jdalton &lt;john.david.dalton@gmail.com&gt;
51

Contents of the .js file (literally nothing but the import):

1user@MYLLYTIN:~/CAMSERVER$ node -v
2v14.17.6
3user@MYLLYTIN:~/CAMSERVER$ npm v node-fetch
4
5node-fetch@3.0.0 | MIT | deps: 2 | versions: 63
6A light-weight module that brings Fetch API to node.js
7https://github.com/node-fetch/node-fetch
8
9keywords: fetch, http, promise, request, curl, wget, xhr, whatwg
10
11dist
12.tarball: https://registry.npmjs.org/node-fetch/-/node-fetch-3.0.0.tgz
13.shasum: 79da7146a520036f2c5f644e4a26095f17e411ea
14.integrity: sha512-bKMI+C7/T/SPU1lKnbQbwxptpCrG9ashG+VkytmXCPZyuM9jB6VU+hY0oi4lC8LxTtAeWdckNCTa3nrGsAdA3Q==
15.unpackedSize: 75.9 kB
16
17dependencies:
18data-uri-to-buffer: ^3.0.1 fetch-blob: ^3.1.2         
19
20maintainers:
21- endless &lt;jimmy@warting.se&gt;
22- bitinn &lt;bitinn@gmail.com&gt;
23- timothygu &lt;timothygu99@gmail.com&gt;
24- akepinski &lt;npm@kepinski.ch&gt;
25
26dist-tags:
27latest: 3.0.0        next: 3.0.0-beta.10  
28
29published 3 days ago by endless &lt;jimmy@warting.se&gt;
30user@MYLLYTIN:~/CAMSERVER$ npm v esm
31
32esm@3.2.25 | MIT | deps: none | versions: 140
33Tomorrow's ECMAScript modules today!
34https://github.com/standard-things/esm#readme
35
36keywords: commonjs, ecmascript, export, import, modules, node, require
37
38dist
39.tarball: https://registry.npmjs.org/esm/-/esm-3.2.25.tgz
40.shasum: 342c18c29d56157688ba5ce31f8431fbb795cc10
41.integrity: sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==
42.unpackedSize: 308.6 kB
43
44maintainers:
45- jdalton &lt;john.david.dalton@gmail.com&gt;
46
47dist-tags:
48latest: 3.2.25  
49
50published over a year ago by jdalton &lt;john.david.dalton@gmail.com&gt;
51user@MYLLYTIN:~/CAMSERVER$ cat server.js 
52import fetch from &quot;node-fetch&quot;;
53

Result:

1user@MYLLYTIN:~/CAMSERVER$ node -v
2v14.17.6
3user@MYLLYTIN:~/CAMSERVER$ npm v node-fetch
4
5node-fetch@3.0.0 | MIT | deps: 2 | versions: 63
6A light-weight module that brings Fetch API to node.js
7https://github.com/node-fetch/node-fetch
8
9keywords: fetch, http, promise, request, curl, wget, xhr, whatwg
10
11dist
12.tarball: https://registry.npmjs.org/node-fetch/-/node-fetch-3.0.0.tgz
13.shasum: 79da7146a520036f2c5f644e4a26095f17e411ea
14.integrity: sha512-bKMI+C7/T/SPU1lKnbQbwxptpCrG9ashG+VkytmXCPZyuM9jB6VU+hY0oi4lC8LxTtAeWdckNCTa3nrGsAdA3Q==
15.unpackedSize: 75.9 kB
16
17dependencies:
18data-uri-to-buffer: ^3.0.1 fetch-blob: ^3.1.2         
19
20maintainers:
21- endless &lt;jimmy@warting.se&gt;
22- bitinn &lt;bitinn@gmail.com&gt;
23- timothygu &lt;timothygu99@gmail.com&gt;
24- akepinski &lt;npm@kepinski.ch&gt;
25
26dist-tags:
27latest: 3.0.0        next: 3.0.0-beta.10  
28
29published 3 days ago by endless &lt;jimmy@warting.se&gt;
30user@MYLLYTIN:~/CAMSERVER$ npm v esm
31
32esm@3.2.25 | MIT | deps: none | versions: 140
33Tomorrow's ECMAScript modules today!
34https://github.com/standard-things/esm#readme
35
36keywords: commonjs, ecmascript, export, import, modules, node, require
37
38dist
39.tarball: https://registry.npmjs.org/esm/-/esm-3.2.25.tgz
40.shasum: 342c18c29d56157688ba5ce31f8431fbb795cc10
41.integrity: sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==
42.unpackedSize: 308.6 kB
43
44maintainers:
45- jdalton &lt;john.david.dalton@gmail.com&gt;
46
47dist-tags:
48latest: 3.2.25  
49
50published over a year ago by jdalton &lt;john.david.dalton@gmail.com&gt;
51user@MYLLYTIN:~/CAMSERVER$ cat server.js 
52import fetch from &quot;node-fetch&quot;;
53user@MYLLYTIN:~/CAMSERVER$ node -r esm server.js 
54/home/user/CAMSERVER/node_modules/node-fetch/src/index.js:1
55Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /home/user/CAMSERVER/node_modules/node-fetch/src/index.js
56require() of ES modules is not supported.
57require() of /home/user/CAMSERVER/node_modules/node-fetch/src/index.js from /home/user/CAMSERVER/server.js is an ES module file as it is a .js file whose nearest parent package.json contains &quot;type&quot;: &quot;module&quot; which defines all .js files in that package scope as ES modules.
58Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove &quot;type&quot;: &quot;module&quot; from /home/user/CAMSERVER/node_modules/node-fetch/package.json.
59
60    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1089:13) {
61  code: 'ERR_REQUIRE_ESM'
62}
63user@MYLLYTIN:~/CAMSERVER$ 
64

ANSWER

Answered 2022-Feb-25 at 00:00

Use ESM syntax, also use one of these methods before running the file.

  1. specify "type":"module" in package.json
  2. Or use this flag --input-type=module when running the file
  3. Or use .mjs file extension

Source https://stackoverflow.com/questions/69041454

QUESTION

Could not GET 'play-services-location/maven-metadata.xml'. Received status code 502 from server: Bad Gateway

Asked 2022-Mar-28 at 07:02

I have a project which was running well yesterday, but today I find this problem:

Could not resolve all files for configuration ':app:debugRuntimeClasspath'. Could not resolve com.google.android.gms:play-services-location:16.+. Required by: project :app > project :location > Failed to list versions for com.google.android.gms:play-services-location. > Unable to load Maven meta-data from https://google.bintray.com/exoplayer/com/google/android/gms/play-services-location/maven-metadata.xml. > Could not get resource 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-location/maven-metadata.xml'. > Could not GET 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-location/maven-metadata.xml'. Received status code 502 from server: Bad Gateway

acutely I'm using classpath 'com.android.tools.build:gradle:4.1.0'with distributionUrl=https://services.gradle.org/distributions/gradle-6.5-bin.zip I have followed this question and I upgraded 'com.android.tools.build:gradle:4.1.0' to classpath 'com.android.tools.build:gradle:4.2.0' then I changed distributionUrl=https://services.gradle.org/distributions/gradle-6.5-bin.zip to distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip but I still got the error.

my android/build.gradle:

1buildscript {
2    repositories {
3        google()
4        jcenter()
5    }
6
7    dependencies {
8        classpath 'com.android.tools.build:gradle:4.2.0'
9    }
10}
11
12allprojects {
13    repositories {
14        google()
15        jcenter()
16    }
17}
18
19rootProject.buildDir = '../build'
20subprojects {
21    project.buildDir = &quot;${rootProject.buildDir}/${project.name}&quot;
22}
23subprojects {
24    project.evaluationDependsOn(':app')
25}
26
27task clean(type: Delete) {
28    delete rootProject.buildDir
29}
30

and gradle-wrapper.properties:

1buildscript {
2    repositories {
3        google()
4        jcenter()
5    }
6
7    dependencies {
8        classpath 'com.android.tools.build:gradle:4.2.0'
9    }
10}
11
12allprojects {
13    repositories {
14        google()
15        jcenter()
16    }
17}
18
19rootProject.buildDir = '../build'
20subprojects {
21    project.buildDir = &quot;${rootProject.buildDir}/${project.name}&quot;
22}
23subprojects {
24    project.evaluationDependsOn(':app')
25}
26
27task clean(type: Delete) {
28    delete rootProject.buildDir
29}
30distributionBase=GRADLE_USER_HOME
31distributionPath=wrapper/dists
32zipStoreBase=GRADLE_USER_HOME
33zipStorePath=wrapper/dists
34distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
35

Also I have changed the compileSdkVersion , minSdkVersion and targetSdkVersion to be 30 but nothing happened.

ANSWER

Answered 2021-Dec-01 at 09:09

It looks like a temporary issue, the server with these libraries is down. I have the same problem now with Room:

1buildscript {
2    repositories {
3        google()
4        jcenter()
5    }
6
7    dependencies {
8        classpath 'com.android.tools.build:gradle:4.2.0'
9    }
10}
11
12allprojects {
13    repositories {
14        google()
15        jcenter()
16    }
17}
18
19rootProject.buildDir = '../build'
20subprojects {
21    project.buildDir = &quot;${rootProject.buildDir}/${project.name}&quot;
22}
23subprojects {
24    project.evaluationDependsOn(':app')
25}
26
27task clean(type: Delete) {
28    delete rootProject.buildDir
29}
30distributionBase=GRADLE_USER_HOME
31distributionPath=wrapper/dists
32zipStoreBase=GRADLE_USER_HOME
33zipStorePath=wrapper/dists
34distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
35Could not GET 'https://google.bintray.com/exoplayer/androidx/room/room-common/maven-metadata.xml'. Received status code 502 from server: Bad Gateway
36

You can try using offline mode if you're using Android Studio, then it will use the cached version of this library if you have it until it is fixed.

UPD. I switched to an alpha version of a flutter lib which caused this (workmanager) and it works well now. As far as I understand it was depending on an old version of Android Room library which is not available anymore since Bintray is not available. The new version of Room is available as it's being downloaded thorough another link. So for you the solution could be updating to a newer version of Flutter location package or forking it and changing the version of play-services-location to the most recent one.

Source https://stackoverflow.com/questions/70166663

QUESTION

The unauthenticated git protocol on port 9418 is no longer supported

Asked 2022-Mar-27 at 13:23

I have been using github actions for quite sometime but today my deployments started failing. Below is the error from github action logs

1Command: git
2Arguments: ls-remote --tags --heads git://github.com/adobe-webplatform/eve.git
3Directory: /home/runner/work/stackstream-fe/stackstream-fe
4Output:
5fatal: remote error: 
6  The unauthenticated git protocol on port 9418 is no longer supported.
7

Upon investigation, it appears that below section in my yml file is causing the issue.

1Command: git
2Arguments: ls-remote --tags --heads git://github.com/adobe-webplatform/eve.git
3Directory: /home/runner/work/stackstream-fe/stackstream-fe
4Output:
5fatal: remote error: 
6  The unauthenticated git protocol on port 9418 is no longer supported.
7    - name: Installing modules
8      run: yarn install
9

I have looked into this change log but can't seem to comprehend the issue.

Additional Details: Server: EC2 Instance Github actions steps:

1Command: git
2Arguments: ls-remote --tags --heads git://github.com/adobe-webplatform/eve.git
3Directory: /home/runner/work/stackstream-fe/stackstream-fe
4Output:
5fatal: remote error: 
6  The unauthenticated git protocol on port 9418 is no longer supported.
7    - name: Installing modules
8      run: yarn install
9  steps:
10  - name: Checkout
11    uses: actions/checkout@v2
12
13  - id: vars
14    run: |
15      if [ '${{ github.ref }}' == 'refs/heads/master' ]; then echo &quot;::set-output name=environment::prod_stackstream&quot; ; echo &quot;::set-output name=api-url::api&quot; ; elif [ '${{ github.ref }}' == 'refs/heads/staging' ]; then echo &quot;::set-output name=environment::staging_stackstream&quot;  ; echo &quot;::set-output name=api-url::stagingapi&quot; ; else echo &quot;::set-output name=environment::dev_stackstream&quot; ; echo &quot;::set-output name=api-url::devapi&quot; ; fi
16
17  - uses: pCYSl5EDgo/cat@master
18    id: slack
19    with:
20      path: .github/workflows/slack.txt
21
22  - name: Slack Start Notification
23    uses: 8398a7/action-slack@v3
24    env:
25      SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
26      ENVIRONMENT: '`${{ steps.vars.outputs.environment }}`'
27      COLOR: good
28      STATUS: '`Started`'
29    with:
30      status: custom
31      fields: workflow,job,commit,repo,ref,author,took
32      custom_payload: |
33        ${{ steps.slack.outputs.text }}
34
35  - name: Installing modules
36    env:
37      REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'
38    run: yarn install
39
40  - name: Create Frontend Build
41    env:
42      REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'
43    run: yarn build
44
45  - name: Deploy to Frontend Server DEV
46    if: ${{ contains(github.ref, 'dev') }}
47    uses: easingthemes/ssh-deploy@v2.1.5
48    env:
49      SSH_PRIVATE_KEY: ${{ secrets.DEV_KEY }}
50      ARGS: '-rltgoDzvO --delete'
51      SOURCE: 'deploy/'
52      REMOTE_HOST: ${{ secrets.DEV_HOST }}
53      REMOTE_USER: plyfolio-dev
54      TARGET: '/home/plyfolio-dev/${{ steps.vars.outputs.environment }}/fe/deploy'
55

package.json file

1Command: git
2Arguments: ls-remote --tags --heads git://github.com/adobe-webplatform/eve.git
3Directory: /home/runner/work/stackstream-fe/stackstream-fe
4Output:
5fatal: remote error: 
6  The unauthenticated git protocol on port 9418 is no longer supported.
7    - name: Installing modules
8      run: yarn install
9  steps:
10  - name: Checkout
11    uses: actions/checkout@v2
12
13  - id: vars
14    run: |
15      if [ '${{ github.ref }}' == 'refs/heads/master' ]; then echo &quot;::set-output name=environment::prod_stackstream&quot; ; echo &quot;::set-output name=api-url::api&quot; ; elif [ '${{ github.ref }}' == 'refs/heads/staging' ]; then echo &quot;::set-output name=environment::staging_stackstream&quot;  ; echo &quot;::set-output name=api-url::stagingapi&quot; ; else echo &quot;::set-output name=environment::dev_stackstream&quot; ; echo &quot;::set-output name=api-url::devapi&quot; ; fi
16
17  - uses: pCYSl5EDgo/cat@master
18    id: slack
19    with:
20      path: .github/workflows/slack.txt
21
22  - name: Slack Start Notification
23    uses: 8398a7/action-slack@v3
24    env:
25      SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
26      ENVIRONMENT: '`${{ steps.vars.outputs.environment }}`'
27      COLOR: good
28      STATUS: '`Started`'
29    with:
30      status: custom
31      fields: workflow,job,commit,repo,ref,author,took
32      custom_payload: |
33        ${{ steps.slack.outputs.text }}
34
35  - name: Installing modules
36    env:
37      REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'
38    run: yarn install
39
40  - name: Create Frontend Build
41    env:
42      REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'
43    run: yarn build
44
45  - name: Deploy to Frontend Server DEV
46    if: ${{ contains(github.ref, 'dev') }}
47    uses: easingthemes/ssh-deploy@v2.1.5
48    env:
49      SSH_PRIVATE_KEY: ${{ secrets.DEV_KEY }}
50      ARGS: '-rltgoDzvO --delete'
51      SOURCE: 'deploy/'
52      REMOTE_HOST: ${{ secrets.DEV_HOST }}
53      REMOTE_USER: plyfolio-dev
54      TARGET: '/home/plyfolio-dev/${{ steps.vars.outputs.environment }}/fe/deploy'
55   {
56  &quot;name&quot;: &quot;stackstream-fe&quot;,
57  &quot;version&quot;: &quot;1.0.0&quot;,
58  &quot;authors&quot;: [
59    &quot;fayyaznofal@gmail.com&quot;
60  ],
61  &quot;private&quot;: true,
62  &quot;dependencies&quot;: {
63    &quot;@fortawesome/fontawesome-svg-core&quot;: &quot;^1.2.34&quot;,
64    &quot;@fortawesome/free-solid-svg-icons&quot;: &quot;^5.15.2&quot;,
65    &quot;@fortawesome/react-fontawesome&quot;: &quot;^0.1.14&quot;,
66    &quot;@fullcalendar/bootstrap&quot;: &quot;^5.5.0&quot;,
67    &quot;@fullcalendar/core&quot;: &quot;^5.5.0&quot;,
68    &quot;@fullcalendar/daygrid&quot;: &quot;^5.5.0&quot;,
69    &quot;@fullcalendar/interaction&quot;: &quot;^5.5.0&quot;,
70    &quot;@fullcalendar/react&quot;: &quot;^5.5.0&quot;,
71    &quot;@lourenci/react-kanban&quot;: &quot;^2.1.0&quot;,
72    &quot;@redux-saga/simple-saga-monitor&quot;: &quot;^1.1.2&quot;,
73    &quot;@testing-library/jest-dom&quot;: &quot;^5.11.9&quot;,
74    &quot;@testing-library/react&quot;: &quot;^11.2.3&quot;,
75    &quot;@testing-library/user-event&quot;: &quot;^12.6.0&quot;,
76    &quot;@toast-ui/react-chart&quot;: &quot;^1.0.2&quot;,
77    &quot;@types/jest&quot;: &quot;^26.0.14&quot;,
78    &quot;@types/node&quot;: &quot;^14.10.3&quot;,
79    &quot;@types/react&quot;: &quot;^16.9.49&quot;,
80    &quot;@types/react-dom&quot;: &quot;^16.9.8&quot;,
81    &quot;@vtaits/react-color-picker&quot;: &quot;^0.1.1&quot;,
82    &quot;apexcharts&quot;: &quot;^3.23.1&quot;,
83    &quot;availity-reactstrap-validation&quot;: &quot;^2.7.0&quot;,
84    &quot;axios&quot;: &quot;^0.21.1&quot;,
85    &quot;axios-mock-adapter&quot;: &quot;^1.19.0&quot;,
86    &quot;axios-progress-bar&quot;: &quot;^1.2.0&quot;,
87    &quot;bootstrap&quot;: &quot;^5.0.0-beta2&quot;,
88    &quot;chart.js&quot;: &quot;^2.9.4&quot;,
89    &quot;chartist&quot;: &quot;^0.11.4&quot;,
90    &quot;classnames&quot;: &quot;^2.2.6&quot;,
91    &quot;components&quot;: &quot;^0.1.0&quot;,
92    &quot;dotenv&quot;: &quot;^8.2.0&quot;,
93    &quot;draft-js&quot;: &quot;^0.11.7&quot;,
94    &quot;echarts&quot;: &quot;^4.9.0&quot;,
95    &quot;echarts-for-react&quot;: &quot;^2.0.16&quot;,
96    &quot;firebase&quot;: &quot;^8.2.3&quot;,
97    &quot;google-maps-react&quot;: &quot;^2.0.6&quot;,
98    &quot;history&quot;: &quot;^4.10.1&quot;,
99    &quot;i&quot;: &quot;^0.3.6&quot;,
100    &quot;i18next&quot;: &quot;^19.8.4&quot;,
101    &quot;i18next-browser-languagedetector&quot;: &quot;^6.0.1&quot;,
102    &quot;jsonwebtoken&quot;: &quot;^8.5.1&quot;,
103    &quot;leaflet&quot;: &quot;^1.7.1&quot;,
104    &quot;lodash&quot;: &quot;^4.17.21&quot;,
105    &quot;lodash.clonedeep&quot;: &quot;^4.5.0&quot;,
106    &quot;lodash.get&quot;: &quot;^4.4.2&quot;,
107    &quot;metismenujs&quot;: &quot;^1.2.1&quot;,
108    &quot;mkdirp&quot;: &quot;^1.0.4&quot;,
109    &quot;moment&quot;: &quot;2.29.1&quot;,
110    &quot;moment-timezone&quot;: &quot;^0.5.32&quot;,
111    &quot;nouislider-react&quot;: &quot;^3.3.9&quot;,
112    &quot;npm&quot;: &quot;^7.6.3&quot;,
113    &quot;prop-types&quot;: &quot;^15.7.2&quot;,
114    &quot;query-string&quot;: &quot;^6.14.0&quot;,
115    &quot;react&quot;: &quot;^16.13.1&quot;,
116    &quot;react-apexcharts&quot;: &quot;^1.3.7&quot;,
117    &quot;react-auth-code-input&quot;: &quot;^1.0.0&quot;,
118    &quot;react-avatar&quot;: &quot;^3.10.0&quot;,
119    &quot;react-bootstrap&quot;: &quot;^1.5.0&quot;,
120    &quot;react-bootstrap-editable&quot;: &quot;^0.8.2&quot;,
121    &quot;react-bootstrap-sweetalert&quot;: &quot;^5.2.0&quot;,
122    &quot;react-bootstrap-table-next&quot;: &quot;^4.0.3&quot;,
123    &quot;react-bootstrap-table2-editor&quot;: &quot;^1.4.0&quot;,
124    &quot;react-bootstrap-table2-paginator&quot;: &quot;^2.1.2&quot;,
125    &quot;react-bootstrap-table2-toolkit&quot;: &quot;^2.1.3&quot;,
126    &quot;react-chartist&quot;: &quot;^0.14.3&quot;,
127    &quot;react-chartjs-2&quot;: &quot;^2.11.1&quot;,
128    &quot;react-color&quot;: &quot;^2.19.3&quot;,
129    &quot;react-confirm-alert&quot;: &quot;^2.7.0&quot;,
130    &quot;react-content-loader&quot;: &quot;^6.0.1&quot;,
131    &quot;react-countdown&quot;: &quot;^2.3.1&quot;,
132    &quot;react-countup&quot;: &quot;^4.3.3&quot;,
133    &quot;react-cropper&quot;: &quot;^2.1.4&quot;,
134    &quot;react-data-table-component&quot;: &quot;^6.11.8&quot;,
135    &quot;react-date-picker&quot;: &quot;^8.0.6&quot;,
136    &quot;react-datepicker&quot;: &quot;^3.4.1&quot;,
137    &quot;react-dom&quot;: &quot;^16.13.1&quot;,
138    &quot;react-draft-wysiwyg&quot;: &quot;^1.14.5&quot;,
139    &quot;react-drag-listview&quot;: &quot;^0.1.8&quot;,
140    &quot;react-drawer&quot;: &quot;^1.3.4&quot;,
141    &quot;react-dropzone&quot;: &quot;^11.2.4&quot;,
142    &quot;react-dual-listbox&quot;: &quot;^2.0.0&quot;,
143    &quot;react-facebook-login&quot;: &quot;^4.1.1&quot;,
144    &quot;react-flatpickr&quot;: &quot;^3.10.6&quot;,
145    &quot;react-google-login&quot;: &quot;^5.2.2&quot;,
146    &quot;react-hook-form&quot;: &quot;^7.15.2&quot;,
147    &quot;react-i18next&quot;: &quot;^11.8.5&quot;,
148    &quot;react-icons&quot;: &quot;^4.2.0&quot;,
149    &quot;react-image-lightbox&quot;: &quot;^5.1.1&quot;,
150    &quot;react-input-mask&quot;: &quot;^2.0.4&quot;,
151    &quot;react-jvectormap&quot;: &quot;^0.0.16&quot;,
152    &quot;react-leaflet&quot;: &quot;^3.0.5&quot;,
153    &quot;react-meta-tags&quot;: &quot;^1.0.1&quot;,
154    &quot;react-modal-video&quot;: &quot;^1.2.6&quot;,
155    &quot;react-notifications&quot;: &quot;^1.7.2&quot;,
156    &quot;react-number-format&quot;: &quot;^4.7.3&quot;,
157    &quot;react-perfect-scrollbar&quot;: &quot;^1.5.8&quot;,
158    &quot;react-rangeslider&quot;: &quot;^2.2.0&quot;,
159    &quot;react-rating&quot;: &quot;^2.0.5&quot;,
160    &quot;react-rating-tooltip&quot;: &quot;^1.1.6&quot;,
161    &quot;react-redux&quot;: &quot;^7.2.1&quot;,
162    &quot;react-responsive-carousel&quot;: &quot;^3.2.11&quot;,
163    &quot;react-router-dom&quot;: &quot;^5.2.0&quot;,
164    &quot;react-script&quot;: &quot;^2.0.5&quot;,
165    &quot;react-scripts&quot;: &quot;3.4.3&quot;,
166    &quot;react-select&quot;: &quot;^4.3.1&quot;,
167    &quot;react-sparklines&quot;: &quot;^1.7.0&quot;,
168    &quot;react-star-ratings&quot;: &quot;^2.3.0&quot;,
169    &quot;react-super-responsive-table&quot;: &quot;^5.2.0&quot;,
170    &quot;react-switch&quot;: &quot;^6.0.0&quot;,
171    &quot;react-table&quot;: &quot;^7.6.3&quot;,
172    &quot;react-toastify&quot;: &quot;^7.0.3&quot;,
173    &quot;react-toastr&quot;: &quot;^3.0.0&quot;,
174    &quot;react-twitter-auth&quot;: &quot;0.0.13&quot;,
175    &quot;reactstrap&quot;: &quot;^8.8.1&quot;,
176    &quot;recharts&quot;: &quot;^2.0.8&quot;,
177    &quot;redux&quot;: &quot;^4.0.5&quot;,
178    &quot;redux-saga&quot;: &quot;^1.1.3&quot;,
179    &quot;reselect&quot;: &quot;^4.0.0&quot;,
180    &quot;sass&quot;: &quot;^1.37.5&quot;,
181    &quot;simplebar-react&quot;: &quot;^2.3.0&quot;,
182    &quot;styled&quot;: &quot;^1.0.0&quot;,
183    &quot;styled-components&quot;: &quot;^5.2.1&quot;,
184    &quot;toastr&quot;: &quot;^2.1.4&quot;,
185    &quot;typescript&quot;: &quot;^4.0.2&quot;,
186    &quot;universal-cookie&quot;: &quot;^4.0.4&quot;
187  },
188  &quot;devDependencies&quot;: {
189    &quot;@typescript-eslint/eslint-plugin&quot;: &quot;^2.27.0&quot;,
190    &quot;@typescript-eslint/parser&quot;: &quot;^2.27.0&quot;,
191    &quot;@typescript-eslint/typescript-estree&quot;: &quot;^4.15.2&quot;,
192    &quot;eslint-config-prettier&quot;: &quot;^6.10.1&quot;,
193    &quot;eslint-plugin-prettier&quot;: &quot;^3.1.2&quot;,
194    &quot;husky&quot;: &quot;^4.2.5&quot;,
195    &quot;lint-staged&quot;: &quot;^10.1.3&quot;,
196    &quot;prettier&quot;: &quot;^1.19.1&quot;,
197    &quot;react-test-renderer&quot;: &quot;^16.13.1&quot;,
198    &quot;redux-devtools-extension&quot;: &quot;^2.13.8&quot;,
199    &quot;redux-mock-store&quot;: &quot;^1.5.4&quot;
200  },
201  &quot;scripts&quot;: {
202    &quot;start&quot;: &quot;react-scripts start&quot;,
203    &quot;build&quot;: &quot;react-scripts build &amp;&amp; mv build ./deploy/build&quot;,
204    &quot;build-local&quot;: &quot;react-scripts build&quot;,
205    &quot;test&quot;: &quot;react-scripts test&quot;,
206    &quot;eject&quot;: &quot;react-scripts eject&quot;
207  },
208  &quot;eslintConfig&quot;: {
209    &quot;extends&quot;: &quot;react-app&quot;
210  },
211  &quot;husky&quot;: {
212    &quot;hooks&quot;: {
213      &quot;pre-commit&quot;: &quot;lint-staged&quot;
214    }
215  },
216  &quot;lint-staged&quot;: {
217    &quot;*.{js,ts,tsx}&quot;: [
218      &quot;eslint --fix&quot;
219    ]
220  },
221  &quot;browserslist&quot;: {
222    &quot;production&quot;: [
223      &quot;&gt;0.2%&quot;,
224      &quot;not dead&quot;,
225      &quot;not op_mini all&quot;
226    ],
227    &quot;development&quot;: [
228      &quot;last 1 chrome version&quot;,
229      &quot;last 1 firefox version&quot;,
230      &quot;last 1 safari version&quot;
231    ]
232  }
233}
234

ANSWER

Answered 2022-Mar-16 at 07:01

First, this error message is indeed expected on Jan. 11th, 2022.
See "Improving Git protocol security on GitHub".

January 11, 2022 Final brownout.

This is the full brownout period where we’ll temporarily stop accepting the deprecated key and signature types, ciphers, and MACs, and the unencrypted Git protocol.
This will help clients discover any lingering use of older keys or old URLs.

Second, check your package.json dependencies for any git:// URL, as in this example, fixed in this PR.

As noted by Jörg W Mittag:

There was a 4-month warning.
The entire Internet has been moving away from unauthenticated, unencrypted protocols for a decade, it's not like this is a huge surprise.

Personally, I consider it less an "issue" and more "detecting unmaintained dependencies".

Plus, this is still only the brownout period, so the protocol will only be disabled for a short period of time, allowing developers to discover the problem.

The permanent shutdown is not until March 15th.


For GitHub Actions:

As in actions/checkout issue 14, you can add as a first step:

1Command: git
2Arguments: ls-remote --tags --heads git://github.com/adobe-webplatform/eve.git
3Directory: /home/runner/work/stackstream-fe/stackstream-fe
4Output:
5fatal: remote error: 
6  The unauthenticated git protocol on port 9418 is no longer supported.
7    - name: Installing modules
8      run: yarn install
9  steps:
10  - name: Checkout
11    uses: actions/checkout@v2
12
13  - id: vars
14    run: |
15      if [ '${{ github.ref }}' == 'refs/heads/master' ]; then echo &quot;::set-output name=environment::prod_stackstream&quot; ; echo &quot;::set-output name=api-url::api&quot; ; elif [ '${{ github.ref }}' == 'refs/heads/staging' ]; then echo &quot;::set-output name=environment::staging_stackstream&quot;  ; echo &quot;::set-output name=api-url::stagingapi&quot; ; else echo &quot;::set-output name=environment::dev_stackstream&quot; ; echo &quot;::set-output name=api-url::devapi&quot; ; fi
16
17  - uses: pCYSl5EDgo/cat@master
18    id: slack
19    with:
20      path: .github/workflows/slack.txt
21
22  - name: Slack Start Notification
23    uses: 8398a7/action-slack@v3
24    env:
25      SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
26      ENVIRONMENT: '`${{ steps.vars.outputs.environment }}`'
27      COLOR: good
28      STATUS: '`Started`'
29    with:
30      status: custom
31      fields: workflow,job,commit,repo,ref,author,took
32      custom_payload: |
33        ${{ steps.slack.outputs.text }}
34
35  - name: Installing modules
36    env:
37      REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'
38    run: yarn install
39
40  - name: Create Frontend Build
41    env:
42      REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'
43    run: yarn build
44
45  - name: Deploy to Frontend Server DEV
46    if: ${{ contains(github.ref, 'dev') }}
47    uses: easingthemes/ssh-deploy@v2.1.5
48    env:
49      SSH_PRIVATE_KEY: ${{ secrets.DEV_KEY }}
50      ARGS: '-rltgoDzvO --delete'
51      SOURCE: 'deploy/'
52      REMOTE_HOST: ${{ secrets.DEV_HOST }}
53      REMOTE_USER: plyfolio-dev
54      TARGET: '/home/plyfolio-dev/${{ steps.vars.outputs.environment }}/fe/deploy'
55   {
56  &quot;name&quot;: &quot;stackstream-fe&quot;,
57  &quot;version&quot;: &quot;1.0.0&quot;,
58  &quot;authors&quot;: [
59    &quot;fayyaznofal@gmail.com&quot;
60  ],
61  &quot;private&quot;: true,
62  &quot;dependencies&quot;: {
63    &quot;@fortawesome/fontawesome-svg-core&quot;: &quot;^1.2.34&quot;,
64    &quot;@fortawesome/free-solid-svg-icons&quot;: &quot;^5.15.2&quot;,
65    &quot;@fortawesome/react-fontawesome&quot;: &quot;^0.1.14&quot;,
66    &quot;@fullcalendar/bootstrap&quot;: &quot;^5.5.0&quot;,
67    &quot;@fullcalendar/core&quot;: &quot;^5.5.0&quot;,
68    &quot;@fullcalendar/daygrid&quot;: &quot;^5.5.0&quot;,
69    &quot;@fullcalendar/interaction&quot;: &quot;^5.5.0&quot;,
70    &quot;@fullcalendar/react&quot;: &quot;^5.5.0&quot;,
71    &quot;@lourenci/react-kanban&quot;: &quot;^2.1.0&quot;,
72    &quot;@redux-saga/simple-saga-monitor&quot;: &quot;^1.1.2&quot;,
73    &quot;@testing-library/jest-dom&quot;: &quot;^5.11.9&quot;,
74    &quot;@testing-library/react&quot;: &quot;^11.2.3&quot;,
75    &quot;@testing-library/user-event&quot;: &quot;^12.6.0&quot;,
76    &quot;@toast-ui/react-chart&quot;: &quot;^1.0.2&quot;,
77    &quot;@types/jest&quot;: &quot;^26.0.14&quot;,
78    &quot;@types/node&quot;: &quot;^14.10.3&quot;,
79    &quot;@types/react&quot;: &quot;^16.9.49&quot;,
80    &quot;@types/react-dom&quot;: &quot;^16.9.8&quot;,
81    &quot;@vtaits/react-color-picker&quot;: &quot;^0.1.1&quot;,
82    &quot;apexcharts&quot;: &quot;^3.23.1&quot;,
83    &quot;availity-reactstrap-validation&quot;: &quot;^2.7.0&quot;,
84    &quot;axios&quot;: &quot;^0.21.1&quot;,
85    &quot;axios-mock-adapter&quot;: &quot;^1.19.0&quot;,
86    &quot;axios-progress-bar&quot;: &quot;^1.2.0&quot;,
87    &quot;bootstrap&quot;: &quot;^5.0.0-beta2&quot;,
88    &quot;chart.js&quot;: &quot;^2.9.4&quot;,
89    &quot;chartist&quot;: &quot;^0.11.4&quot;,
90    &quot;classnames&quot;: &quot;^2.2.6&quot;,
91    &quot;components&quot;: &quot;^0.1.0&quot;,
92    &quot;dotenv&quot;: &quot;^8.2.0&quot;,
93    &quot;draft-js&quot;: &quot;^0.11.7&quot;,
94    &quot;echarts&quot;: &quot;^4.9.0&quot;,
95    &quot;echarts-for-react&quot;: &quot;^2.0.16&quot;,
96    &quot;firebase&quot;: &quot;^8.2.3&quot;,
97    &quot;google-maps-react&quot;: &quot;^2.0.6&quot;,
98    &quot;history&quot;: &quot;^4.10.1&quot;,
99    &quot;i&quot;: &quot;^0.3.6&quot;,
100    &quot;i18next&quot;: &quot;^19.8.4&quot;,
101    &quot;i18next-browser-languagedetector&quot;: &quot;^6.0.1&quot;,
102    &quot;jsonwebtoken&quot;: &quot;^8.5.1&quot;,
103    &quot;leaflet&quot;: &quot;^1.7.1&quot;,
104    &quot;lodash&quot;: &quot;^4.17.21&quot;,
105    &quot;lodash.clonedeep&quot;: &quot;^4.5.0&quot;,
106    &quot;lodash.get&quot;: &quot;^4.4.2&quot;,
107    &quot;metismenujs&quot;: &quot;^1.2.1&quot;,
108    &quot;mkdirp&quot;: &quot;^1.0.4&quot;,
109    &quot;moment&quot;: &quot;2.29.1&quot;,
110    &quot;moment-timezone&quot;: &quot;^0.5.32&quot;,
111    &quot;nouislider-react&quot;: &quot;^3.3.9&quot;,
112    &quot;npm&quot;: &quot;^7.6.3&quot;,
113    &quot;prop-types&quot;: &quot;^15.7.2&quot;,
114    &quot;query-string&quot;: &quot;^6.14.0&quot;,
115    &quot;react&quot;: &quot;^16.13.1&quot;,
116    &quot;react-apexcharts&quot;: &quot;^1.3.7&quot;,
117    &quot;react-auth-code-input&quot;: &quot;^1.0.0&quot;,
118    &quot;react-avatar&quot;: &quot;^3.10.0&quot;,
119    &quot;react-bootstrap&quot;: &quot;^1.5.0&quot;,
120    &quot;react-bootstrap-editable&quot;: &quot;^0.8.2&quot;,
121    &quot;react-bootstrap-sweetalert&quot;: &quot;^5.2.0&quot;,
122    &quot;react-bootstrap-table-next&quot;: &quot;^4.0.3&quot;,
123    &quot;react-bootstrap-table2-editor&quot;: &quot;^1.4.0&quot;,
124    &quot;react-bootstrap-table2-paginator&quot;: &quot;^2.1.2&quot;,
125    &quot;react-bootstrap-table2-toolkit&quot;: &quot;^2.1.3&quot;,
126    &quot;react-chartist&quot;: &quot;^0.14.3&quot;,
127    &quot;react-chartjs-2&quot;: &quot;^2.11.1&quot;,
128    &quot;react-color&quot;: &quot;^2.19.3&quot;,
129    &quot;react-confirm-alert&quot;: &quot;^2.7.0&quot;,
130    &quot;react-content-loader&quot;: &quot;^6.0.1&quot;,
131    &quot;react-countdown&quot;: &quot;^2.3.1&quot;,
132    &quot;react-countup&quot;: &quot;^4.3.3&quot;,
133    &quot;react-cropper&quot;: &quot;^2.1.4&quot;,
134    &quot;react-data-table-component&quot;: &quot;^6.11.8&quot;,
135    &quot;react-date-picker&quot;: &quot;^8.0.6&quot;,
136    &quot;react-datepicker&quot;: &quot;^3.4.1&quot;,
137    &quot;react-dom&quot;: &quot;^16.13.1&quot;,
138    &quot;react-draft-wysiwyg&quot;: &quot;^1.14.5&quot;,
139    &quot;react-drag-listview&quot;: &quot;^0.1.8&quot;,
140    &quot;react-drawer&quot;: &quot;^1.3.4&quot;,
141    &quot;react-dropzone&quot;: &quot;^11.2.4&quot;,
142    &quot;react-dual-listbox&quot;: &quot;^2.0.0&quot;,
143    &quot;react-facebook-login&quot;: &quot;^4.1.1&quot;,
144    &quot;react-flatpickr&quot;: &quot;^3.10.6&quot;,
145    &quot;react-google-login&quot;: &quot;^5.2.2&quot;,
146    &quot;react-hook-form&quot;: &quot;^7.15.2&quot;,
147    &quot;react-i18next&quot;: &quot;^11.8.5&quot;,
148    &quot;react-icons&quot;: &quot;^4.2.0&quot;,
149    &quot;react-image-lightbox&quot;: &quot;^5.1.1&quot;,
150    &quot;react-input-mask&quot;: &quot;^2.0.4&quot;,
151    &quot;react-jvectormap&quot;: &quot;^0.0.16&quot;,
152    &quot;react-leaflet&quot;: &quot;^3.0.5&quot;,
153    &quot;react-meta-tags&quot;: &quot;^1.0.1&quot;,
154    &quot;react-modal-video&quot;: &quot;^1.2.6&quot;,
155    &quot;react-notifications&quot;: &quot;^1.7.2&quot;,
156    &quot;react-number-format&quot;: &quot;^4.7.3&quot;,
157    &quot;react-perfect-scrollbar&quot;: &quot;^1.5.8&quot;,
158    &quot;react-rangeslider&quot;: &quot;^2.2.0&quot;,
159    &quot;react-rating&quot;: &quot;^2.0.5&quot;,
160    &quot;react-rating-tooltip&quot;: &quot;^1.1.6&quot;,
161    &quot;react-redux&quot;: &quot;^7.2.1&quot;,
162    &quot;react-responsive-carousel&quot;: &quot;^3.2.11&quot;,
163    &quot;react-router-dom&quot;: &quot;^5.2.0&quot;,
164    &quot;react-script&quot;: &quot;^2.0.5&quot;,
165    &quot;react-scripts&quot;: &quot;3.4.3&quot;,
166    &quot;react-select&quot;: &quot;^4.3.1&quot;,
167    &quot;react-sparklines&quot;: &quot;^1.7.0&quot;,
168    &quot;react-star-ratings&quot;: &quot;^2.3.0&quot;,
169    &quot;react-super-responsive-table&quot;: &quot;^5.2.0&quot;,
170    &quot;react-switch&quot;: &quot;^6.0.0&quot;,
171    &quot;react-table&quot;: &quot;^7.6.3&quot;,
172    &quot;react-toastify&quot;: &quot;^7.0.3&quot;,
173    &quot;react-toastr&quot;: &quot;^3.0.0&quot;,
174    &quot;react-twitter-auth&quot;: &quot;0.0.13&quot;,
175    &quot;reactstrap&quot;: &quot;^8.8.1&quot;,
176    &quot;recharts&quot;: &quot;^2.0.8&quot;,
177    &quot;redux&quot;: &quot;^4.0.5&quot;,
178    &quot;redux-saga&quot;: &quot;^1.1.3&quot;,
179    &quot;reselect&quot;: &quot;^4.0.0&quot;,
180    &quot;sass&quot;: &quot;^1.37.5&quot;,
181    &quot;simplebar-react&quot;: &quot;^2.3.0&quot;,
182    &quot;styled&quot;: &quot;^1.0.0&quot;,
183    &quot;styled-components&quot;: &quot;^5.2.1&quot;,
184    &quot;toastr&quot;: &quot;^2.1.4&quot;,
185    &quot;typescript&quot;: &quot;^4.0.2&quot;,
186    &quot;universal-cookie&quot;: &quot;^4.0.4&quot;
187  },
188  &quot;devDependencies&quot;: {
189    &quot;@typescript-eslint/eslint-plugin&quot;: &quot;^2.27.0&quot;,
190    &quot;@typescript-eslint/parser&quot;: &quot;^2.27.0&quot;,
191    &quot;@typescript-eslint/typescript-estree&quot;: &quot;^4.15.2&quot;,
192    &quot;eslint-config-prettier&quot;: &quot;^6.10.1&quot;,
193    &quot;eslint-plugin-prettier&quot;: &quot;^3.1.2&quot;,
194    &quot;husky&quot;: &quot;^4.2.5&quot;,
195    &quot;lint-staged&quot;: &quot;^10.1.3&quot;,
196    &quot;prettier&quot;: &quot;^1.19.1&quot;,
197    &quot;react-test-renderer&quot;: &quot;^16.13.1&quot;,
198    &quot;redux-devtools-extension&quot;: &quot;^2.13.8&quot;,
199    &quot;redux-mock-store&quot;: &quot;^1.5.4&quot;
200  },
201  &quot;scripts&quot;: {
202    &quot;start&quot;: &quot;react-scripts start&quot;,
203    &quot;build&quot;: &quot;react-scripts build &amp;&amp; mv build ./deploy/build&quot;,
204    &quot;build-local&quot;: &quot;react-scripts build&quot;,
205    &quot;test&quot;: &quot;react-scripts test&quot;,
206    &quot;eject&quot;: &quot;react-scripts eject&quot;
207  },
208  &quot;eslintConfig&quot;: {
209    &quot;extends&quot;: &quot;react-app&quot;
210  },
211  &quot;husky&quot;: {
212    &quot;hooks&quot;: {
213      &quot;pre-commit&quot;: &quot;lint-staged&quot;
214    }
215  },
216  &quot;lint-staged&quot;: {
217    &quot;*.{js,ts,tsx}&quot;: [
218      &quot;eslint --fix&quot;
219    ]
220  },
221  &quot;browserslist&quot;: {
222    &quot;production&quot;: [
223      &quot;&gt;0.2%&quot;,
224      &quot;not dead&quot;,
225      &quot;not op_mini all&quot;
226    ],
227    &quot;development&quot;: [
228      &quot;last 1 chrome version&quot;,
229      &quot;last 1 firefox version&quot;,
230      &quot;last 1 safari version&quot;
231    ]
232  }
233}
234    - name: Fix up git URLs
235      run: echo -e '[url &quot;https://github.com/&quot;]\n  insteadOf = &quot;git://github.com/&quot;' &gt;&gt; ~/.gitconfig
236

That will change any git://github.com/ into https://github.com/.

For local projects

For all your repositories, you can set:

1Command: git
2Arguments: ls-remote --tags --heads git://github.com/adobe-webplatform/eve.git
3Directory: /home/runner/work/stackstream-fe/stackstream-fe
4Output:
5fatal: remote error: 
6  The unauthenticated git protocol on port 9418 is no longer supported.
7    - name: Installing modules
8      run: yarn install
9  steps:
10  - name: Checkout
11    uses: actions/checkout@v2
12
13  - id: vars
14    run: |
15      if [ '${{ github.ref }}' == 'refs/heads/master' ]; then echo &quot;::set-output name=environment::prod_stackstream&quot; ; echo &quot;::set-output name=api-url::api&quot; ; elif [ '${{ github.ref }}' == 'refs/heads/staging' ]; then echo &quot;::set-output name=environment::staging_stackstream&quot;  ; echo &quot;::set-output name=api-url::stagingapi&quot; ; else echo &quot;::set-output name=environment::dev_stackstream&quot; ; echo &quot;::set-output name=api-url::devapi&quot; ; fi
16
17  - uses: pCYSl5EDgo/cat@master
18    id: slack
19    with:
20      path: .github/workflows/slack.txt
21
22  - name: Slack Start Notification
23    uses: 8398a7/action-slack@v3
24    env:
25      SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
26      ENVIRONMENT: '`${{ steps.vars.outputs.environment }}`'
27      COLOR: good
28      STATUS: '`Started`'
29    with:
30      status: custom
31      fields: workflow,job,commit,repo,ref,author,took
32      custom_payload: |
33        ${{ steps.slack.outputs.text }}
34
35  - name: Installing modules
36    env:
37      REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'
38    run: yarn install
39
40  - name: Create Frontend Build
41    env:
42      REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'
43    run: yarn build
44
45  - name: Deploy to Frontend Server DEV
46    if: ${{ contains(github.ref, 'dev') }}
47    uses: easingthemes/ssh-deploy@v2.1.5
48    env:
49      SSH_PRIVATE_KEY: ${{ secrets.DEV_KEY }}
50      ARGS: '-rltgoDzvO --delete'
51      SOURCE: 'deploy/'
52      REMOTE_HOST: ${{ secrets.DEV_HOST }}
53      REMOTE_USER: plyfolio-dev
54      TARGET: '/home/plyfolio-dev/${{ steps.vars.outputs.environment }}/fe/deploy'
55   {
56  &quot;name&quot;: &quot;stackstream-fe&quot;,
57  &quot;version&quot;: &quot;1.0.0&quot;,
58  &quot;authors&quot;: [
59    &quot;fayyaznofal@gmail.com&quot;
60  ],
61  &quot;private&quot;: true,
62  &quot;dependencies&quot;: {
63    &quot;@fortawesome/fontawesome-svg-core&quot;: &quot;^1.2.34&quot;,
64    &quot;@fortawesome/free-solid-svg-icons&quot;: &quot;^5.15.2&quot;,
65    &quot;@fortawesome/react-fontawesome&quot;: &quot;^0.1.14&quot;,
66    &quot;@fullcalendar/bootstrap&quot;: &quot;^5.5.0&quot;,
67    &quot;@fullcalendar/core&quot;: &quot;^5.5.0&quot;,
68    &quot;@fullcalendar/daygrid&quot;: &quot;^5.5.0&quot;,
69    &quot;@fullcalendar/interaction&quot;: &quot;^5.5.0&quot;,
70    &quot;@fullcalendar/react&quot;: &quot;^5.5.0&quot;,
71    &quot;@lourenci/react-kanban&quot;: &quot;^2.1.0&quot;,
72    &quot;@redux-saga/simple-saga-monitor&quot;: &quot;^1.1.2&quot;,
73    &quot;@testing-library/jest-dom&quot;: &quot;^5.11.9&quot;,
74    &quot;@testing-library/react&quot;: &quot;^11.2.3&quot;,
75    &quot;@testing-library/user-event&quot;: &quot;^12.6.0&quot;,
76    &quot;@toast-ui/react-chart&quot;: &quot;^1.0.2&quot;,
77    &quot;@types/jest&quot;: &quot;^26.0.14&quot;,
78    &quot;@types/node&quot;: &quot;^14.10.3&quot;,
79    &quot;@types/react&quot;: &quot;^16.9.49&quot;,
80    &quot;@types/react-dom&quot;: &quot;^16.9.8&quot;,
81    &quot;@vtaits/react-color-picker&quot;: &quot;^0.1.1&quot;,
82    &quot;apexcharts&quot;: &quot;^3.23.1&quot;,
83    &quot;availity-reactstrap-validation&quot;: &quot;^2.7.0&quot;,
84    &quot;axios&quot;: &quot;^0.21.1&quot;,
85    &quot;axios-mock-adapter&quot;: &quot;^1.19.0&quot;,
86    &quot;axios-progress-bar&quot;: &quot;^1.2.0&quot;,
87    &quot;bootstrap&quot;: &quot;^5.0.0-beta2&quot;,
88    &quot;chart.js&quot;: &quot;^2.9.4&quot;,
89    &quot;chartist&quot;: &quot;^0.11.4&quot;,
90    &quot;classnames&quot;: &quot;^2.2.6&quot;,
91    &quot;components&quot;: &quot;^0.1.0&quot;,
92    &quot;dotenv&quot;: &quot;^8.2.0&quot;,
93    &quot;draft-js&quot;: &quot;^0.11.7&quot;,
94    &quot;echarts&quot;: &quot;^4.9.0&quot;,
95    &quot;echarts-for-react&quot;: &quot;^2.0.16&quot;,
96    &quot;firebase&quot;: &quot;^8.2.3&quot;,
97    &quot;google-maps-react&quot;: &quot;^2.0.6&quot;,
98    &quot;history&quot;: &quot;^4.10.1&quot;,
99    &quot;i&quot;: &quot;^0.3.6&quot;,
100    &quot;i18next&quot;: &quot;^19.8.4&quot;,
101    &quot;i18next-browser-languagedetector&quot;: &quot;^6.0.1&quot;,
102    &quot;jsonwebtoken&quot;: &quot;^8.5.1&quot;,
103    &quot;leaflet&quot;: &quot;^1.7.1&quot;,
104    &quot;lodash&quot;: &quot;^4.17.21&quot;,
105    &quot;lodash.clonedeep&quot;: &quot;^4.5.0&quot;,
106    &quot;lodash.get&quot;: &quot;^4.4.2&quot;,
107    &quot;metismenujs&quot;: &quot;^1.2.1&quot;,
108    &quot;mkdirp&quot;: &quot;^1.0.4&quot;,
109    &quot;moment&quot;: &quot;2.29.1&quot;,
110    &quot;moment-timezone&quot;: &quot;^0.5.32&quot;,
111    &quot;nouislider-react&quot;: &quot;^3.3.9&quot;,
112    &quot;npm&quot;: &quot;^7.6.3&quot;,
113    &quot;prop-types&quot;: &quot;^15.7.2&quot;,
114    &quot;query-string&quot;: &quot;^6.14.0&quot;,
115    &quot;react&quot;: &quot;^16.13.1&quot;,
116    &quot;react-apexcharts&quot;: &quot;^1.3.7&quot;,
117    &quot;react-auth-code-input&quot;: &quot;^1.0.0&quot;,
118    &quot;react-avatar&quot;: &quot;^3.10.0&quot;,
119    &quot;react-bootstrap&quot;: &quot;^1.5.0&quot;,
120    &quot;react-bootstrap-editable&quot;: &quot;^0.8.2&quot;,
121    &quot;react-bootstrap-sweetalert&quot;: &quot;^5.2.0&quot;,
122    &quot;react-bootstrap-table-next&quot;: &quot;^4.0.3&quot;,
123    &quot;react-bootstrap-table2-editor&quot;: &quot;^1.4.0&quot;,
124    &quot;react-bootstrap-table2-paginator&quot;: &quot;^2.1.2&quot;,
125    &quot;react-bootstrap-table2-toolkit&quot;: &quot;^2.1.3&quot;,
126    &quot;react-chartist&quot;: &quot;^0.14.3&quot;,
127    &quot;react-chartjs-2&quot;: &quot;^2.11.1&quot;,
128    &quot;react-color&quot;: &quot;^2.19.3&quot;,
129    &quot;react-confirm-alert&quot;: &quot;^2.7.0&quot;,
130    &quot;react-content-loader&quot;: &quot;^6.0.1&quot;,
131    &quot;react-countdown&quot;: &quot;^2.3.1&quot;,
132    &quot;react-countup&quot;: &quot;^4.3.3&quot;,
133    &quot;react-cropper&quot;: &quot;^2.1.4&quot;,
134    &quot;react-data-table-component&quot;: &quot;^6.11.8&quot;,
135    &quot;react-date-picker&quot;: &quot;^8.0.6&quot;,
136    &quot;react-datepicker&quot;: &quot;^3.4.1&quot;,
137    &quot;react-dom&quot;: &quot;^16.13.1&quot;,
138    &quot;react-draft-wysiwyg&quot;: &quot;^1.14.5&quot;,
139    &quot;react-drag-listview&quot;: &quot;^0.1.8&quot;,
140    &quot;react-drawer&quot;: &quot;^1.3.4&quot;,
141    &quot;react-dropzone&quot;: &quot;^11.2.4&quot;,
142    &quot;react-dual-listbox&quot;: &quot;^2.0.0&quot;,
143    &quot;react-facebook-login&quot;: &quot;^4.1.1&quot;,
144    &quot;react-flatpickr&quot;: &quot;^3.10.6&quot;,
145    &quot;react-google-login&quot;: &quot;^5.2.2&quot;,
146    &quot;react-hook-form&quot;: &quot;^7.15.2&quot;,
147    &quot;react-i18next&quot;: &quot;^11.8.5&quot;,
148    &quot;react-icons&quot;: &quot;^4.2.0&quot;,
149    &quot;react-image-lightbox&quot;: &quot;^5.1.1&quot;,
150    &quot;react-input-mask&quot;: &quot;^2.0.4&quot;,
151    &quot;react-jvectormap&quot;: &quot;^0.0.16&quot;,
152    &quot;react-leaflet&quot;: &quot;^3.0.5&quot;,
153    &quot;react-meta-tags&quot;: &quot;^1.0.1&quot;,
154    &quot;react-modal-video&quot;: &quot;^1.2.6&quot;,
155    &quot;react-notifications&quot;: &quot;^1.7.2&quot;,
156    &quot;react-number-format&quot;: &quot;^4.7.3&quot;,
157    &quot;react-perfect-scrollbar&quot;: &quot;^1.5.8&quot;,
158    &quot;react-rangeslider&quot;: &quot;^2.2.0&quot;,
159    &quot;react-rating&quot;: &quot;^2.0.5&quot;,
160    &quot;react-rating-tooltip&quot;: &quot;^1.1.6&quot;,
161    &quot;react-redux&quot;: &quot;^7.2.1&quot;,
162    &quot;react-responsive-carousel&quot;: &quot;^3.2.11&quot;,
163    &quot;react-router-dom&quot;: &quot;^5.2.0&quot;,
164    &quot;react-script&quot;: &quot;^2.0.5&quot;,
165    &quot;react-scripts&quot;: &quot;3.4.3&quot;,
166    &quot;react-select&quot;: &quot;^4.3.1&quot;,
167    &quot;react-sparklines&quot;: &quot;^1.7.0&quot;,
168    &quot;react-star-ratings&quot;: &quot;^2.3.0&quot;,
169    &quot;react-super-responsive-table&quot;: &quot;^5.2.0&quot;,
170    &quot;react-switch&quot;: &quot;^6.0.0&quot;,
171    &quot;react-table&quot;: &quot;^7.6.3&quot;,
172    &quot;react-toastify&quot;: &quot;^7.0.3&quot;,
173    &quot;react-toastr&quot;: &quot;^3.0.0&quot;,
174    &quot;react-twitter-auth&quot;: &quot;0.0.13&quot;,
175    &quot;reactstrap&quot;: &quot;^8.8.1&quot;,
176    &quot;recharts&quot;: &quot;^2.0.8&quot;,
177    &quot;redux&quot;: &quot;^4.0.5&quot;,
178    &quot;redux-saga&quot;: &quot;^1.1.3&quot;,
179    &quot;reselect&quot;: &quot;^4.0.0&quot;,
180    &quot;sass&quot;: &quot;^1.37.5&quot;,
181    &quot;simplebar-react&quot;: &quot;^2.3.0&quot;,
182    &quot;styled&quot;: &quot;^1.0.0&quot;,
183    &quot;styled-components&quot;: &quot;^5.2.1&quot;,
184    &quot;toastr&quot;: &quot;^2.1.4&quot;,
185    &quot;typescript&quot;: &quot;^4.0.2&quot;,
186    &quot;universal-cookie&quot;: &quot;^4.0.4&quot;
187  },
188  &quot;devDependencies&quot;: {
189    &quot;@typescript-eslint/eslint-plugin&quot;: &quot;^2.27.0&quot;,
190    &quot;@typescript-eslint/parser&quot;: &quot;^2.27.0&quot;,
191    &quot;@typescript-eslint/typescript-estree&quot;: &quot;^4.15.2&quot;,
192    &quot;eslint-config-prettier&quot;: &quot;^6.10.1&quot;,
193    &quot;eslint-plugin-prettier&quot;: &quot;^3.1.2&quot;,
194    &quot;husky&quot;: &quot;^4.2.5&quot;,
195    &quot;lint-staged&quot;: &quot;^10.1.3&quot;,
196    &quot;prettier&quot;: &quot;^1.19.1&quot;,
197    &quot;react-test-renderer&quot;: &quot;^16.13.1&quot;,
198    &quot;redux-devtools-extension&quot;: &quot;^2.13.8&quot;,
199    &quot;redux-mock-store&quot;: &quot;^1.5.4&quot;
200  },
201  &quot;scripts&quot;: {
202    &quot;start&quot;: &quot;react-scripts start&quot;,
203    &quot;build&quot;: &quot;react-scripts build &amp;&amp; mv build ./deploy/build&quot;,
204    &quot;build-local&quot;: &quot;react-scripts build&quot;,
205    &quot;test&quot;: &quot;react-scripts test&quot;,
206    &quot;eject&quot;: &quot;react-scripts eject&quot;
207  },
208  &quot;eslintConfig&quot;: {
209    &quot;extends&quot;: &quot;react-app&quot;
210  },
211  &quot;husky&quot;: {
212    &quot;hooks&quot;: {
213      &quot;pre-commit&quot;: &quot;lint-staged&quot;
214    }
215  },
216  &quot;lint-staged&quot;: {
217    &quot;*.{js,ts,tsx}&quot;: [
218      &quot;eslint --fix&quot;
219    ]
220  },
221  &quot;browserslist&quot;: {
222    &quot;production&quot;: [
223      &quot;&gt;0.2%&quot;,
224      &quot;not dead&quot;,
225      &quot;not op_mini all&quot;
226    ],
227    &quot;development&quot;: [
228      &quot;last 1 chrome version&quot;,
229      &quot;last 1 firefox version&quot;,
230      &quot;last 1 safari version&quot;
231    ]
232  }
233}
234    - name: Fix up git URLs
235      run: echo -e '[url &quot;https://github.com/&quot;]\n  insteadOf = &quot;git://github.com/&quot;' &gt;&gt; ~/.gitconfig
236git config --global url.&quot;https://github.com/&quot;.insteadOf git://github.com/
237

You can also use SSH, but GitHub Security reminds us that, as of March 15th, 2022, GitHub stopped accepting DSA keys. RSA keys uploaded after Nov 2, 2021 will work only with SHA-2 signatures.
The deprecated MACs, ciphers, and unencrypted Git protocol are permanently disabled.

So this (with the right key) would work:

1Command: git
2Arguments: ls-remote --tags --heads git://github.com/adobe-webplatform/eve.git
3Directory: /home/runner/work/stackstream-fe/stackstream-fe
4Output:
5fatal: remote error: 
6  The unauthenticated git protocol on port 9418 is no longer supported.
7    - name: Installing modules
8      run: yarn install
9  steps:
10  - name: Checkout
11    uses: actions/checkout@v2
12
13  - id: vars
14    run: |
15      if [ '${{ github.ref }}' == 'refs/heads/master' ]; then echo &quot;::set-output name=environment::prod_stackstream&quot; ; echo &quot;::set-output name=api-url::api&quot; ; elif [ '${{ github.ref }}' == 'refs/heads/staging' ]; then echo &quot;::set-output name=environment::staging_stackstream&quot;  ; echo &quot;::set-output name=api-url::stagingapi&quot; ; else echo &quot;::set-output name=environment::dev_stackstream&quot; ; echo &quot;::set-output name=api-url::devapi&quot; ; fi
16
17  - uses: pCYSl5EDgo/cat@master
18    id: slack
19    with:
20      path: .github/workflows/slack.txt
21
22  - name: Slack Start Notification
23    uses: 8398a7/action-slack@v3
24    env:
25      SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
26      ENVIRONMENT: '`${{ steps.vars.outputs.environment }}`'
27      COLOR: good
28      STATUS: '`Started`'
29    with:
30      status: custom
31      fields: workflow,job,commit,repo,ref,author,took
32      custom_payload: |
33        ${{ steps.slack.outputs.text }}
34
35  - name: Installing modules
36    env:
37      REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'
38    run: yarn install
39
40  - name: Create Frontend Build
41    env:
42      REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'
43    run: yarn build
44
45  - name: Deploy to Frontend Server DEV
46    if: ${{ contains(github.ref, 'dev') }}
47    uses: easingthemes/ssh-deploy@v2.1.5
48    env:
49      SSH_PRIVATE_KEY: ${{ secrets.DEV_KEY }}
50      ARGS: '-rltgoDzvO --delete'
51      SOURCE: 'deploy/'
52      REMOTE_HOST: ${{ secrets.DEV_HOST }}
53      REMOTE_USER: plyfolio-dev
54      TARGET: '/home/plyfolio-dev/${{ steps.vars.outputs.environment }}/fe/deploy'
55   {
56  &quot;name&quot;: &quot;stackstream-fe&quot;,
57  &quot;version&quot;: &quot;1.0.0&quot;,
58  &quot;authors&quot;: [
59    &quot;fayyaznofal@gmail.com&quot;
60  ],
61  &quot;private&quot;: true,
62  &quot;dependencies&quot;: {
63    &quot;@fortawesome/fontawesome-svg-core&quot;: &quot;^1.2.34&quot;,
64    &quot;@fortawesome/free-solid-svg-icons&quot;: &quot;^5.15.2&quot;,
65    &quot;@fortawesome/react-fontawesome&quot;: &quot;^0.1.14&quot;,
66    &quot;@fullcalendar/bootstrap&quot;: &quot;^5.5.0&quot;,
67    &quot;@fullcalendar/core&quot;: &quot;^5.5.0&quot;,
68    &quot;@fullcalendar/daygrid&quot;: &quot;^5.5.0&quot;,
69    &quot;@fullcalendar/interaction&quot;: &quot;^5.5.0&quot;,
70    &quot;@fullcalendar/react&quot;: &quot;^5.5.0&quot;,
71    &quot;@lourenci/react-kanban&quot;: &quot;^2.1.0&quot;,
72    &quot;@redux-saga/simple-saga-monitor&quot;: &quot;^1.1.2&quot;,
73    &quot;@testing-library/jest-dom&quot;: &quot;^5.11.9&quot;,
74    &quot;@testing-library/react&quot;: &quot;^11.2.3&quot;,
75    &quot;@testing-library/user-event&quot;: &quot;^12.6.0&quot;,
76    &quot;@toast-ui/react-chart&quot;: &quot;^1.0.2&quot;,
77    &quot;@types/jest&quot;: &quot;^26.0.14&quot;,
78    &quot;@types/node&quot;: &quot;^14.10.3&quot;,
79    &quot;@types/react&quot;: &quot;^16.9.49&quot;,
80    &quot;@types/react-dom&quot;: &quot;^16.9.8&quot;,
81    &quot;@vtaits/react-color-picker&quot;: &quot;^0.1.1&quot;,
82    &quot;apexcharts&quot;: &quot;^3.23.1&quot;,
83    &quot;availity-reactstrap-validation&quot;: &quot;^2.7.0&quot;,
84    &quot;axios&quot;: &quot;^0.21.1&quot;,
85    &quot;axios-mock-adapter&quot;: &quot;^1.19.0&quot;,
86    &quot;axios-progress-bar&quot;: &quot;^1.2.0&quot;,
87    &quot;bootstrap&quot;: &quot;^5.0.0-beta2&quot;,
88    &quot;chart.js&quot;: &quot;^2.9.4&quot;,
89    &quot;chartist&quot;: &quot;^0.11.4&quot;,
90    &quot;classnames&quot;: &quot;^2.2.6&quot;,
91    &quot;components&quot;: &quot;^0.1.0&quot;,
92    &quot;dotenv&quot;: &quot;^8.2.0&quot;,
93    &quot;draft-js&quot;: &quot;^0.11.7&quot;,
94    &quot;echarts&quot;: &quot;^4.9.0&quot;,
95    &quot;echarts-for-react&quot;: &quot;^2.0.16&quot;,
96    &quot;firebase&quot;: &quot;^8.2.3&quot;,
97    &quot;google-maps-react&quot;: &quot;^2.0.6&quot;,
98    &quot;history&quot;: &quot;^4.10.1&quot;,
99    &quot;i&quot;: &quot;^0.3.6&quot;,
100    &quot;i18next&quot;: &quot;^19.8.4&quot;,
101    &quot;i18next-browser-languagedetector&quot;: &quot;^6.0.1&quot;,
102    &quot;jsonwebtoken&quot;: &quot;^8.5.1&quot;,
103    &quot;leaflet&quot;: &quot;^1.7.1&quot;,
104    &quot;lodash&quot;: &quot;^4.17.21&quot;,
105    &quot;lodash.clonedeep&quot;: &quot;^4.5.0&quot;,
106    &quot;lodash.get&quot;: &quot;^4.4.2&quot;,
107    &quot;metismenujs&quot;: &quot;^1.2.1&quot;,
108    &quot;mkdirp&quot;: &quot;^1.0.4&quot;,
109    &quot;moment&quot;: &quot;2.29.1&quot;,
110    &quot;moment-timezone&quot;: &quot;^0.5.32&quot;,
111    &quot;nouislider-react&quot;: &quot;^3.3.9&quot;,
112    &quot;npm&quot;: &quot;^7.6.3&quot;,
113    &quot;prop-types&quot;: &quot;^15.7.2&quot;,
114    &quot;query-string&quot;: &quot;^6.14.0&quot;,
115    &quot;react&quot;: &quot;^16.13.1&quot;,
116    &quot;react-apexcharts&quot;: &quot;^1.3.7&quot;,
117    &quot;react-auth-code-input&quot;: &quot;^1.0.0&quot;,
118    &quot;react-avatar&quot;: &quot;^3.10.0&quot;,
119    &quot;react-bootstrap&quot;: &quot;^1.5.0&quot;,
120    &quot;react-bootstrap-editable&quot;: &quot;^0.8.2&quot;,
121    &quot;react-bootstrap-sweetalert&quot;: &quot;^5.2.0&quot;,
122    &quot;react-bootstrap-table-next&quot;: &quot;^4.0.3&quot;,
123    &quot;react-bootstrap-table2-editor&quot;: &quot;^1.4.0&quot;,
124    &quot;react-bootstrap-table2-paginator&quot;: &quot;^2.1.2&quot;,
125    &quot;react-bootstrap-table2-toolkit&quot;: &quot;^2.1.3&quot;,
126    &quot;react-chartist&quot;: &quot;^0.14.3&quot;,
127    &quot;react-chartjs-2&quot;: &quot;^2.11.1&quot;,
128    &quot;react-color&quot;: &quot;^2.19.3&quot;,
129    &quot;react-confirm-alert&quot;: &quot;^2.7.0&quot;,
130    &quot;react-content-loader&quot;: &quot;^6.0.1&quot;,
131    &quot;react-countdown&quot;: &quot;^2.3.1&quot;,
132    &quot;react-countup&quot;: &quot;^4.3.3&quot;,
133    &quot;react-cropper&quot;: &quot;^2.1.4&quot;,
134    &quot;react-data-table-component&quot;: &quot;^6.11.8&quot;,
135    &quot;react-date-picker&quot;: &quot;^8.0.6&quot;,
136    &quot;react-datepicker&quot;: &quot;^3.4.1&quot;,
137    &quot;react-dom&quot;: &quot;^16.13.1&quot;,
138    &quot;react-draft-wysiwyg&quot;: &quot;^1.14.5&quot;,
139    &quot;react-drag-listview&quot;: &quot;^0.1.8&quot;,
140    &quot;react-drawer&quot;: &quot;^1.3.4&quot;,
141    &quot;react-dropzone&quot;: &quot;^11.2.4&quot;,
142    &quot;react-dual-listbox&quot;: &quot;^2.0.0&quot;,
143    &quot;react-facebook-login&quot;: &quot;^4.1.1&quot;,
144    &quot;react-flatpickr&quot;: &quot;^3.10.6&quot;,
145    &quot;react-google-login&quot;: &quot;^5.2.2&quot;,
146    &quot;react-hook-form&quot;: &quot;^7.15.2&quot;,
147    &quot;react-i18next&quot;: &quot;^11.8.5&quot;,
148    &quot;react-icons&quot;: &quot;^4.2.0&quot;,
149    &quot;react-image-lightbox&quot;: &quot;^5.1.1&quot;,
150    &quot;react-input-mask&quot;: &quot;^2.0.4&quot;,
151    &quot;react-jvectormap&quot;: &quot;^0.0.16&quot;,
152    &quot;react-leaflet&quot;: &quot;^3.0.5&quot;,
153    &quot;react-meta-tags&quot;: &quot;^1.0.1&quot;,
154    &quot;react-modal-video&quot;: &quot;^1.2.6&quot;,
155    &quot;react-notifications&quot;: &quot;^1.7.2&quot;,
156    &quot;react-number-format&quot;: &quot;^4.7.3&quot;,
157    &quot;react-perfect-scrollbar&quot;: &quot;^1.5.8&quot;,
158    &quot;react-rangeslider&quot;: &quot;^2.2.0&quot;,
159    &quot;react-rating&quot;: &quot;^2.0.5&quot;,
160    &quot;react-rating-tooltip&quot;: &quot;^1.1.6&quot;,
161    &quot;react-redux&quot;: &quot;^7.2.1&quot;,
162    &quot;react-responsive-carousel&quot;: &quot;^3.2.11&quot;,
163    &quot;react-router-dom&quot;: &quot;^5.2.0&quot;,
164    &quot;react-script&quot;: &quot;^2.0.5&quot;,
165    &quot;react-scripts&quot;: &quot;3.4.3&quot;,
166    &quot;react-select&quot;: &quot;^4.3.1&quot;,
167    &quot;react-sparklines&quot;: &quot;^1.7.0&quot;,
168    &quot;react-star-ratings&quot;: &quot;^2.3.0&quot;,
169    &quot;react-super-responsive-table&quot;: &quot;^5.2.0&quot;,
170    &quot;react-switch&quot;: &quot;^6.0.0&quot;,
171    &quot;react-table&quot;: &quot;^7.6.3&quot;,
172    &quot;react-toastify&quot;: &quot;^7.0.3&quot;,
173    &quot;react-toastr&quot;: &quot;^3.0.0&quot;,
174    &quot;react-twitter-auth&quot;: &quot;0.0.13&quot;,
175    &quot;reactstrap&quot;: &quot;^8.8.1&quot;,
176    &quot;recharts&quot;: &quot;^2.0.8&quot;,
177    &quot;redux&quot;: &quot;^4.0.5&quot;,
178    &quot;redux-saga&quot;: &quot;^1.1.3&quot;,
179    &quot;reselect&quot;: &quot;^4.0.0&quot;,
180    &quot;sass&quot;: &quot;^1.37.5&quot;,
181    &quot;simplebar-react&quot;: &quot;^2.3.0&quot;,
182    &quot;styled&quot;: &quot;^1.0.0&quot;,
183    &quot;styled-components&quot;: &quot;^5.2.1&quot;,
184    &quot;toastr&quot;: &quot;^2.1.4&quot;,
185    &quot;typescript&quot;: &quot;^4.0.2&quot;,
186    &quot;universal-cookie&quot;: &quot;^4.0.4&quot;
187  },
188  &quot;devDependencies&quot;: {
189    &quot;@typescript-eslint/eslint-plugin&quot;: &quot;^2.27.0&quot;,
190    &quot;@typescript-eslint/parser&quot;: &quot;^2.27.0&quot;,
191    &quot;@typescript-eslint/typescript-estree&quot;: &quot;^4.15.2&quot;,
192    &quot;eslint-config-prettier&quot;: &quot;^6.10.1&quot;,
193    &quot;eslint-plugin-prettier&quot;: &quot;^3.1.2&quot;,
194    &quot;husky&quot;: &quot;^4.2.5&quot;,
195    &quot;lint-staged&quot;: &quot;^10.1.3&quot;,
196    &quot;prettier&quot;: &quot;^1.19.1&quot;,
197    &quot;react-test-renderer&quot;: &quot;^16.13.1&quot;,
198    &quot;redux-devtools-extension&quot;: &quot;^2.13.8&quot;,
199    &quot;redux-mock-store&quot;: &quot;^1.5.4&quot;
200  },
201  &quot;scripts&quot;: {
202    &quot;start&quot;: &quot;react-scripts start&quot;,
203    &quot;build&quot;: &quot;react-scripts build &amp;&amp; mv build ./deploy/build&quot;,
204    &quot;build-local&quot;: &quot;react-scripts build&quot;,
205    &quot;test&quot;: &quot;react-scripts test&quot;,
206    &quot;eject&quot;: &quot;react-scripts eject&quot;
207  },
208  &quot;eslintConfig&quot;: {
209    &quot;extends&quot;: &quot;react-app&quot;
210  },
211  &quot;husky&quot;: {
212    &quot;hooks&quot;: {
213      &quot;pre-commit&quot;: &quot;lint-staged&quot;
214    }
215  },
216  &quot;lint-staged&quot;: {
217    &quot;*.{js,ts,tsx}&quot;: [
218      &quot;eslint --fix&quot;
219    ]
220  },
221  &quot;browserslist&quot;: {
222    &quot;production&quot;: [
223      &quot;&gt;0.2%&quot;,
224      &quot;not dead&quot;,
225      &quot;not op_mini all&quot;
226    ],
227    &quot;development&quot;: [
228      &quot;last 1 chrome version&quot;,
229      &quot;last 1 firefox version&quot;,
230      &quot;last 1 safari version&quot;
231    ]
232  }
233}
234    - name: Fix up git URLs
235      run: echo -e '[url &quot;https://github.com/&quot;]\n  insteadOf = &quot;git://github.com/&quot;' &gt;&gt; ~/.gitconfig
236git config --global url.&quot;https://github.com/&quot;.insteadOf git://github.com/
237git config --global url.&quot;git@github.com:&quot;.insteadOf git://github.com/
238

That will change any git://github.com/ (unencrypted Git protocol) into git@github.com: (SSH URL).

Source https://stackoverflow.com/questions/70663523

QUESTION

CentOS through a VM - no URLs in mirrorlist

Asked 2022-Mar-26 at 21:04

I am trying to run a CentOS 8 server through VirtualBox (6.1.30) (Vagrant), which worked just fine yesterday for me, but today I tried running a sudo yum update. I keep getting this error for some reason:

1[vagrant@192.168.38.4] ~  &gt;&gt; sudo yum update
2CentOS Linux 8 - AppStream                       71  B/s |  38  B     00:00
3Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
4

I already tried to change the namespaces on /etc/resolve.conf, remove the DNF folders and everything. On other computers, this works just fine, so I think the problem is with my host machine. I also tried to reset the network settings (I am on a Windows 10 host), without success either. It's not a DNS problem; it works just fine.

After I reinstalled Windows, I still have the same error in my VM.

File dnf.log:

1[vagrant@192.168.38.4] ~  &gt;&gt; sudo yum update
2CentOS Linux 8 - AppStream                       71  B/s |  38  B     00:00
3Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
42022-01-31T15:28:03+0000 INFO --- logging initialized ---
52022-01-31T15:28:03+0000 DDEBUG timer: config: 2 ms
62022-01-31T15:28:03+0000 DEBUG Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, groups-manager, needs-restarting, playground, repoclosure, repodiff, repograph, repomanage, reposync
72022-01-31T15:28:03+0000 DEBUG YUM version: 4.4.2
82022-01-31T15:28:03+0000 DDEBUG Command: yum update
92022-01-31T15:28:03+0000 DDEBUG Installroot: /
102022-01-31T15:28:03+0000 DDEBUG Releasever: 8
112022-01-31T15:28:03+0000 DEBUG cachedir: /var/cache/dnf
122022-01-31T15:28:03+0000 DDEBUG Base command: update
132022-01-31T15:28:03+0000 DDEBUG Extra commands: ['update']
142022-01-31T15:28:03+0000 DEBUG User-Agent: constructed: 'libdnf (CentOS Linux 8; generic; Linux.x86_64)'
152022-01-31T15:28:05+0000 DDEBUG Cleaning up.
162022-01-31T15:28:05+0000 SUBDEBUG
17Traceback (most recent call last):
18  File &quot;/usr/lib/python3.6/site-packages/dnf/repo.py&quot;, line 574, in load
19    ret = self._repo.load()
20  File &quot;/usr/lib64/python3.6/site-packages/libdnf/repo.py&quot;, line 397, in load
21    return _repo.Repo_load(self)
22libdnf._error.Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
23
24During handling of the above exception, another exception occurred:
25
26Traceback (most recent call last):
27  File &quot;/usr/lib/python3.6/site-packages/dnf/cli/main.py&quot;, line 67, in main
28    return _main(base, args, cli_class, option_parser_class)
29  File &quot;/usr/lib/python3.6/site-packages/dnf/cli/main.py&quot;, line 106, in _main
30    return cli_run(cli, base)
31  File &quot;/usr/lib/python3.6/site-packages/dnf/cli/main.py&quot;, line 122, in cli_run
32    cli.run()
33  File &quot;/usr/lib/python3.6/site-packages/dnf/cli/cli.py&quot;, line 1050, in run
34    self._process_demands()
35  File &quot;/usr/lib/python3.6/site-packages/dnf/cli/cli.py&quot;, line 740, in _process_demands
36    load_available_repos=self.demands.available_repos)
37  File &quot;/usr/lib/python3.6/site-packages/dnf/base.py&quot;, line 394, in fill_sack
38    self._add_repo_to_sack(r)
39  File &quot;/usr/lib/python3.6/site-packages/dnf/base.py&quot;, line 137, in _add_repo_to_sack
40    repo.load()
41  File &quot;/usr/lib/python3.6/site-packages/dnf/repo.py&quot;, line 581, in load
42    raise dnf.exceptions.RepoError(str(e))
43dnf.exceptions.RepoError: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
442022-01-31T15:28:05+0000 CRITICAL Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
45

ANSWER

Answered 2022-Mar-26 at 20:59

Check out this article: CentOS Linux EOL

The below commands helped me:

1[vagrant@192.168.38.4] ~  &gt;&gt; sudo yum update
2CentOS Linux 8 - AppStream                       71  B/s |  38  B     00:00
3Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
42022-01-31T15:28:03+0000 INFO --- logging initialized ---
52022-01-31T15:28:03+0000 DDEBUG timer: config: 2 ms
62022-01-31T15:28:03+0000 DEBUG Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, groups-manager, needs-restarting, playground, repoclosure, repodiff, repograph, repomanage, reposync
72022-01-31T15:28:03+0000 DEBUG YUM version: 4.4.2
82022-01-31T15:28:03+0000 DDEBUG Command: yum update
92022-01-31T15:28:03+0000 DDEBUG Installroot: /
102022-01-31T15:28:03+0000 DDEBUG Releasever: 8
112022-01-31T15:28:03+0000 DEBUG cachedir: /var/cache/dnf
122022-01-31T15:28:03+0000 DDEBUG Base command: update
132022-01-31T15:28:03+0000 DDEBUG Extra commands: ['update']
142022-01-31T15:28:03+0000 DEBUG User-Agent: constructed: 'libdnf (CentOS Linux 8; generic; Linux.x86_64)'
152022-01-31T15:28:05+0000 DDEBUG Cleaning up.
162022-01-31T15:28:05+0000 SUBDEBUG
17Traceback (most recent call last):
18  File &quot;/usr/lib/python3.6/site-packages/dnf/repo.py&quot;, line 574, in load
19    ret = self._repo.load()
20  File &quot;/usr/lib64/python3.6/site-packages/libdnf/repo.py&quot;, line 397, in load
21    return _repo.Repo_load(self)
22libdnf._error.Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
23
24During handling of the above exception, another exception occurred:
25
26Traceback (most recent call last):
27  File &quot;/usr/lib/python3.6/site-packages/dnf/cli/main.py&quot;, line 67, in main
28    return _main(base, args, cli_class, option_parser_class)
29  File &quot;/usr/lib/python3.6/site-packages/dnf/cli/main.py&quot;, line 106, in _main
30    return cli_run(cli, base)
31  File &quot;/usr/lib/python3.6/site-packages/dnf/cli/main.py&quot;, line 122, in cli_run
32    cli.run()
33  File &quot;/usr/lib/python3.6/site-packages/dnf/cli/cli.py&quot;, line 1050, in run
34    self._process_demands()
35  File &quot;/usr/lib/python3.6/site-packages/dnf/cli/cli.py&quot;, line 740, in _process_demands
36    load_available_repos=self.demands.available_repos)
37  File &quot;/usr/lib/python3.6/site-packages/dnf/base.py&quot;, line 394, in fill_sack
38    self._add_repo_to_sack(r)
39  File &quot;/usr/lib/python3.6/site-packages/dnf/base.py&quot;, line 137, in _add_repo_to_sack
40    repo.load()
41  File &quot;/usr/lib/python3.6/site-packages/dnf/repo.py&quot;, line 581, in load
42    raise dnf.exceptions.RepoError(str(e))
43dnf.exceptions.RepoError: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
442022-01-31T15:28:05+0000 CRITICAL Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
45sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-*
46sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-Linux-*
47

Doing this will make DNF work, but you will no longer receive any updates.

To upgrade to CentOS 8 stream:

1[vagrant@192.168.38.4] ~  &gt;&gt; sudo yum update
2CentOS Linux 8 - AppStream                       71  B/s |  38  B     00:00
3Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
42022-01-31T15:28:03+0000 INFO --- logging initialized ---
52022-01-31T15:28:03+0000 DDEBUG timer: config: 2 ms
62022-01-31T15:28:03+0000 DEBUG Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, groups-manager, needs-restarting, playground, repoclosure, repodiff, repograph, repomanage, reposync
72022-01-31T15:28:03+0000 DEBUG YUM version: 4.4.2
82022-01-31T15:28:03+0000 DDEBUG Command: yum update
92022-01-31T15:28:03+0000 DDEBUG Installroot: /
102022-01-31T15:28:03+0000 DDEBUG Releasever: 8
112022-01-31T15:28:03+0000 DEBUG cachedir: /var/cache/dnf
122022-01-31T15:28:03+0000 DDEBUG Base command: update
132022-01-31T15:28:03+0000 DDEBUG Extra commands: ['update']
142022-01-31T15:28:03+0000 DEBUG User-Agent: constructed: 'libdnf (CentOS Linux 8; generic; Linux.x86_64)'
152022-01-31T15:28:05+0000 DDEBUG Cleaning up.
162022-01-31T15:28:05+0000 SUBDEBUG
17Traceback (most recent call last):
18  File &quot;/usr/lib/python3.6/site-packages/dnf/repo.py&quot;, line 574, in load
19    ret = self._repo.load()
20  File &quot;/usr/lib64/python3.6/site-packages/libdnf/repo.py&quot;, line 397, in load
21    return _repo.Repo_load(self)
22libdnf._error.Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
23
24During handling of the above exception, another exception occurred:
25
26Traceback (most recent call last):
27  File &quot;/usr/lib/python3.6/site-packages/dnf/cli/main.py&quot;, line 67, in main
28    return _main(base, args, cli_class, option_parser_class)
29  File &quot;/usr/lib/python3.6/site-packages/dnf/cli/main.py&quot;, line 106, in _main
30    return cli_run(cli, base)
31  File &quot;/usr/lib/python3.6/site-packages/dnf/cli/main.py&quot;, line 122, in cli_run
32    cli.run()
33  File &quot;/usr/lib/python3.6/site-packages/dnf/cli/cli.py&quot;, line 1050, in run
34    self._process_demands()
35  File &quot;/usr/lib/python3.6/site-packages/dnf/cli/cli.py&quot;, line 740, in _process_demands
36    load_available_repos=self.demands.available_repos)
37  File &quot;/usr/lib/python3.6/site-packages/dnf/base.py&quot;, line 394, in fill_sack
38    self._add_repo_to_sack(r)
39  File &quot;/usr/lib/python3.6/site-packages/dnf/base.py&quot;, line 137, in _add_repo_to_sack
40    repo.load()
41  File &quot;/usr/lib/python3.6/site-packages/dnf/repo.py&quot;, line 581, in load
42    raise dnf.exceptions.RepoError(str(e))
43dnf.exceptions.RepoError: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
442022-01-31T15:28:05+0000 CRITICAL Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
45sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-*
46sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-Linux-*
47sudo dnf install centos-release-stream -y
48sudo dnf swap centos-{linux,stream}-repos -y
49sudo dnf distro-sync -y
50

Optionally reboot if your kernel updated (not needed in containers).

Source https://stackoverflow.com/questions/70926799

QUESTION

Java, Intellij IDEA problem Unrecognized option: --add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED

Asked 2022-Mar-26 at 15:23

I have newly installed

1IntelliJ IDEA 2021.2 (Ultimate Edition)
2Build #IU-212.4746.92, built on July 27, 2021
3Licensed to XXXXXX
4Subscription is active until August 15, 2021.
5Runtime version: 11.0.11+9-b1504.13 amd64
6VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
7Linux 5.4.0-80-generic
8GC: G1 Young Generation, G1 Old Generation
9Memory: 2048M
10Cores: 3
11
12Kotlin: 212-1.5.10-release-IJ4746.92
13Current Desktop: X-Cinnamon
14

I cloned project I work with on other workstation without issues, but cannot start any class with main method and IDEA says:

1IntelliJ IDEA 2021.2 (Ultimate Edition)
2Build #IU-212.4746.92, built on July 27, 2021
3Licensed to XXXXXX
4Subscription is active until August 15, 2021.
5Runtime version: 11.0.11+9-b1504.13 amd64
6VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
7Linux 5.4.0-80-generic
8GC: G1 Young Generation, G1 Old Generation
9Memory: 2048M
10Cores: 3
11
12Kotlin: 212-1.5.10-release-IJ4746.92
13Current Desktop: X-Cinnamon
14Abnormal build process termination: 
15/usr/lib/jvm/java-1.8.0-openjdk-amd64/bin/java -Xmx700m -Djava.awt.headless=true -Djava.endorsed.dirs=\&quot;\&quot; -Dcompile.parallel=false -Drebuild.on.dependency.change=true -Djdt.compiler.useSingleThread=true -Daether.connector.resumeDownloads=false -Dio.netty.initialSeedUniquifier=-5972351880001011455 -Dfile.encoding=UTF-8 -Duser.language=en -Duser.country=US -Didea.paths.selector=IntelliJIdea2021.2 -Didea.home.path=/home/pm/idea-IU-212.4746.92 -Didea.config.path=/home/pm/.config/JetBrains/IntelliJIdea2021.2 -Didea.plugins.path=/home/pm/.local/share/JetBrains/IntelliJIdea2021.2 -Djps.log.dir=/home/pm/.cache/JetBrains/IntelliJIdea2021.2/log/build-log -Djps.fallback.jdk.home=/home/pm/idea-IU-212.4746.92/jbr -Djps.fallback.jdk.version=11.0.11 -Dio.netty.noUnsafe=true -Djava.io.tmpdir=/home/pm/.cache/JetBrains/IntelliJIdea2021.2/compile-server/rfg-survey-api_cc70fc05/_temp_ -Djps.backward.ref.index.builder=true -Djps.track.ap.dependencies=false --add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED -Dtmh.instrument.annotations=true -Dtmh.generate.line.numbers=true -Dkotlin.incremental.compilation=true -Dkotlin.incremental.compilation.js=true -Dkotlin.daemon.enabled -Dkotlin.daemon.client.alive.path=\&quot;/tmp/kotlin-idea-12426594439704512301-is-running\&quot; -classpath /home/pm/idea-IU-212.4746.92/plugins/java/lib/jps-launcher.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/lib/tools.jar org.jetbrains.jps.cmdline.Launcher /home/pm/idea-IU-212.4746.92/lib/slf4j.jar:/home/pm/idea-IU-212.4746.92/lib/idea_rt.jar:/home/pm/idea-IU-212.4746.92/lib/platform-api.jar:/home/pm/idea-IU-212.4746.92/plugins/java/lib/maven-resolver-transport-file-1.3.3.jar:/home/pm/idea-IU-212.4746.92/lib/forms_rt.jar:/home/pm/idea-IU-212.4746.92/lib/util.jar:/home/pm/idea-IU-212.4746.92/lib/annotations.jar:/home/pm/idea-IU-212.4746.92/lib/3rd-party.jar:/home/pm/idea-IU-212.4746.92/lib/kotlin-stdlib-jdk8.jar:/home/pm/idea-IU-212.4746.92/plugins/java/lib/maven-resolver-connector-basic-1.3.3.jar:/home/pm/idea-IU-212.4746.92/lib/jna-platform.jar:/home/pm/idea-IU-212.4746.92/lib/protobuf-java-3.15.8.jar:/home/pm/idea-IU-212.4746.92/plugins/java/lib/jps-builders-6.jar:/home/pm/idea-IU-212.4746.92/plugins/java/lib/javac2.jar:/home/pm/idea-IU-212.4746.92/plugins/java/lib/aether-dependency-resolver.jar:/home/pm/idea-IU-212.4746.92/plugins/java/lib/jps-builders.jar:/home/pm/idea-IU-212.4746.92/plugins/java/lib/jps-javac-extension-1.jar:/home/pm/idea-IU-212.4746.92/lib/jna.jar:/home/pm/idea-IU-212.4746.92/lib/jps-model.jar:/home/pm/idea-IU-212.4746.92/plugins/java/lib/maven-resolver-transport-http-1.3.3.jar:/home/pm/idea-IU-212.4746.92/plugins/JavaEE/lib/jasper-v2-rt.jar:/home/pm/idea-IU-212.4746.92/plugins/Kotlin/lib/kotlin-reflect.jar:/home/pm/idea-IU-212.4746.92/plugins/Kotlin/lib/kotlin-plugin.jar:/home/pm/idea-IU-212.4746.92/plugins/ant/lib/ant-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/uiDesigner/lib/jps/java-guiForms-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/eclipse/lib/eclipse-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/eclipse/lib/eclipse-common.jar:/home/pm/idea-IU-212.4746.92/plugins/IntelliLang/lib/java-langInjection-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/Groovy/lib/groovy-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/Groovy/lib/groovy-constants-rt.jar:/home/pm/idea-IU-212.4746.92/plugins/maven/lib/maven-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/gradle-java/lib/gradle-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/devkit/lib/devkit-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/javaFX/lib/javaFX-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/javaFX/lib/javaFX-common.jar:/home/pm/idea-IU-212.4746.92/plugins/JavaEE/lib/javaee-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/webSphereIntegration/lib/jps/javaee-appServers-websphere-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/weblogicIntegration/lib/jps/javaee-appServers-weblogic-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/JPA/lib/jps/javaee-jpa-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/Grails/lib/groovy-grails-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/Grails/lib/groovy-grails-compilerPatch.jar:/home/pm/idea-IU-212.4746.92/plugins/Kotlin/lib/jps/kotlin-jps-plugin.jar:/home/pm/idea-IU-212.4746.92/plugins/Kotlin/lib/kotlin-jps-common.jar:/home/pm/idea-IU-212.4746.92/plugins/Kotlin/lib/kotlin-common.jar org.jetbrains.jps.cmdline.BuildMain 127.0.0.1 34781 9f0681bb-da2a-48db-8344-900ddeb29804 /home/pm/.cache/JetBrains/IntelliJIdea2021.2/compile-server
16Unrecognized option: --add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
17Error: Could not create the Java Virtual Machine.
18Error: A fatal exception has occurred. Program will exit.
19

I found other comment to check Lombok works and I see it is fine.

How to fix the problem?

ANSWER

Answered 2021-Jul-28 at 07:22

You are running the project via Java 1.8 and add the --add-opens option to the runner. However Java 1.8 does not support it.

So, the first option is to use Java 11 to run the project, as Java 11 can recognize this VM option.

Another solution is to find a place where --add-opens is added and remove it. Check Run configuration in IntelliJ IDEA (VM options field) and Maven/Gradle configuration files for argLine (Maven) and jvmArgs (Gradle)

Source https://stackoverflow.com/questions/68554693

QUESTION

Springboot 2.6.0 / Spring fox 3 - Failed to start bean 'documentationPluginsBootstrapper'

Asked 2022-Mar-25 at 06:14

I'm trying to initiate a Springboot project using Open Jdk 15, Springboot 2.6.0, Springfox 3. We are working on a project that replaced Netty as the webserver and used Jetty instead because we do not need a non-blocking environment.

In the code we depend primarily on Reactor API (Flux, Mono), so we can not remove org.springframework.boot:spring-boot-starter-webflux dependencies.

I replicated the problem that we have in a new project.: https://github.com/jvacaq/spring-fox.

I figured out that these lines in our build.gradle file are the origin of the problem.

1compile(&quot;org.springframework.boot:spring-boot-starter-web&quot;) {
2   exclude module: &quot;spring-boot-starter-tomcat&quot;
3}
4compile(&quot;org.springframework.boot:spring-boot-starter-jetty&quot;)
5

Here is the build.gradle file:

1compile(&quot;org.springframework.boot:spring-boot-starter-web&quot;) {
2   exclude module: &quot;spring-boot-starter-tomcat&quot;
3}
4compile(&quot;org.springframework.boot:spring-boot-starter-jetty&quot;)
5plugins {
6    id 'org.springframework.boot' version '2.6.0'
7    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
8    id 'java'
9}
10
11group = 'com.example'
12version = '0.0.1-SNAPSHOT'
13sourceCompatibility = '11'
14
15repositories {
16    mavenCentral()
17}
18
19dependencies {
20    compile(&quot;org.springframework.boot:spring-boot-starter-web&quot;) {
21        exclude module: &quot;spring-boot-starter-tomcat&quot;
22    }
23    compile(&quot;org.springframework.boot:spring-boot-starter-jetty&quot;)
24    implementation 'org.springframework.boot:spring-boot-starter-webflux'
25    testImplementation 'org.springframework.boot:spring-boot-starter-test'
26    testImplementation 'io.projectreactor:reactor-test'
27    implementation &quot;io.springfox:springfox-boot-starter:3.0.0&quot;
28}
29
30test {
31    useJUnitPlatform()
32}
33
34

I issued the command gradle clean bootrun. The result is this error:

1compile(&quot;org.springframework.boot:spring-boot-starter-web&quot;) {
2   exclude module: &quot;spring-boot-starter-tomcat&quot;
3}
4compile(&quot;org.springframework.boot:spring-boot-starter-jetty&quot;)
5plugins {
6    id 'org.springframework.boot' version '2.6.0'
7    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
8    id 'java'
9}
10
11group = 'com.example'
12version = '0.0.1-SNAPSHOT'
13sourceCompatibility = '11'
14
15repositories {
16    mavenCentral()
17}
18
19dependencies {
20    compile(&quot;org.springframework.boot:spring-boot-starter-web&quot;) {
21        exclude module: &quot;spring-boot-starter-tomcat&quot;
22    }
23    compile(&quot;org.springframework.boot:spring-boot-starter-jetty&quot;)
24    implementation 'org.springframework.boot:spring-boot-starter-webflux'
25    testImplementation 'org.springframework.boot:spring-boot-starter-test'
26    testImplementation 'io.projectreactor:reactor-test'
27    implementation &quot;io.springfox:springfox-boot-starter:3.0.0&quot;
28}
29
30test {
31    useJUnitPlatform()
32}
33
34 gradle clean bootrun                                                                                                                                                                                                               
35
36&gt; Task :bootRun FAILED
37
38  .   ____          _            __ _ _
39 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
40( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
41 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
42  '  |____| .__|_| |_|_| |_\__, | / / / /
43 =========|_|==============|___/=/_/_/_/
44 :: Spring Boot ::                (v2.6.0)
45
462021-11-19 09:41:06.665  INFO 16666 --- [           main] c.e.springfox.SpringFoxApplication       : Starting SpringFoxApplication using Java 15.0.2 on advance-Inspiron-5379 with PID 16666 (/home/advance/projects/spring-fox/build/classes/java/main started by advance in /home/advance/projects/spring-fox)
472021-11-19 09:41:06.666  INFO 16666 --- [           main] c.e.springfox.SpringFoxApplication       : No active profile set, falling back to default profiles: default
482021-11-19 09:41:07.294  INFO 16666 --- [           main] org.eclipse.jetty.util.log               : Logging initialized @1132ms to org.eclipse.jetty.util.log.Slf4jLog
492021-11-19 09:41:07.396  INFO 16666 --- [           main] o.s.b.w.e.j.JettyServletWebServerFactory : Server initialized with port: 8080
502021-11-19 09:41:07.398  INFO 16666 --- [           main] org.eclipse.jetty.server.Server          : jetty-9.4.44.v20210927; built: 2021-09-27T23:02:44.612Z; git: 8da83308eeca865e495e53ef315a249d63ba9332; jvm 15.0.2+7-27
512021-11-19 09:41:07.417  INFO 16666 --- [           main] o.e.j.s.h.ContextHandler.application     : Initializing Spring embedded WebApplicationContext
522021-11-19 09:41:07.417  INFO 16666 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 713 ms
532021-11-19 09:41:07.474  INFO 16666 --- [           main] org.eclipse.jetty.server.session         : DefaultSessionIdManager workerName=node0
542021-11-19 09:41:07.474  INFO 16666 --- [           main] org.eclipse.jetty.server.session         : No SessionScavenger set, using defaults
552021-11-19 09:41:07.475  INFO 16666 --- [           main] org.eclipse.jetty.server.session         : node0 Scavenging every 660000ms
562021-11-19 09:41:07.480  INFO 16666 --- [           main] o.e.jetty.server.handler.ContextHandler  : Started o.s.b.w.e.j.JettyEmbeddedWebAppContext@6aa3bfc{application,/,[file:///tmp/jetty-docbase.8080.2024342829220941812/, jar:file:/home/advance/.gradle/caches/modules-2/files-2.1/io.springfox/springfox-swagger-ui/3.0.0/1e665fbe22148f7c36fa8a08e515a0047cd4390b/springfox-swagger-ui-3.0.0.jar!/META-INF/resources],AVAILABLE}
572021-11-19 09:41:07.480  INFO 16666 --- [           main] org.eclipse.jetty.server.Server          : Started @1318ms
582021-11-19 09:41:07.920  INFO 16666 --- [           main] o.e.j.s.h.ContextHandler.application     : Initializing Spring DispatcherServlet 'dispatcherServlet'
592021-11-19 09:41:07.920  INFO 16666 --- [           main] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
602021-11-19 09:41:07.921  INFO 16666 --- [           main] o.s.web.servlet.DispatcherServlet        : Completed initialization in 1 ms
612021-11-19 09:41:07.931  INFO 16666 --- [           main] o.e.jetty.server.AbstractConnector       : Started ServerConnector@2643d762{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
622021-11-19 09:41:07.932  INFO 16666 --- [           main] o.s.b.web.embedded.jetty.JettyWebServer  : Jetty started on port(s) 8080 (http/1.1) with context path '/'
632021-11-19 09:41:07.934  WARN 16666 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException: Cannot invoke &quot;org.springframework.web.servlet.mvc.condition.PatternsRequestCondition.getPatterns()&quot; because &quot;this.condition&quot; is null
642021-11-19 09:41:07.949  INFO 16666 --- [           main] o.e.jetty.server.AbstractConnector       : Stopped ServerConnector@2643d762{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
652021-11-19 09:41:07.950  INFO 16666 --- [           main] org.eclipse.jetty.server.session         : node0 Stopped scavenging
662021-11-19 09:41:07.951  INFO 16666 --- [           main] o.e.j.s.h.ContextHandler.application     : Destroying Spring FrameworkServlet 'dispatcherServlet'
672021-11-19 09:41:07.951  INFO 16666 --- [           main] o.e.jetty.server.handler.ContextHandler  : Stopped o.s.b.w.e.j.JettyEmbeddedWebAppContext@6aa3bfc{application,/,[file:///tmp/jetty-docbase.8080.2024342829220941812/, jar:file:/home/advance/.gradle/caches/modules-2/files-2.1/io.springfox/springfox-swagger-ui/3.0.0/1e665fbe22148f7c36fa8a08e515a0047cd4390b/springfox-swagger-ui-3.0.0.jar!/META-INF/resources],STOPPED}
682021-11-19 09:41:07.958  INFO 16666 --- [           main] ConditionEvaluationReportLoggingListener : 
69
70Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
712021-11-19 09:41:07.970 ERROR 16666 --- [           main] o.s.boot.SpringApplication               : Application run failed
72
73org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException: Cannot invoke &quot;org.springframework.web.servlet.mvc.condition.PatternsRequestCondition.getPatterns()&quot; because &quot;this.condition&quot; is null
74        at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:181) ~[spring-context-5.3.13.jar:5.3.13]
75        at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54) ~[spring-context-5.3.13.jar:5.3.13]
76        at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356) ~[spring-context-5.3.13.jar:5.3.13]
77        at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[na:na]
78        at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155) ~[spring-context-5.3.13.jar:5.3.13]
79        at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123) ~[spring-context-5.3.13.jar:5.3.13]
80        at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:935) ~[spring-context-5.3.13.jar:5.3.13]
81        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586) ~[spring-context-5.3.13.jar:5.3.13]
82        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.6.0.jar:2.6.0]
83        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730) ~[spring-boot-2.6.0.jar:2.6.0]
84        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:412) ~[spring-boot-2.6.0.jar:2.6.0]
85        at org.springframework.boot.SpringApplication.run(SpringApplication.java:302) ~[spring-boot-2.6.0.jar:2.6.0]
86        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301) ~[spring-boot-2.6.0.jar:2.6.0]
87        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1290) ~[spring-boot-2.6.0.jar:2.6.0]
88        at com.example.springfox.SpringFoxApplication.main(SpringFoxApplication.java:10) ~[main/:na]
89Caused by: java.lang.NullPointerException: Cannot invoke &quot;org.springframework.web.servlet.mvc.condition.PatternsRequestCondition.getPatterns()&quot; because &quot;this.condition&quot; is null
90        at springfox.documentation.spring.web.WebMvcPatternsRequestConditionWrapper.getPatterns(WebMvcPatternsRequestConditionWrapper.java:56) ~[springfox-spring-webmvc-3.0.0.jar:3.0.0]
91        at springfox.documentation.RequestHandler.sortedPaths(RequestHandler.java:113) ~[springfox-core-3.0.0.jar:3.0.0]
92        at springfox.documentation.spi.service.contexts.Orderings.lambda$byPatternsCondition$3(Orderings.java:89) ~[springfox-spi-3.0.0.jar:3.0.0]
93        at java.base/java.util.Comparator.lambda$comparing$77a9974f$1(Comparator.java:469) ~[na:na]
94        at java.base/java.util.TimSort.countRunAndMakeAscending(TimSort.java:355) ~[na:na]
95        at java.base/java.util.TimSort.sort(TimSort.java:220) ~[na:na]
96        at java.base/java.util.Arrays.sort(Arrays.java:1306) ~[na:na]
97        at java.base/java.util.ArrayList.sort(ArrayList.java:1721) ~[na:na]
98        at java.base/java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:392) ~[na:na]
99        at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258) ~[na:na]
100        at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258) ~[na:na]
101        at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258) ~[na:na]
102        at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258) ~[na:na]
103        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485) ~[na:na]
104        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[na:na]
105        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[na:na]
106        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
107        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[na:na]
108        at springfox.documentation.spring.web.plugins.WebMvcRequestHandlerProvider.requestHandlers(WebMvcRequestHandlerProvider.java:81) ~[springfox-spring-webmvc-3.0.0.jar:3.0.0]
109        at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) ~[na:na]
110        at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625) ~[na:na]
111        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[na:na]
112        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[na:na]
113        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[na:na]
114        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
115        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[na:na]
116        at springfox.documentation.spring.web.plugins.AbstractDocumentationPluginsBootstrapper.withDefaults(AbstractDocumentationPluginsBootstrapper.java:107) ~[springfox-spring-web-3.0.0.jar:3.0.0]
117        at springfox.documentation.spring.web.plugins.AbstractDocumentationPluginsBootstrapper.buildContext(AbstractDocumentationPluginsBootstrapper.java:91) ~[springfox-spring-web-3.0.0.jar:3.0.0]
118        at springfox.documentation.spring.web.plugins.AbstractDocumentationPluginsBootstrapper.bootstrapDocumentationPlugins(AbstractDocumentationPluginsBootstrapper.java:82) ~[springfox-spring-web-3.0.0.jar:3.0.0]
119        at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.start(DocumentationPluginsBootstrapper.java:100) ~[springfox-spring-web-3.0.0.jar:3.0.0]
120        at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178) ~[spring-context-5.3.13.jar:5.3.13]
121        ... 14 common frames omitted
122
123
124FAILURE: Build failed with an exception.
125
126* What went wrong:
127Execution failed for task ':bootRun'.
128&gt; Process 'command '/home/advance/.sdkman/candidates/java/15.0.2-open/bin/java'' finished with non-zero exit value 1
129
130* Try:
131Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
132
133* Get more help at https://help.gradle.org
134
135Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
136Use '--warning-mode all' to show the individual deprecation warnings.
137See https://docs.gradle.org/6.9.1/userguide/command_line_interface.html#sec:command_line_warnings
138
139BUILD FAILED in 2s
1405 actionable tasks: 5 executed
141

Does anyone have an idea how to solve it?

ANSWER

Answered 2022-Feb-08 at 12:36

This problem's caused by a bug in Springfox. It's making an assumption about how Spring MVC is set up that doesn't always hold true. Specifically, it's assuming that MVC's path matching will use the Ant-based path matcher and not the PathPattern-based matcher. PathPattern-based matching has been an option for some time now and is the default as of Spring Boot 2.6.

As described in Spring Boot 2.6's release notes, you can restore the configuration that Springfox assumes will be used by setting spring.mvc.pathmatch.matching-strategy to ant-path-matcher in your application.properties file. Note that this will only work if you are not using Spring Boot's Actuator. The Actuator always uses PathPattern-based parsing, irrespective of the configured matching-strategy. A change to Springfox will be required if you want to use it with the Actuator in Spring Boot 2.6 and later.

Source https://stackoverflow.com/questions/70036953

QUESTION

ESlint - Error: Must use import to load ES Module

Asked 2022-Mar-17 at 12:13

I am currently setting up a boilerplate with React, Typescript, styled components, webpack etc. and I am getting an error when trying to run eslint:

Error: Must use import to load ES Module

Here is a more verbose version of the error:

1/Users/ben/Desktop/development projects/react-boilerplate-styled-context/src/api/api.ts
2  0:0  error  Parsing error: Must use import to load ES Module: /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/lib/definition.js
3require() of ES modules is not supported.
4require() of /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/babel-eslint/lib/require-from-eslint.js is an ES module file as it is a .js file whose nearest parent package.json contains &quot;type&quot;: &quot;module&quot; which defines all .js files in that package scope as ES modules.
5Instead rename definition.js to end in .cjs, change the requiring code to use import(), or remove &quot;type&quot;: &quot;module&quot; from /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/package.json
6

The error occurs in every single one of my .js and .ts/ .tsx files where I only use import or the file doesn't even have an import at all. I understand what the error is saying but I have no idea why it is being thrown when in fact I only use imports or even no imports at all in some files.

Here is my package.json where I trigger the linter from using npm run lint:eslint:quiet:

1/Users/ben/Desktop/development projects/react-boilerplate-styled-context/src/api/api.ts
2  0:0  error  Parsing error: Must use import to load ES Module: /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/lib/definition.js
3require() of ES modules is not supported.
4require() of /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/babel-eslint/lib/require-from-eslint.js is an ES module file as it is a .js file whose nearest parent package.json contains &quot;type&quot;: &quot;module&quot; which defines all .js files in that package scope as ES modules.
5Instead rename definition.js to end in .cjs, change the requiring code to use import(), or remove &quot;type&quot;: &quot;module&quot; from /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/package.json
6{
7  &quot;name&quot;: &quot;my-react-boilerplate&quot;,
8  &quot;version&quot;: &quot;1.0.0&quot;,
9  &quot;description&quot;: &quot;&quot;,
10  &quot;main&quot;: &quot;index.tsx&quot;,
11  &quot;directories&quot;: {
12    &quot;test&quot;: &quot;test&quot;
13  },
14  &quot;engines&quot;: {
15    &quot;node&quot;: &quot;&gt;=14.0.0&quot;
16  },
17  &quot;type&quot;: &quot;module&quot;,
18  &quot;scripts&quot;: {
19    &quot;build&quot;: &quot;webpack --config webpack.prod.js&quot;,
20    &quot;dev&quot;: &quot;webpack serve --config webpack.dev.js&quot;,
21    &quot;lint&quot;: &quot;npm run typecheck &amp;&amp; npm run lint:css &amp;&amp; npm run lint:eslint:quiet&quot;,
22    &quot;lint:css&quot;: &quot;stylelint './src/**/*.{js,ts,tsx}'&quot;,
23    &quot;lint:eslint:quiet&quot;: &quot;eslint --ext .ts,.tsx,.js,.jsx  ./src --no-error-on-unmatched-pattern --quiet&quot;,
24    &quot;lint:eslint&quot;: &quot;eslint --ext .ts,.tsx,.js,.jsx  ./src --no-error-on-unmatched-pattern&quot;,
25    &quot;lint:eslint:fix&quot;: &quot;eslint --ext .ts,.tsx,.js,.jsx  ./src --no-error-on-unmatched-pattern --quiet --fix&quot;,
26    &quot;test&quot;: &quot;cross-env NODE_ENV=test jest --coverage&quot;,
27    &quot;test:watch&quot;: &quot;cross-env NODE_ENV=test jest --watchAll&quot;,
28    &quot;typecheck&quot;: &quot;tsc --noEmit&quot;,
29    &quot;precommit&quot;: &quot;npm run lint&quot;
30  },
31  &quot;lint-staged&quot;: {
32    &quot;*.{ts,tsx,js,jsx}&quot;: [
33      &quot;npm run lint:eslint:fix&quot;,
34      &quot;git add --force&quot;
35    ],
36    &quot;*.{md,json}&quot;: [
37      &quot;prettier --write&quot;,
38      &quot;git add --force&quot;
39    ]
40  },
41  &quot;husky&quot;: {
42    &quot;hooks&quot;: {
43      &quot;pre-commit&quot;: &quot;npx lint-staged &amp;&amp; npm run typecheck&quot;
44    }
45  },
46  &quot;resolutions&quot;: {
47    &quot;styled-components&quot;: &quot;^5&quot;
48  },
49  &quot;author&quot;: &quot;&quot;,
50  &quot;license&quot;: &quot;ISC&quot;,
51  &quot;devDependencies&quot;: {
52    &quot;@babel/core&quot;: &quot;^7.5.4&quot;,
53    &quot;@babel/plugin-proposal-class-properties&quot;: &quot;^7.5.0&quot;,
54    &quot;@babel/preset-env&quot;: &quot;^7.5.4&quot;,
55    &quot;@babel/preset-react&quot;: &quot;^7.0.0&quot;,
56    &quot;@types/history&quot;: &quot;^4.7.6&quot;,
57    &quot;@types/react&quot;: &quot;^17.0.29&quot;,
58    &quot;@types/react-dom&quot;: &quot;^17.0.9&quot;,
59    &quot;@types/react-router&quot;: &quot;^5.1.17&quot;,
60    &quot;@types/react-router-dom&quot;: &quot;^5.1.5&quot;,
61    &quot;@types/styled-components&quot;: &quot;^5.1.15&quot;,
62    &quot;@typescript-eslint/eslint-plugin&quot;: &quot;^5.0.0&quot;,
63    &quot;babel-cli&quot;: &quot;^6.26.0&quot;,
64    &quot;babel-eslint&quot;: &quot;^10.0.2&quot;,
65    &quot;babel-loader&quot;: &quot;^8.0.0-beta.6&quot;,
66    &quot;babel-polyfill&quot;: &quot;^6.26.0&quot;,
67    &quot;babel-preset-env&quot;: &quot;^1.7.0&quot;,
68    &quot;babel-preset-react&quot;: &quot;^6.24.1&quot;,
69    &quot;babel-preset-stage-2&quot;: &quot;^6.24.1&quot;,
70    &quot;clean-webpack-plugin&quot;: &quot;^4.0.0&quot;,
71    &quot;dotenv-webpack&quot;: &quot;^7.0.3&quot;,
72    &quot;error-overlay-webpack-plugin&quot;: &quot;^1.0.0&quot;,
73    &quot;eslint&quot;: &quot;^8.0.0&quot;,
74    &quot;eslint-config-airbnb&quot;: &quot;^18.2.0&quot;,
75    &quot;eslint-config-prettier&quot;: &quot;^8.3.0&quot;,
76    &quot;eslint-config-with-prettier&quot;: &quot;^6.0.0&quot;,
77    &quot;eslint-plugin-compat&quot;: &quot;^3.3.0&quot;,
78    &quot;eslint-plugin-import&quot;: &quot;^2.25.2&quot;,
79    &quot;eslint-plugin-jsx-a11y&quot;: &quot;^6.2.3&quot;,
80    &quot;eslint-plugin-prettier&quot;: &quot;^4.0.0&quot;,
81    &quot;eslint-plugin-react&quot;: &quot;^7.14.2&quot;,
82    &quot;eslint-plugin-react-hooks&quot;: &quot;^4.2.0&quot;,
83    &quot;extract-text-webpack-plugin&quot;: &quot;^3.0.2&quot;,
84    &quot;file-loader&quot;: &quot;^6.2.0&quot;,
85    &quot;html-webpack-plugin&quot;: &quot;^5.3.2&quot;,
86    &quot;husky&quot;: &quot;^7.0.2&quot;,
87    &quot;prettier&quot;: &quot;^2.4.1&quot;,
88    &quot;raw-loader&quot;: &quot;^4.0.2&quot;,
89    &quot;style-loader&quot;: &quot;^3.3.0&quot;,
90    &quot;stylelint&quot;: &quot;^13.13.1&quot;,
91    &quot;stylelint-config-recommended&quot;: &quot;^5.0.0&quot;,
92    &quot;stylelint-config-styled-components&quot;: &quot;^0.1.1&quot;,
93    &quot;stylelint-processor-styled-components&quot;: &quot;^1.10.0&quot;,
94    &quot;ts-loader&quot;: &quot;^9.2.6&quot;,
95    &quot;tslint&quot;: &quot;^6.1.3&quot;,
96    &quot;typescript&quot;: &quot;^4.4.4&quot;,
97    &quot;url-loader&quot;: &quot;^4.1.1&quot;,
98    &quot;webpack&quot;: &quot;^5.58.2&quot;,
99    &quot;webpack-cli&quot;: &quot;^4.2.0&quot;,
100    &quot;webpack-dev-server&quot;: &quot;^4.3.1&quot;,
101    &quot;webpack-merge&quot;: &quot;^5.3.0&quot;
102  },
103  &quot;dependencies&quot;: {
104    &quot;history&quot;: &quot;^4.10.0&quot;,
105    &quot;process&quot;: &quot;^0.11.10&quot;,
106    &quot;react&quot;: &quot;^17.0.1&quot;,
107    &quot;react-dom&quot;: &quot;^17.0.1&quot;,
108    &quot;react-router-dom&quot;: &quot;^5.2.0&quot;,
109    &quot;styled-components&quot;: &quot;^5.2.1&quot;
110  }
111}
112

Here is my .eslintrc file:

1/Users/ben/Desktop/development projects/react-boilerplate-styled-context/src/api/api.ts
2  0:0  error  Parsing error: Must use import to load ES Module: /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/lib/definition.js
3require() of ES modules is not supported.
4require() of /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/babel-eslint/lib/require-from-eslint.js is an ES module file as it is a .js file whose nearest parent package.json contains &quot;type&quot;: &quot;module&quot; which defines all .js files in that package scope as ES modules.
5Instead rename definition.js to end in .cjs, change the requiring code to use import(), or remove &quot;type&quot;: &quot;module&quot; from /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/package.json
6{
7  &quot;name&quot;: &quot;my-react-boilerplate&quot;,
8  &quot;version&quot;: &quot;1.0.0&quot;,
9  &quot;description&quot;: &quot;&quot;,
10  &quot;main&quot;: &quot;index.tsx&quot;,
11  &quot;directories&quot;: {
12    &quot;test&quot;: &quot;test&quot;
13  },
14  &quot;engines&quot;: {
15    &quot;node&quot;: &quot;&gt;=14.0.0&quot;
16  },
17  &quot;type&quot;: &quot;module&quot;,
18  &quot;scripts&quot;: {
19    &quot;build&quot;: &quot;webpack --config webpack.prod.js&quot;,
20    &quot;dev&quot;: &quot;webpack serve --config webpack.dev.js&quot;,
21    &quot;lint&quot;: &quot;npm run typecheck &amp;&amp; npm run lint:css &amp;&amp; npm run lint:eslint:quiet&quot;,
22    &quot;lint:css&quot;: &quot;stylelint './src/**/*.{js,ts,tsx}'&quot;,
23    &quot;lint:eslint:quiet&quot;: &quot;eslint --ext .ts,.tsx,.js,.jsx  ./src --no-error-on-unmatched-pattern --quiet&quot;,
24    &quot;lint:eslint&quot;: &quot;eslint --ext .ts,.tsx,.js,.jsx  ./src --no-error-on-unmatched-pattern&quot;,
25    &quot;lint:eslint:fix&quot;: &quot;eslint --ext .ts,.tsx,.js,.jsx  ./src --no-error-on-unmatched-pattern --quiet --fix&quot;,
26    &quot;test&quot;: &quot;cross-env NODE_ENV=test jest --coverage&quot;,
27    &quot;test:watch&quot;: &quot;cross-env NODE_ENV=test jest --watchAll&quot;,
28    &quot;typecheck&quot;: &quot;tsc --noEmit&quot;,
29    &quot;precommit&quot;: &quot;npm run lint&quot;
30  },
31  &quot;lint-staged&quot;: {
32    &quot;*.{ts,tsx,js,jsx}&quot;: [
33      &quot;npm run lint:eslint:fix&quot;,
34      &quot;git add --force&quot;
35    ],
36    &quot;*.{md,json}&quot;: [
37      &quot;prettier --write&quot;,
38      &quot;git add --force&quot;
39    ]
40  },
41  &quot;husky&quot;: {
42    &quot;hooks&quot;: {
43      &quot;pre-commit&quot;: &quot;npx lint-staged &amp;&amp; npm run typecheck&quot;
44    }
45  },
46  &quot;resolutions&quot;: {
47    &quot;styled-components&quot;: &quot;^5&quot;
48  },
49  &quot;author&quot;: &quot;&quot;,
50  &quot;license&quot;: &quot;ISC&quot;,
51  &quot;devDependencies&quot;: {
52    &quot;@babel/core&quot;: &quot;^7.5.4&quot;,
53    &quot;@babel/plugin-proposal-class-properties&quot;: &quot;^7.5.0&quot;,
54    &quot;@babel/preset-env&quot;: &quot;^7.5.4&quot;,
55    &quot;@babel/preset-react&quot;: &quot;^7.0.0&quot;,
56    &quot;@types/history&quot;: &quot;^4.7.6&quot;,
57    &quot;@types/react&quot;: &quot;^17.0.29&quot;,
58    &quot;@types/react-dom&quot;: &quot;^17.0.9&quot;,
59    &quot;@types/react-router&quot;: &quot;^5.1.17&quot;,
60    &quot;@types/react-router-dom&quot;: &quot;^5.1.5&quot;,
61    &quot;@types/styled-components&quot;: &quot;^5.1.15&quot;,
62    &quot;@typescript-eslint/eslint-plugin&quot;: &quot;^5.0.0&quot;,
63    &quot;babel-cli&quot;: &quot;^6.26.0&quot;,
64    &quot;babel-eslint&quot;: &quot;^10.0.2&quot;,
65    &quot;babel-loader&quot;: &quot;^8.0.0-beta.6&quot;,
66    &quot;babel-polyfill&quot;: &quot;^6.26.0&quot;,
67    &quot;babel-preset-env&quot;: &quot;^1.7.0&quot;,
68    &quot;babel-preset-react&quot;: &quot;^6.24.1&quot;,
69    &quot;babel-preset-stage-2&quot;: &quot;^6.24.1&quot;,
70    &quot;clean-webpack-plugin&quot;: &quot;^4.0.0&quot;,
71    &quot;dotenv-webpack&quot;: &quot;^7.0.3&quot;,
72    &quot;error-overlay-webpack-plugin&quot;: &quot;^1.0.0&quot;,
73    &quot;eslint&quot;: &quot;^8.0.0&quot;,
74    &quot;eslint-config-airbnb&quot;: &quot;^18.2.0&quot;,
75    &quot;eslint-config-prettier&quot;: &quot;^8.3.0&quot;,
76    &quot;eslint-config-with-prettier&quot;: &quot;^6.0.0&quot;,
77    &quot;eslint-plugin-compat&quot;: &quot;^3.3.0&quot;,
78    &quot;eslint-plugin-import&quot;: &quot;^2.25.2&quot;,
79    &quot;eslint-plugin-jsx-a11y&quot;: &quot;^6.2.3&quot;,
80    &quot;eslint-plugin-prettier&quot;: &quot;^4.0.0&quot;,
81    &quot;eslint-plugin-react&quot;: &quot;^7.14.2&quot;,
82    &quot;eslint-plugin-react-hooks&quot;: &quot;^4.2.0&quot;,
83    &quot;extract-text-webpack-plugin&quot;: &quot;^3.0.2&quot;,
84    &quot;file-loader&quot;: &quot;^6.2.0&quot;,
85    &quot;html-webpack-plugin&quot;: &quot;^5.3.2&quot;,
86    &quot;husky&quot;: &quot;^7.0.2&quot;,
87    &quot;prettier&quot;: &quot;^2.4.1&quot;,
88    &quot;raw-loader&quot;: &quot;^4.0.2&quot;,
89    &quot;style-loader&quot;: &quot;^3.3.0&quot;,
90    &quot;stylelint&quot;: &quot;^13.13.1&quot;,
91    &quot;stylelint-config-recommended&quot;: &quot;^5.0.0&quot;,
92    &quot;stylelint-config-styled-components&quot;: &quot;^0.1.1&quot;,
93    &quot;stylelint-processor-styled-components&quot;: &quot;^1.10.0&quot;,
94    &quot;ts-loader&quot;: &quot;^9.2.6&quot;,
95    &quot;tslint&quot;: &quot;^6.1.3&quot;,
96    &quot;typescript&quot;: &quot;^4.4.4&quot;,
97    &quot;url-loader&quot;: &quot;^4.1.1&quot;,
98    &quot;webpack&quot;: &quot;^5.58.2&quot;,
99    &quot;webpack-cli&quot;: &quot;^4.2.0&quot;,
100    &quot;webpack-dev-server&quot;: &quot;^4.3.1&quot;,
101    &quot;webpack-merge&quot;: &quot;^5.3.0&quot;
102  },
103  &quot;dependencies&quot;: {
104    &quot;history&quot;: &quot;^4.10.0&quot;,
105    &quot;process&quot;: &quot;^0.11.10&quot;,
106    &quot;react&quot;: &quot;^17.0.1&quot;,
107    &quot;react-dom&quot;: &quot;^17.0.1&quot;,
108    &quot;react-router-dom&quot;: &quot;^5.2.0&quot;,
109    &quot;styled-components&quot;: &quot;^5.2.1&quot;
110  }
111}
112{
113  &quot;extends&quot;: [&quot;airbnb&quot;, &quot;prettier&quot;],
114  &quot;parser&quot;: &quot;babel-eslint&quot;,
115  &quot;plugins&quot;: [&quot;prettier&quot;, &quot;@typescript-eslint&quot;],
116  &quot;parserOptions&quot;: {
117    &quot;ecmaVersion&quot;: 8,
118    &quot;ecmaFeatures&quot;: {
119      &quot;experimentalObjectRestSpread&quot;: true,
120      &quot;impliedStrict&quot;: true,
121      &quot;classes&quot;: true
122    }
123  },
124  &quot;env&quot;: {
125    &quot;browser&quot;: true,
126    &quot;node&quot;: true,
127    &quot;jest&quot;: true
128  },
129  &quot;rules&quot;: {
130    &quot;arrow-body-style&quot;: [&quot;error&quot;, &quot;as-needed&quot;],
131    &quot;class-methods-use-this&quot;: 0,
132    &quot;react/jsx-filename-extension&quot;: 0,
133    &quot;global-require&quot;: 0,
134    &quot;react/destructuring-assignment&quot;: 0,
135    &quot;import/named&quot;: 2,
136    &quot;linebreak-style&quot;: 0,
137    &quot;import/no-dynamic-require&quot;: 0,
138    &quot;import/no-named-as-default&quot;: 0,
139    &quot;import/no-unresolved&quot;: 2,
140    &quot;import/prefer-default-export&quot;: 0,
141    &quot;semi&quot;: [2, &quot;always&quot;],
142    &quot;max-len&quot;: [
143      &quot;error&quot;,
144      {
145        &quot;code&quot;: 80,
146        &quot;ignoreUrls&quot;: true,
147        &quot;ignoreComments&quot;: true,
148        &quot;ignoreStrings&quot;: true,
149        &quot;ignoreTemplateLiterals&quot;: true
150      }
151    ],
152    &quot;new-cap&quot;: [
153      2,
154      {
155        &quot;capIsNew&quot;: false,
156        &quot;newIsCap&quot;: true
157      }
158    ],
159    &quot;no-param-reassign&quot;: 0,
160    &quot;no-shadow&quot;: 0,
161    &quot;no-tabs&quot;: 2,
162    &quot;no-underscore-dangle&quot;: 0,
163    &quot;react/forbid-prop-types&quot;: [
164      &quot;error&quot;,
165      {
166        &quot;forbid&quot;: [&quot;any&quot;]
167      }
168    ],
169    &quot;import/no-extraneous-dependencies&quot;: [&quot;error&quot;, { &quot;devDependencies&quot;: true }],
170    &quot;react/jsx-no-bind&quot;: [
171      &quot;error&quot;,
172      {
173        &quot;ignoreRefs&quot;: true,
174        &quot;allowArrowFunctions&quot;: true,
175        &quot;allowBind&quot;: false
176      }
177    ],
178    &quot;react/no-unknown-property&quot;: [
179      2,
180      {
181        &quot;ignore&quot;: [&quot;itemscope&quot;, &quot;itemtype&quot;, &quot;itemprop&quot;]
182      }
183    ]
184  }
185}
186

And i'm not sure if relevant but also my tsconfig.eslint.json file:

1/Users/ben/Desktop/development projects/react-boilerplate-styled-context/src/api/api.ts
2  0:0  error  Parsing error: Must use import to load ES Module: /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/lib/definition.js
3require() of ES modules is not supported.
4require() of /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/babel-eslint/lib/require-from-eslint.js is an ES module file as it is a .js file whose nearest parent package.json contains &quot;type&quot;: &quot;module&quot; which defines all .js files in that package scope as ES modules.
5Instead rename definition.js to end in .cjs, change the requiring code to use import(), or remove &quot;type&quot;: &quot;module&quot; from /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/package.json
6{
7  &quot;name&quot;: &quot;my-react-boilerplate&quot;,
8  &quot;version&quot;: &quot;1.0.0&quot;,
9  &quot;description&quot;: &quot;&quot;,
10  &quot;main&quot;: &quot;index.tsx&quot;,
11  &quot;directories&quot;: {
12    &quot;test&quot;: &quot;test&quot;
13  },
14  &quot;engines&quot;: {
15    &quot;node&quot;: &quot;&gt;=14.0.0&quot;
16  },
17  &quot;type&quot;: &quot;module&quot;,
18  &quot;scripts&quot;: {
19    &quot;build&quot;: &quot;webpack --config webpack.prod.js&quot;,
20    &quot;dev&quot;: &quot;webpack serve --config webpack.dev.js&quot;,
21    &quot;lint&quot;: &quot;npm run typecheck &amp;&amp; npm run lint:css &amp;&amp; npm run lint:eslint:quiet&quot;,
22    &quot;lint:css&quot;: &quot;stylelint './src/**/*.{js,ts,tsx}'&quot;,
23    &quot;lint:eslint:quiet&quot;: &quot;eslint --ext .ts,.tsx,.js,.jsx  ./src --no-error-on-unmatched-pattern --quiet&quot;,
24    &quot;lint:eslint&quot;: &quot;eslint --ext .ts,.tsx,.js,.jsx  ./src --no-error-on-unmatched-pattern&quot;,
25    &quot;lint:eslint:fix&quot;: &quot;eslint --ext .ts,.tsx,.js,.jsx  ./src --no-error-on-unmatched-pattern --quiet --fix&quot;,
26    &quot;test&quot;: &quot;cross-env NODE_ENV=test jest --coverage&quot;,
27    &quot;test:watch&quot;: &quot;cross-env NODE_ENV=test jest --watchAll&quot;,
28    &quot;typecheck&quot;: &quot;tsc --noEmit&quot;,
29    &quot;precommit&quot;: &quot;npm run lint&quot;
30  },
31  &quot;lint-staged&quot;: {
32    &quot;*.{ts,tsx,js,jsx}&quot;: [
33      &quot;npm run lint:eslint:fix&quot;,
34      &quot;git add --force&quot;
35    ],
36    &quot;*.{md,json}&quot;: [
37      &quot;prettier --write&quot;,
38      &quot;git add --force&quot;
39    ]
40  },
41  &quot;husky&quot;: {
42    &quot;hooks&quot;: {
43      &quot;pre-commit&quot;: &quot;npx lint-staged &amp;&amp; npm run typecheck&quot;
44    }
45  },
46  &quot;resolutions&quot;: {
47    &quot;styled-components&quot;: &quot;^5&quot;
48  },
49  &quot;author&quot;: &quot;&quot;,
50  &quot;license&quot;: &quot;ISC&quot;,
51  &quot;devDependencies&quot;: {
52    &quot;@babel/core&quot;: &quot;^7.5.4&quot;,
53    &quot;@babel/plugin-proposal-class-properties&quot;: &quot;^7.5.0&quot;,
54    &quot;@babel/preset-env&quot;: &quot;^7.5.4&quot;,
55    &quot;@babel/preset-react&quot;: &quot;^7.0.0&quot;,
56    &quot;@types/history&quot;: &quot;^4.7.6&quot;,
57    &quot;@types/react&quot;: &quot;^17.0.29&quot;,
58    &quot;@types/react-dom&quot;: &quot;^17.0.9&quot;,
59    &quot;@types/react-router&quot;: &quot;^5.1.17&quot;,
60    &quot;@types/react-router-dom&quot;: &quot;^5.1.5&quot;,
61    &quot;@types/styled-components&quot;: &quot;^5.1.15&quot;,
62    &quot;@typescript-eslint/eslint-plugin&quot;: &quot;^5.0.0&quot;,
63    &quot;babel-cli&quot;: &quot;^6.26.0&quot;,
64    &quot;babel-eslint&quot;: &quot;^10.0.2&quot;,
65    &quot;babel-loader&quot;: &quot;^8.0.0-beta.6&quot;,
66    &quot;babel-polyfill&quot;: &quot;^6.26.0&quot;,
67    &quot;babel-preset-env&quot;: &quot;^1.7.0&quot;,
68    &quot;babel-preset-react&quot;: &quot;^6.24.1&quot;,
69    &quot;babel-preset-stage-2&quot;: &quot;^6.24.1&quot;,
70    &quot;clean-webpack-plugin&quot;: &quot;^4.0.0&quot;,
71    &quot;dotenv-webpack&quot;: &quot;^7.0.3&quot;,
72    &quot;error-overlay-webpack-plugin&quot;: &quot;^1.0.0&quot;,
73    &quot;eslint&quot;: &quot;^8.0.0&quot;,
74    &quot;eslint-config-airbnb&quot;: &quot;^18.2.0&quot;,
75    &quot;eslint-config-prettier&quot;: &quot;^8.3.0&quot;,
76    &quot;eslint-config-with-prettier&quot;: &quot;^6.0.0&quot;,
77    &quot;eslint-plugin-compat&quot;: &quot;^3.3.0&quot;,
78    &quot;eslint-plugin-import&quot;: &quot;^2.25.2&quot;,
79    &quot;eslint-plugin-jsx-a11y&quot;: &quot;^6.2.3&quot;,
80    &quot;eslint-plugin-prettier&quot;: &quot;^4.0.0&quot;,
81    &quot;eslint-plugin-react&quot;: &quot;^7.14.2&quot;,
82    &quot;eslint-plugin-react-hooks&quot;: &quot;^4.2.0&quot;,
83    &quot;extract-text-webpack-plugin&quot;: &quot;^3.0.2&quot;,
84    &quot;file-loader&quot;: &quot;^6.2.0&quot;,
85    &quot;html-webpack-plugin&quot;: &quot;^5.3.2&quot;,
86    &quot;husky&quot;: &quot;^7.0.2&quot;,
87    &quot;prettier&quot;: &quot;^2.4.1&quot;,
88    &quot;raw-loader&quot;: &quot;^4.0.2&quot;,
89    &quot;style-loader&quot;: &quot;^3.3.0&quot;,
90    &quot;stylelint&quot;: &quot;^13.13.1&quot;,
91    &quot;stylelint-config-recommended&quot;: &quot;^5.0.0&quot;,
92    &quot;stylelint-config-styled-components&quot;: &quot;^0.1.1&quot;,
93    &quot;stylelint-processor-styled-components&quot;: &quot;^1.10.0&quot;,
94    &quot;ts-loader&quot;: &quot;^9.2.6&quot;,
95    &quot;tslint&quot;: &quot;^6.1.3&quot;,
96    &quot;typescript&quot;: &quot;^4.4.4&quot;,
97    &quot;url-loader&quot;: &quot;^4.1.1&quot;,
98    &quot;webpack&quot;: &quot;^5.58.2&quot;,
99    &quot;webpack-cli&quot;: &quot;^4.2.0&quot;,
100    &quot;webpack-dev-server&quot;: &quot;^4.3.1&quot;,
101    &quot;webpack-merge&quot;: &quot;^5.3.0&quot;
102  },
103  &quot;dependencies&quot;: {
104    &quot;history&quot;: &quot;^4.10.0&quot;,
105    &quot;process&quot;: &quot;^0.11.10&quot;,
106    &quot;react&quot;: &quot;^17.0.1&quot;,
107    &quot;react-dom&quot;: &quot;^17.0.1&quot;,
108    &quot;react-router-dom&quot;: &quot;^5.2.0&quot;,
109    &quot;styled-components&quot;: &quot;^5.2.1&quot;
110  }
111}
112{
113  &quot;extends&quot;: [&quot;airbnb&quot;, &quot;prettier&quot;],
114  &quot;parser&quot;: &quot;babel-eslint&quot;,
115  &quot;plugins&quot;: [&quot;prettier&quot;, &quot;@typescript-eslint&quot;],
116  &quot;parserOptions&quot;: {
117    &quot;ecmaVersion&quot;: 8,
118    &quot;ecmaFeatures&quot;: {
119      &quot;experimentalObjectRestSpread&quot;: true,
120      &quot;impliedStrict&quot;: true,
121      &quot;classes&quot;: true
122    }
123  },
124  &quot;env&quot;: {
125    &quot;browser&quot;: true,
126    &quot;node&quot;: true,
127    &quot;jest&quot;: true
128  },
129  &quot;rules&quot;: {
130    &quot;arrow-body-style&quot;: [&quot;error&quot;, &quot;as-needed&quot;],
131    &quot;class-methods-use-this&quot;: 0,
132    &quot;react/jsx-filename-extension&quot;: 0,
133    &quot;global-require&quot;: 0,
134    &quot;react/destructuring-assignment&quot;: 0,
135    &quot;import/named&quot;: 2,
136    &quot;linebreak-style&quot;: 0,
137    &quot;import/no-dynamic-require&quot;: 0,
138    &quot;import/no-named-as-default&quot;: 0,
139    &quot;import/no-unresolved&quot;: 2,
140    &quot;import/prefer-default-export&quot;: 0,
141    &quot;semi&quot;: [2, &quot;always&quot;],
142    &quot;max-len&quot;: [
143      &quot;error&quot;,
144      {
145        &quot;code&quot;: 80,
146        &quot;ignoreUrls&quot;: true,
147        &quot;ignoreComments&quot;: true,
148        &quot;ignoreStrings&quot;: true,
149        &quot;ignoreTemplateLiterals&quot;: true
150      }
151    ],
152    &quot;new-cap&quot;: [
153      2,
154      {
155        &quot;capIsNew&quot;: false,
156        &quot;newIsCap&quot;: true
157      }
158    ],
159    &quot;no-param-reassign&quot;: 0,
160    &quot;no-shadow&quot;: 0,
161    &quot;no-tabs&quot;: 2,
162    &quot;no-underscore-dangle&quot;: 0,
163    &quot;react/forbid-prop-types&quot;: [
164      &quot;error&quot;,
165      {
166        &quot;forbid&quot;: [&quot;any&quot;]
167      }
168    ],
169    &quot;import/no-extraneous-dependencies&quot;: [&quot;error&quot;, { &quot;devDependencies&quot;: true }],
170    &quot;react/jsx-no-bind&quot;: [
171      &quot;error&quot;,
172      {
173        &quot;ignoreRefs&quot;: true,
174        &quot;allowArrowFunctions&quot;: true,
175        &quot;allowBind&quot;: false
176      }
177    ],
178    &quot;react/no-unknown-property&quot;: [
179      2,
180      {
181        &quot;ignore&quot;: [&quot;itemscope&quot;, &quot;itemtype&quot;, &quot;itemprop&quot;]
182      }
183    ]
184  }
185}
186{
187  &quot;extends&quot;: &quot;./tsconfig.json&quot;,
188  &quot;include&quot;: [&quot;./src/**/*.ts&quot;, &quot;./src/**/*.tsx&quot;, &quot;./src/**/*.js&quot;],
189  &quot;exclude&quot;: [&quot;node_modules/**&quot;, &quot;build/**&quot;, &quot;coverage/**&quot;]
190}
191

Not sure if anyone has come across this before? Googling the error does not present any useful forums or raised bugs, most of them just state not to use require in your files which I am not.

ANSWER

Answered 2022-Mar-15 at 16:08

I think the problem is that you are trying to use the deprecated babel-eslint parser, last updated a year ago, which looks like it doesn't support ES6 modules. Updating to the latest parser seems to work, at least for simple linting.

So, do this:

  • In package.json, update the line "babel-eslint": "^10.0.2", to "@babel/eslint-parser": "^7.5.4",. This works with the code above but it may be better to use the latest version, which at the time of writing is 7.16.3.
  • Run npm i from a terminal/command prompt in the folder
  • In .eslintrc, update the parser line "parser": "babel-eslint", to "parser": "@babel/eslint-parser",
  • In .eslintrc, add "requireConfigFile": false, to the parserOptions section (underneath "ecmaVersion": 8,) (I needed this or babel was looking for config files I don't have)
  • Run the command to lint a file

Then, for me with just your two configuration files, the error goes away and I get appropriate linting errors.

Source https://stackoverflow.com/questions/69554485

QUESTION

throwError(error) is now deprecated, but there is no new Error(HttpErrorResponse)

Asked 2022-Mar-01 at 00:42

Apparently throwError(error) is now deprecated. The IntelliSense of VS Code suggests throwError(() => new Error('error'). new Error(...) accepts only strings. What's the correct way to replace it without breaking my HttpErrorHandlerService ?

http-error.interceptor.ts
1import { Injectable } from '@angular/core';
2import {
3  HttpEvent,
4  HttpInterceptor,
5  HttpHandler,
6  HttpRequest,
7  HttpErrorResponse,
8  HttpResponse,
9  HttpHeaders
10} from '@angular/common/http';
11import { Observable, EMPTY, finalize, catchError, timeout, map, throwError } from 'rxjs';
12
13import { HttpErrorHandlerService } from '@core/services';
14
15@Injectable()
16export class HttpErrorInterceptor implements HttpInterceptor {
17  private readonly APP_XHR_TIMEOUT = 6000;
18
19  constructor(private errorHandlerService: HttpErrorHandlerService) {}
20
21  intercept(request: HttpRequest&lt;any&gt;, next: HttpHandler): Observable&lt;HttpEvent&lt;any&gt;&gt; {
22    return next.handle(this.performRequest(request)).pipe(
23      timeout(this.APP_XHR_TIMEOUT),
24      map((event: HttpEvent&lt;any&gt;) =&gt; this.handleSuccessfulResponse(event)),
25      catchError((error: HttpErrorResponse) =&gt; this.processRequestError(error, request, next)),
26      finalize(this.handleRequestCompleted.bind(this))
27    );
28  }
29
30  private performRequest(request: HttpRequest&lt;any&gt;): HttpRequest&lt;any&gt; {
31    let headers: HttpHeaders = request.headers;
32    //headers = headers.set('MyCustomHeaderKey', `MyCustomHeaderValue`);
33    return request.clone({ headers });
34  }
35
36  private handleSuccessfulResponse(event: HttpEvent&lt;any&gt;): HttpEvent&lt;any&gt; {
37    if (event instanceof HttpResponse) {
38      event = event.clone({ body: event.body.response });
39    }
40    return event;
41  }
42
43  private processRequestError(
44    error: HttpErrorResponse,
45    request: HttpRequest&lt;any&gt;,
46    next: HttpHandler
47  ): Observable&lt;HttpEvent&lt;any&gt;&gt; {
48    console.log('http error response');
49
50    if ([401].includes(error.status)) {
51      return throwError(error);
52    }
53
54    this.errorHandlerService.handle(error);
55
56    return throwError(error);
57  }
58
59  private handleRequestCompleted(): void {
60    // console.log(`Request finished`);
61  }
62}
63
64import { Injectable } from '@angular/core';
65import { HttpErrorResponse } from '@angular/common/http';
66
67import { MessageService } from 'primeng/api';
68import { TimeoutError } from 'rxjs';
69
70/**
71 * Shows a user-friendly error message when a HTTP request fails.
72 */
73@Injectable({
74  providedIn: 'root'
75})
76export class HttpErrorHandlerService {
77  constructor(private messageService: MessageService) {}
78
79  handle(error: Error | HttpErrorResponse) {
80    if (error instanceof TimeoutError) {
81      return this.openDialog('error', `Няма връзка до сървъра.`);
82    }
83
84    if (error instanceof HttpErrorResponse &amp;&amp; error.error &amp;&amp; error.error.message) {
85      return this.openDialog('error', error.error.message);
86    }
87
88    if (error instanceof Error) {
89      switch (error.message) {
90        default:
91          return this.openDialog('error', `An unknown error occurred`);
92      }
93    }
94
95    // Generic HTTP errors
96    switch (error.status) {
97      case 400:
98        switch (error.error) {
99          case 'invalid_username_or_password':
100            return this.openDialog('error', 'Невалидно потребителско име или парола');
101          default:
102            return this.openDialog('error', 'Bad request');
103        }
104
105      case 401:
106        return this.openDialog('error', 'Ще трябва да се логнете отново');
107
108      case 403:
109        return this.openDialog('error', `You don't have the required permissions`);
110
111      case 404:
112        return this.openDialog('error', 'Resource not found');
113
114      case 422:
115        return this.openDialog('error', 'Invalid data provided');
116
117      case 500:
118      case 501:
119      case 502:
120      case 503:
121        return this.openDialog('error', 'An internal server error occurred');
122
123      case -1:
124        return this.openDialog(
125          'error',
126          'You appear to be offline. Please check your internet connection and try again.'
127        );
128
129      case 0:
130        return this.openDialog('error', `CORS issue?`);
131
132      default:
133        return this.openDialog('error', `An unknown error occurred`);
134    }
135  }
136
137  private openDialog(severity: string, message: string) {
138    if (message?.trim()) {
139      this.messageService.add({
140        key: 'interceptor',
141        severity: severity,
142        summary: 'Информация',
143        detail: message,
144        life: 3000
145      });
146    }
147  }
148}
149
150
auth.interceptor.ts
1import { Injectable } from '@angular/core';
2import {
3  HttpEvent,
4  HttpInterceptor,
5  HttpHandler,
6  HttpRequest,
7  HttpErrorResponse,
8  HttpResponse,
9  HttpHeaders
10} from '@angular/common/http';
11import { Observable, EMPTY, finalize, catchError, timeout, map, throwError } from 'rxjs';
12
13import { HttpErrorHandlerService } from '@core/services';
14
15@Injectable()
16export class HttpErrorInterceptor implements HttpInterceptor {
17  private readonly APP_XHR_TIMEOUT = 6000;
18
19  constructor(private errorHandlerService: HttpErrorHandlerService) {}
20
21  intercept(request: HttpRequest&lt;any&gt;, next: HttpHandler): Observable&lt;HttpEvent&lt;any&gt;&gt; {
22    return next.handle(this.performRequest(request)).pipe(
23      timeout(this.APP_XHR_TIMEOUT),
24      map((event: HttpEvent&lt;any&gt;) =&gt; this.handleSuccessfulResponse(event)),
25      catchError((error: HttpErrorResponse) =&gt; this.processRequestError(error, request, next)),
26      finalize(this.handleRequestCompleted.bind(this))
27    );
28  }
29
30  private performRequest(request: HttpRequest&lt;any&gt;): HttpRequest&lt;any&gt; {
31    let headers: HttpHeaders = request.headers;
32    //headers = headers.set('MyCustomHeaderKey', `MyCustomHeaderValue`);
33    return request.clone({ headers });
34  }
35
36  private handleSuccessfulResponse(event: HttpEvent&lt;any&gt;): HttpEvent&lt;any&gt; {
37    if (event instanceof HttpResponse) {
38      event = event.clone({ body: event.body.response });
39    }
40    return event;
41  }
42
43  private processRequestError(
44    error: HttpErrorResponse,
45    request: HttpRequest&lt;any&gt;,
46    next: HttpHandler
47  ): Observable&lt;HttpEvent&lt;any&gt;&gt; {
48    console.log('http error response');
49
50    if ([401].includes(error.status)) {
51      return throwError(error);
52    }
53
54    this.errorHandlerService.handle(error);
55
56    return throwError(error);
57  }
58
59  private handleRequestCompleted(): void {
60    // console.log(`Request finished`);
61  }
62}
63
64import { Injectable } from '@angular/core';
65import { HttpErrorResponse } from '@angular/common/http';
66
67import { MessageService } from 'primeng/api';
68import { TimeoutError } from 'rxjs';
69
70/**
71 * Shows a user-friendly error message when a HTTP request fails.
72 */
73@Injectable({
74  providedIn: 'root'
75})
76export class HttpErrorHandlerService {
77  constructor(private messageService: MessageService) {}
78
79  handle(error: Error | HttpErrorResponse) {
80    if (error instanceof TimeoutError) {
81      return this.openDialog('error', `Няма връзка до сървъра.`);
82    }
83
84    if (error instanceof HttpErrorResponse &amp;&amp; error.error &amp;&amp; error.error.message) {
85      return this.openDialog('error', error.error.message);
86    }
87
88    if (error instanceof Error) {
89      switch (error.message) {
90        default:
91          return this.openDialog('error', `An unknown error occurred`);
92      }
93    }
94
95    // Generic HTTP errors
96    switch (error.status) {
97      case 400:
98        switch (error.error) {
99          case 'invalid_username_or_password':
100            return this.openDialog('error', 'Невалидно потребителско име или парола');
101          default:
102            return this.openDialog('error', 'Bad request');
103        }
104
105      case 401:
106        return this.openDialog('error', 'Ще трябва да се логнете отново');
107
108      case 403:
109        return this.openDialog('error', `You don't have the required permissions`);
110
111      case 404:
112        return this.openDialog('error', 'Resource not found');
113
114      case 422:
115        return this.openDialog('error', 'Invalid data provided');
116
117      case 500:
118      case 501:
119      case 502:
120      case 503:
121        return this.openDialog('error', 'An internal server error occurred');
122
123      case -1:
124        return this.openDialog(
125          'error',
126          'You appear to be offline. Please check your internet connection and try again.'
127        );
128
129      case 0:
130        return this.openDialog('error', `CORS issue?`);
131
132      default:
133        return this.openDialog('error', `An unknown error occurred`);
134    }
135  }
136
137  private openDialog(severity: string, message: string) {
138    if (message?.trim()) {
139      this.messageService.add({
140        key: 'interceptor',
141        severity: severity,
142        summary: 'Информация',
143        detail: message,
144        life: 3000
145      });
146    }
147  }
148}
149
150import { Injectable } from '@angular/core';
151import {
152  HttpRequest,
153  HttpHandler,
154  HttpEvent,
155  HttpInterceptor,
156  HttpErrorResponse
157} from '@angular/common/http';
158import {
159  BehaviorSubject,
160  catchError,
161  EMPTY,
162  filter,
163  finalize,
164  Observable,
165  switchMap,
166  take,
167  throwError
168} from 'rxjs';
169
170import { AuthService } from '@core/services';
171import { AuthResponse } from '@core/types';
172
173@Injectable()
174export class AuthInterceptor implements HttpInterceptor {
175  private refreshTokenInProgress: boolean;
176  private refreshToken$ = new BehaviorSubject&lt;AuthResponse | null&gt;(null);
177
178  constructor(private authService: AuthService) {}
179
180  intercept(request: HttpRequest&lt;any&gt;, next: HttpHandler): Observable&lt;HttpEvent&lt;any&gt;&gt; {
181    return next
182      .handle(this.performRequest(request))
183      .pipe(
184        catchError((error: HttpErrorResponse) =&gt; this.processRequestError(error, request, next))
185      );
186  }
187
188  private performRequest(request: HttpRequest&lt;any&gt;): HttpRequest&lt;any&gt; {
189    const accessToken = this.authService.getAccessToken();
190
191    let headers = request.headers;
192    if (accessToken) {
193      headers = headers.set('Authorization', `Bearer ${accessToken}`);
194    }
195
196    return request.clone({ headers });
197  }
198
199  private processRequestError(
200    error: HttpErrorResponse,
201    request: HttpRequest&lt;any&gt;,
202    next: HttpHandler
203  ): Observable&lt;HttpEvent&lt;any&gt;&gt; {
204    console.log('auth interceptor called');
205
206    if (
207      error instanceof HttpErrorResponse &amp;&amp;
208      error.status === 401 &amp;&amp;
209      this.authService.isSignedIn()
210    ) {
211      return this.refreshToken(request, next);
212    }
213
214    return throwError(error);
215  }
216
217  private refreshToken(request: HttpRequest&lt;any&gt;, next: HttpHandler): Observable&lt;HttpEvent&lt;any&gt;&gt; {
218    console.log('refresh token in auth.interceptor called');
219
220    // in case the page consists of more than one requests
221    if (!this.refreshTokenInProgress) {
222      this.refreshToken$.next(null);
223      this.refreshTokenInProgress = true;
224
225      return this.authService.refreshToken().pipe(
226        switchMap((response) =&gt; {
227          if (response) {
228            this.refreshToken$.next(response);
229            return next.handle(this.performRequest(request));
230          }
231
232          this.authService.signOut();
233          return throwError(() =&gt; new Error(&quot;RefreshTokenFailed&quot;));
234        }),
235        catchError((error) =&gt; {
236          this.authService.signOut();
237          return throwError(error);
238        }),
239        finalize(() =&gt; (this.refreshTokenInProgress = false))
240      );
241    } else {
242      // wait while getting new token
243      return this.refreshToken$.pipe(
244        filter((result) =&gt; result !== null),
245        take(1),
246        switchMap(() =&gt; next.handle(this.performRequest(request)))
247      );
248    }
249  }
250}
251
252

ANSWER

Answered 2021-Aug-04 at 19:08

Instead of this:

1import { Injectable } from '@angular/core';
2import {
3  HttpEvent,
4  HttpInterceptor,
5  HttpHandler,
6  HttpRequest,
7  HttpErrorResponse,
8  HttpResponse,
9  HttpHeaders
10} from '@angular/common/http';
11import { Observable, EMPTY, finalize, catchError, timeout, map, throwError } from 'rxjs';
12
13import { HttpErrorHandlerService } from '@core/services';
14
15@Injectable()
16export class HttpErrorInterceptor implements HttpInterceptor {
17  private readonly APP_XHR_TIMEOUT = 6000;
18
19  constructor(private errorHandlerService: HttpErrorHandlerService) {}
20
21  intercept(request: HttpRequest&lt;any&gt;, next: HttpHandler): Observable&lt;HttpEvent&lt;any&gt;&gt; {
22    return next.handle(this.performRequest(request)).pipe(
23      timeout(this.APP_XHR_TIMEOUT),
24      map((event: HttpEvent&lt;any&gt;) =&gt; this.handleSuccessfulResponse(event)),
25      catchError((error: HttpErrorResponse) =&gt; this.processRequestError(error, request, next)),
26      finalize(this.handleRequestCompleted.bind(this))
27    );
28  }
29
30  private performRequest(request: HttpRequest&lt;any&gt;): HttpRequest&lt;any&gt; {
31    let headers: HttpHeaders = request.headers;
32    //headers = headers.set('MyCustomHeaderKey', `MyCustomHeaderValue`);
33    return request.clone({ headers });
34  }
35
36  private handleSuccessfulResponse(event: HttpEvent&lt;any&gt;): HttpEvent&lt;any&gt; {
37    if (event instanceof HttpResponse) {
38      event = event.clone({ body: event.body.response });
39    }
40    return event;
41  }
42
43  private processRequestError(
44    error: HttpErrorResponse,
45    request: HttpRequest&lt;any&gt;,
46    next: HttpHandler
47  ): Observable&lt;HttpEvent&lt;any&gt;&gt; {
48    console.log('http error response');
49
50    if ([401].includes(error.status)) {
51      return throwError(error);
52    }
53
54    this.errorHandlerService.handle(error);
55
56    return throwError(error);
57  }
58
59  private handleRequestCompleted(): void {
60    // console.log(`Request finished`);
61  }
62}
63
64import { Injectable } from '@angular/core';
65import { HttpErrorResponse } from '@angular/common/http';
66
67import { MessageService } from 'primeng/api';
68import { TimeoutError } from 'rxjs';
69
70/**
71 * Shows a user-friendly error message when a HTTP request fails.
72 */
73@Injectable({
74  providedIn: 'root'
75})
76export class HttpErrorHandlerService {
77  constructor(private messageService: MessageService) {}
78
79  handle(error: Error | HttpErrorResponse) {
80    if (error instanceof TimeoutError) {
81      return this.openDialog('error', `Няма връзка до сървъра.`);
82    }
83
84    if (error instanceof HttpErrorResponse &amp;&amp; error.error &amp;&amp; error.error.message) {
85      return this.openDialog('error', error.error.message);
86    }
87
88    if (error instanceof Error) {
89      switch (error.message) {
90        default:
91          return this.openDialog('error', `An unknown error occurred`);
92      }
93    }
94
95    // Generic HTTP errors
96    switch (error.status) {
97      case 400:
98        switch (error.error) {
99          case 'invalid_username_or_password':
100            return this.openDialog('error', 'Невалидно потребителско име или парола');
101          default:
102            return this.openDialog('error', 'Bad request');
103        }
104
105      case 401:
106        return this.openDialog('error', 'Ще трябва да се логнете отново');
107
108      case 403:
109        return this.openDialog('error', `You don't have the required permissions`);
110
111      case 404:
112        return this.openDialog('error', 'Resource not found');
113
114      case 422:
115        return this.openDialog('error', 'Invalid data provided');
116
117      case 500:
118      case 501:
119      case 502:
120      case 503:
121        return this.openDialog('error', 'An internal server error occurred');
122
123      case -1:
124        return this.openDialog(
125          'error',
126          'You appear to be offline. Please check your internet connection and try again.'
127        );
128
129      case 0:
130        return this.openDialog('error', `CORS issue?`);
131
132      default:
133        return this.openDialog('error', `An unknown error occurred`);
134    }
135  }
136
137  private openDialog(severity: string, message: string) {
138    if (message?.trim()) {
139      this.messageService.add({
140        key: 'interceptor',
141        severity: severity,
142        summary: 'Информация',
143        detail: message,
144        life: 3000
145      });
146    }
147  }
148}
149
150import { Injectable } from '@angular/core';
151import {
152  HttpRequest,
153  HttpHandler,
154  HttpEvent,
155  HttpInterceptor,
156  HttpErrorResponse
157} from '@angular/common/http';
158import {
159  BehaviorSubject,
160  catchError,
161  EMPTY,
162  filter,
163  finalize,
164  Observable,
165  switchMap,
166  take,
167  throwError
168} from 'rxjs';
169
170import { AuthService } from '@core/services';
171import { AuthResponse } from '@core/types';
172
173@Injectable()
174export class AuthInterceptor implements HttpInterceptor {
175  private refreshTokenInProgress: boolean;
176  private refreshToken$ = new BehaviorSubject&lt;AuthResponse | null&gt;(null);
177
178  constructor(private authService: AuthService) {}
179
180  intercept(request: HttpRequest&lt;any&gt;, next: HttpHandler): Observable&lt;HttpEvent&lt;any&gt;&gt; {
181    return next
182      .handle(this.performRequest(request))
183      .pipe(
184        catchError((error: HttpErrorResponse) =&gt; this.processRequestError(error, request, next))
185      );
186  }
187
188  private performRequest(request: HttpRequest&lt;any&gt;): HttpRequest&lt;any&gt; {
189    const accessToken = this.authService.getAccessToken();
190
191    let headers = request.headers;
192    if (accessToken) {
193      headers = headers.set('Authorization', `Bearer ${accessToken}`);
194    }
195
196    return request.clone({ headers });
197  }
198
199  private processRequestError(
200    error: HttpErrorResponse,
201    request: HttpRequest&lt;any&gt;,
202    next: HttpHandler
203  ): Observable&lt;HttpEvent&lt;any&gt;&gt; {
204    console.log('auth interceptor called');
205
206    if (
207      error instanceof HttpErrorResponse &amp;&amp;
208      error.status === 401 &amp;&amp;
209      this.authService.isSignedIn()
210    ) {
211      return this.refreshToken(request, next);
212    }
213
214    return throwError(error);
215  }
216
217  private refreshToken(request: HttpRequest&lt;any&gt;, next: HttpHandler): Observable&lt;HttpEvent&lt;any&gt;&gt; {
218    console.log('refresh token in auth.interceptor called');
219
220    // in case the page consists of more than one requests
221    if (!this.refreshTokenInProgress) {
222      this.refreshToken$.next(null);
223      this.refreshTokenInProgress = true;
224
225      return this.authService.refreshToken().pipe(
226        switchMap((response) =&gt; {
227          if (response) {
228            this.refreshToken$.next(response);
229            return next.handle(this.performRequest(request));
230          }
231
232          this.authService.signOut();
233          return throwError(() =&gt; new Error(&quot;RefreshTokenFailed&quot;));
234        }),
235        catchError((error) =&gt; {
236          this.authService.signOut();
237          return throwError(error);
238        }),
239        finalize(() =&gt; (this.refreshTokenInProgress = false))
240      );
241    } else {
242      // wait while getting new token
243      return this.refreshToken$.pipe(
244        filter((result) =&gt; result !== null),
245        take(1),
246        switchMap(() =&gt; next.handle(this.performRequest(request)))
247      );
248    }
249  }
250}
251
252    catchError((error) =&gt; {
253      this.authService.signOut();
254      return throwError(error);
255    }),
256

You could try this:

1import { Injectable } from '@angular/core';
2import {
3  HttpEvent,
4  HttpInterceptor,
5  HttpHandler,
6  HttpRequest,
7  HttpErrorResponse,
8  HttpResponse,
9  HttpHeaders
10} from '@angular/common/http';
11import { Observable, EMPTY, finalize, catchError, timeout, map, throwError } from 'rxjs';
12
13import { HttpErrorHandlerService } from '@core/services';
14
15@Injectable()
16export class HttpErrorInterceptor implements HttpInterceptor {
17  private readonly APP_XHR_TIMEOUT = 6000;
18
19  constructor(private errorHandlerService: HttpErrorHandlerService) {}
20
21  intercept(request: HttpRequest&lt;any&gt;, next: HttpHandler): Observable&lt;HttpEvent&lt;any&gt;&gt; {
22    return next.handle(this.performRequest(request)).pipe(
23      timeout(this.APP_XHR_TIMEOUT),
24      map((event: HttpEvent&lt;any&gt;) =&gt; this.handleSuccessfulResponse(event)),
25      catchError((error: HttpErrorResponse) =&gt; this.processRequestError(error, request, next)),
26      finalize(this.handleRequestCompleted.bind(this))
27    );
28  }
29
30  private performRequest(request: HttpRequest&lt;any&gt;): HttpRequest&lt;any&gt; {
31    let headers: HttpHeaders = request.headers;
32    //headers = headers.set('MyCustomHeaderKey', `MyCustomHeaderValue`);
33    return request.clone({ headers });
34  }
35
36  private handleSuccessfulResponse(event: HttpEvent&lt;any&gt;): HttpEvent&lt;any&gt; {
37    if (event instanceof HttpResponse) {
38      event = event.clone({ body: event.body.response });
39    }
40    return event;
41  }
42
43  private processRequestError(
44    error: HttpErrorResponse,
45    request: HttpRequest&lt;any&gt;,
46    next: HttpHandler
47  ): Observable&lt;HttpEvent&lt;any&gt;&gt; {
48    console.log('http error response');
49
50    if ([401].includes(error.status)) {
51      return throwError(error);
52    }
53
54    this.errorHandlerService.handle(error);
55
56    return throwError(error);
57  }
58
59  private handleRequestCompleted(): void {
60    // console.log(`Request finished`);
61  }
62}
63
64import { Injectable } from '@angular/core';
65import { HttpErrorResponse } from '@angular/common/http';
66
67import { MessageService } from 'primeng/api';
68import { TimeoutError } from 'rxjs';
69
70/**
71 * Shows a user-friendly error message when a HTTP request fails.
72 */
73@Injectable({
74  providedIn: 'root'
75})
76export class HttpErrorHandlerService {
77  constructor(private messageService: MessageService) {}
78
79  handle(error: Error | HttpErrorResponse) {
80    if (error instanceof TimeoutError) {
81      return this.openDialog('error', `Няма връзка до сървъра.`);
82    }
83
84    if (error instanceof HttpErrorResponse &amp;&amp; error.error &amp;&amp; error.error.message) {
85      return this.openDialog('error', error.error.message);
86    }
87
88    if (error instanceof Error) {
89      switch (error.message) {
90        default:
91          return this.openDialog('error', `An unknown error occurred`);
92      }
93    }
94
95    // Generic HTTP errors
96    switch (error.status) {
97      case 400:
98        switch (error.error) {
99          case 'invalid_username_or_password':
100            return this.openDialog('error', 'Невалидно потребителско име или парола');
101          default:
102            return this.openDialog('error', 'Bad request');
103        }
104
105      case 401:
106        return this.openDialog('error', 'Ще трябва да се логнете отново');
107
108      case 403:
109        return this.openDialog('error', `You don't have the required permissions`);
110
111      case 404:
112        return this.openDialog('error', 'Resource not found');
113
114      case 422:
115        return this.openDialog('error', 'Invalid data provided');
116
117      case 500:
118      case 501:
119      case 502:
120      case 503:
121        return this.openDialog('error', 'An internal server error occurred');
122
123      case -1:
124        return this.openDialog(
125          'error',
126          'You appear to be offline. Please check your internet connection and try again.'
127        );
128
129      case 0:
130        return this.openDialog('error', `CORS issue?`);
131
132      default:
133        return this.openDialog('error', `An unknown error occurred`);
134    }
135  }
136
137  private openDialog(severity: string, message: string) {
138    if (message?.trim()) {
139      this.messageService.add({
140        key: 'interceptor',
141        severity: severity,
142        summary: 'Информация',
143        detail: message,
144        life: 3000
145      });
146    }
147  }
148}
149
150import { Injectable } from '@angular/core';
151import {
152  HttpRequest,
153  HttpHandler,
154  HttpEvent,
155  HttpInterceptor,
156  HttpErrorResponse
157} from '@angular/common/http';
158import {
159  BehaviorSubject,
160  catchError,
161  EMPTY,
162  filter,
163  finalize,
164  Observable,
165  switchMap,
166  take,
167  throwError
168} from 'rxjs';
169
170import { AuthService } from '@core/services';
171import { AuthResponse } from '@core/types';
172
173@Injectable()
174export class AuthInterceptor implements HttpInterceptor {
175  private refreshTokenInProgress: boolean;
176  private refreshToken$ = new BehaviorSubject&lt;AuthResponse | null&gt;(null);
177
178  constructor(private authService: AuthService) {}
179
180  intercept(request: HttpRequest&lt;any&gt;, next: HttpHandler): Observable&lt;HttpEvent&lt;any&gt;&gt; {
181    return next
182      .handle(this.performRequest(request))
183      .pipe(
184        catchError((error: HttpErrorResponse) =&gt; this.processRequestError(error, request, next))
185      );
186  }
187
188  private performRequest(request: HttpRequest&lt;any&gt;): HttpRequest&lt;any&gt; {
189    const accessToken = this.authService.getAccessToken();
190
191    let headers = request.headers;
192    if (accessToken) {
193      headers = headers.set('Authorization', `Bearer ${accessToken}`);
194    }
195
196    return request.clone({ headers });
197  }
198
199  private processRequestError(
200    error: HttpErrorResponse,
201    request: HttpRequest&lt;any&gt;,
202    next: HttpHandler
203  ): Observable&lt;HttpEvent&lt;any&gt;&gt; {
204    console.log('auth interceptor called');
205
206    if (
207      error instanceof HttpErrorResponse &amp;&amp;
208      error.status === 401 &amp;&amp;
209      this.authService.isSignedIn()
210    ) {
211      return this.refreshToken(request, next);
212    }
213
214    return throwError(error);
215  }
216
217  private refreshToken(request: HttpRequest&lt;any&gt;, next: HttpHandler): Observable&lt;HttpEvent&lt;any&gt;&gt; {
218    console.log('refresh token in auth.interceptor called');
219
220    // in case the page consists of more than one requests
221    if (!this.refreshTokenInProgress) {
222      this.refreshToken$.next(null);
223      this.refreshTokenInProgress = true;
224
225      return this.authService.refreshToken().pipe(
226        switchMap((response) =&gt; {
227          if (response) {
228            this.refreshToken$.next(response);
229            return next.handle(this.performRequest(request));
230          }
231
232          this.authService.signOut();
233          return throwError(() =&gt; new Error(&quot;RefreshTokenFailed&quot;));
234        }),
235        catchError((error) =&gt; {
236          this.authService.signOut();
237          return throwError(error);
238        }),
239        finalize(() =&gt; (this.refreshTokenInProgress = false))
240      );
241    } else {
242      // wait while getting new token
243      return this.refreshToken$.pipe(
244        filter((result) =&gt; result !== null),
245        take(1),
246        switchMap(() =&gt; next.handle(this.performRequest(request)))
247      );
248    }
249  }
250}
251
252    catchError((error) =&gt; {
253      this.authService.signOut();
254      return throwError(error);
255    }),
256    catchError((error) =&gt; {
257      this.authService.signOut();
258      return throwError(() =&gt; error);
259    }),
260

I wasn't able to test it thoroughly, but a simple attempt seemed to work.

This was my simple test (using RxJS v7.2):

Service

1import { Injectable } from '@angular/core';
2import {
3  HttpEvent,
4  HttpInterceptor,
5  HttpHandler,
6  HttpRequest,
7  HttpErrorResponse,
8  HttpResponse,
9  HttpHeaders
10} from '@angular/common/http';
11import { Observable, EMPTY, finalize, catchError, timeout, map, throwError } from 'rxjs';
12
13import { HttpErrorHandlerService } from '@core/services';
14
15@Injectable()
16export class HttpErrorInterceptor implements HttpInterceptor {
17  private readonly APP_XHR_TIMEOUT = 6000;
18
19  constructor(private errorHandlerService: HttpErrorHandlerService) {}
20
21  intercept(request: HttpRequest&lt;any&gt;, next: HttpHandler): Observable&lt;HttpEvent&lt;any&gt;&gt; {
22    return next.handle(this.performRequest(request)).pipe(
23      timeout(this.APP_XHR_TIMEOUT),
24      map((event: HttpEvent&lt;any&gt;) =&gt; this.handleSuccessfulResponse(event)),
25      catchError((error: HttpErrorResponse) =&gt; this.processRequestError(error, request, next)),
26      finalize(this.handleRequestCompleted.bind(this))
27    );
28  }
29
30  private performRequest(request: HttpRequest&lt;any&gt;): HttpRequest&lt;any&gt; {
31    let headers: HttpHeaders = request.headers;
32    //headers = headers.set('MyCustomHeaderKey', `MyCustomHeaderValue`);
33    return request.clone({ headers });
34  }
35
36  private handleSuccessfulResponse(event: HttpEvent&lt;any&gt;): HttpEvent&lt;any&gt; {
37    if (event instanceof HttpResponse) {
38      event = event.clone({ body: event.body.response });
39    }
40    return event;
41  }
42
43  private processRequestError(
44    error: HttpErrorResponse,
45    request: HttpRequest&lt;any&gt;,
46    next: HttpHandler
47  ): Observable&lt;HttpEvent&lt;any&gt;&gt; {
48    console.log('http error response');
49
50    if ([401].includes(error.status)) {
51      return throwError(error);
52    }
53
54    this.errorHandlerService.handle(error);
55
56    return throwError(error);
57  }
58
59  private handleRequestCompleted(): void {
60    // console.log(`Request finished`);
61  }
62}
63
64import { Injectable } from '@angular/core';
65import { HttpErrorResponse } from '@angular/common/http';
66
67import { MessageService } from 'primeng/api';
68import { TimeoutError } from 'rxjs';
69
70/**
71 * Shows a user-friendly error message when a HTTP request fails.
72 */
73@Injectable({
74  providedIn: 'root'
75})
76export class HttpErrorHandlerService {
77  constructor(private messageService: MessageService) {}
78
79  handle(error: Error | HttpErrorResponse) {
80    if (error instanceof TimeoutError) {
81      return this.openDialog('error', `Няма връзка до сървъра.`);
82    }
83
84    if (error instanceof HttpErrorResponse &amp;&amp; error.error &amp;&amp; error.error.message) {
85      return this.openDialog('error', error.error.message);
86    }
87
88    if (error instanceof Error) {
89      switch (error.message) {
90        default:
91          return this.openDialog('error', `An unknown error occurred`);
92      }
93    }
94
95    // Generic HTTP errors
96    switch (error.status) {
97      case 400:
98        switch (error.error) {
99          case 'invalid_username_or_password':
100            return this.openDialog('error', 'Невалидно потребителско име или парола');
101          default:
102            return this.openDialog('error', 'Bad request');
103        }
104
105      case 401:
106        return this.openDialog('error', 'Ще трябва да се логнете отново');
107
108      case 403:
109        return this.openDialog('error', `You don't have the required permissions`);
110
111      case 404:
112        return this.openDialog('error', 'Resource not found');
113
114      case 422:
115        return this.openDialog('error', 'Invalid data provided');
116
117      case 500:
118      case 501:
119      case 502:
120      case 503:
121        return this.openDialog('error', 'An internal server error occurred');
122
123      case -1:
124        return this.openDialog(
125          'error',
126          'You appear to be offline. Please check your internet connection and try again.'
127        );
128
129      case 0:
130        return this.openDialog('error', `CORS issue?`);
131
132      default:
133        return this.openDialog('error', `An unknown error occurred`);
134    }
135  }
136
137  private openDialog(severity: string, message: string) {
138    if (message?.trim()) {
139      this.messageService.add({
140        key: 'interceptor',
141        severity: severity,
142        summary: 'Информация',
143        detail: message,
144        life: 3000
145      });
146    }
147  }
148}
149
150import { Injectable } from '@angular/core';
151import {
152  HttpRequest,
153  HttpHandler,
154  HttpEvent,
155  HttpInterceptor,
156  HttpErrorResponse
157} from '@angular/common/http';
158import {
159  BehaviorSubject,
160  catchError,
161  EMPTY,
162  filter,
163  finalize,
164  Observable,
165  switchMap,
166  take,
167  throwError
168} from 'rxjs';
169
170import { AuthService } from '@core/services';
171import { AuthResponse } from '@core/types';
172
173@Injectable()
174export class AuthInterceptor implements HttpInterceptor {
175  private refreshTokenInProgress: boolean;
176  private refreshToken$ = new BehaviorSubject&lt;AuthResponse | null&gt;(null);
177
178  constructor(private authService: AuthService) {}
179
180  intercept(request: HttpRequest&lt;any&gt;, next: HttpHandler): Observable&lt;HttpEvent&lt;any&gt;&gt; {
181    return next
182      .handle(this.performRequest(request))
183      .pipe(
184        catchError((error: HttpErrorResponse) =&gt; this.processRequestError(error, request, next))
185      );
186  }
187
188  private performRequest(request: HttpRequest&lt;any&gt;): HttpRequest&lt;any&gt; {
189    const accessToken = this.authService.getAccessToken();
190
191    let headers = request.headers;
192    if (accessToken) {
193      headers = headers.set('Authorization', `Bearer ${accessToken}`);
194    }
195
196    return request.clone({ headers });
197  }
198
199  private processRequestError(
200    error: HttpErrorResponse,
201    request: HttpRequest&lt;any&gt;,
202    next: HttpHandler
203  ): Observable&lt;HttpEvent&lt;any&gt;&gt; {
204    console.log('auth interceptor called');
205
206    if (
207      error instanceof HttpErrorResponse &amp;&amp;
208      error.status === 401 &amp;&amp;
209      this.authService.isSignedIn()
210    ) {
211      return this.refreshToken(request, next);
212    }
213
214    return throwError(error);
215  }
216
217  private refreshToken(request: HttpRequest&lt;any&gt;, next: HttpHandler): Observable&lt;HttpEvent&lt;any&gt;&gt; {
218    console.log('refresh token in auth.interceptor called');
219
220    // in case the page consists of more than one requests
221    if (!this.refreshTokenInProgress) {
222      this.refreshToken$.next(null);
223      this.refreshTokenInProgress = true;
224
225      return this.authService.refreshToken().pipe(
226        switchMap((response) =&gt; {
227          if (response) {
228            this.refreshToken$.next(response);
229            return next.handle(this.performRequest(request));
230          }
231
232          this.authService.signOut();
233          return throwError(() =&gt; new Error(&quot;RefreshTokenFailed&quot;));
234        }),
235        catchError((error) =&gt; {
236          this.authService.signOut();
237          return throwError(error);
238        }),
239        finalize(() =&gt; (this.refreshTokenInProgress = false))
240      );
241    } else {
242      // wait while getting new token
243      return this.refreshToken$.pipe(
244        filter((result) =&gt; result !== null),
245        take(1),
246        switchMap(() =&gt; next.handle(this.performRequest(request)))
247      );
248    }
249  }
250}
251
252    catchError((error) =&gt; {
253      this.authService.signOut();
254      return throwError(error);
255    }),
256    catchError((error) =&gt; {
257      this.authService.signOut();
258      return throwError(() =&gt; error);
259    }),
260  getProducts(): Observable&lt;IProduct[]&gt; {
261    return this.http.get&lt;IProduct[]&gt;(this.productUrl)
262      .pipe(
263        tap(data =&gt; console.log('All: ', JSON.stringify(data))),
264        catchError(this.handleError)
265      );
266  }
267
268  private handleError(err: HttpErrorResponse): Observable&lt;never&gt; {
269    // just a test ... more could would go here
270    return throwError(() =&gt; err);
271  }
272

Notice that err here is of type HttpErrorResponse.

Component

1import { Injectable } from '@angular/core';
2import {
3  HttpEvent,
4  HttpInterceptor,
5  HttpHandler,
6  HttpRequest,
7  HttpErrorResponse,
8  HttpResponse,
9  HttpHeaders
10} from '@angular/common/http';
11import { Observable, EMPTY, finalize, catchError, timeout, map, throwError } from 'rxjs';
12
13import { HttpErrorHandlerService } from '@core/services';
14
15@Injectable()
16export class HttpErrorInterceptor implements HttpInterceptor {
17  private readonly APP_XHR_TIMEOUT = 6000;
18
19  constructor(private errorHandlerService: HttpErrorHandlerService) {}
20
21  intercept(request: HttpRequest&lt;any&gt;, next: HttpHandler): Observable&lt;HttpEvent&lt;any&gt;&gt; {
22    return next.handle(this.performRequest(request)).pipe(
23      timeout(this.APP_XHR_TIMEOUT),
24      map((event: HttpEvent&lt;any&gt;) =&gt; this.handleSuccessfulResponse(event)),
25      catchError((error: HttpErrorResponse) =&gt; this.processRequestError(error, request, next)),
26      finalize(this.handleRequestCompleted.bind(this))
27    );
28  }
29
30  private performRequest(request: HttpRequest&lt;any&gt;): HttpRequest&lt;any&gt; {
31    let headers: HttpHeaders = request.headers;
32    //headers = headers.set('MyCustomHeaderKey', `MyCustomHeaderValue`);
33    return request.clone({ headers });
34  }
35
36  private handleSuccessfulResponse(event: HttpEvent&lt;any&gt;): HttpEvent&lt;any&gt; {
37    if (event instanceof HttpResponse) {
38      event = event.clone({ body: event.body.response });
39    }
40    return event;
41  }
42
43  private processRequestError(
44    error: HttpErrorResponse,
45    request: HttpRequest&lt;any&gt;,
46    next: HttpHandler
47  ): Observable&lt;HttpEvent&lt;any&gt;&gt; {
48    console.log('http error response');
49
50    if ([401].includes(error.status)) {
51      return throwError(error);
52    }
53
54    this.errorHandlerService.handle(error);
55
56    return throwError(error);
57  }
58
59  private handleRequestCompleted(): void {
60    // console.log(`Request finished`);
61  }
62}
63
64import { Injectable } from '@angular/core';
65import { HttpErrorResponse } from '@angular/common/http';
66
67import { MessageService } from 'primeng/api';
68import { TimeoutError } from 'rxjs';
69
70/**
71 * Shows a user-friendly error message when a HTTP request fails.
72 */
73@Injectable({
74  providedIn: 'root'
75})
76export class HttpErrorHandlerService {
77  constructor(private messageService: MessageService) {}
78
79  handle(error: Error | HttpErrorResponse) {
80    if (error instanceof TimeoutError) {
81      return this.openDialog('error', `Няма връзка до сървъра.`);
82    }
83
84    if (error instanceof HttpErrorResponse &amp;&amp; error.error &amp;&amp; error.error.message) {
85      return this.openDialog('error', error.error.message);
86    }
87
88    if (error instanceof Error) {
89      switch (error.message) {
90        default:
91          return this.openDialog('error', `An unknown error occurred`);
92      }
93    }
94
95    // Generic HTTP errors
96    switch (error.status) {
97      case 400:
98        switch (error.error) {
99          case 'invalid_username_or_password':
100            return this.openDialog('error', 'Невалидно потребителско име или парола');
101          default:
102            return this.openDialog('error', 'Bad request');
103        }
104
105      case 401:
106        return this.openDialog('error', 'Ще трябва да се логнете отново');
107
108      case 403:
109        return this.openDialog('error', `You don't have the required permissions`);
110
111      case 404:
112        return this.openDialog('error', 'Resource not found');
113
114      case 422:
115        return this.openDialog('error', 'Invalid data provided');
116
117      case 500:
118      case 501:
119      case 502:
120      case 503:
121        return this.openDialog('error', 'An internal server error occurred');
122
123      case -1:
124        return this.openDialog(
125          'error',
126          'You appear to be offline. Please check your internet connection and try again.'
127        );
128
129      case 0:
130        return this.openDialog('error', `CORS issue?`);
131
132      default:
133        return this.openDialog('error', `An unknown error occurred`);
134    }
135  }
136
137  private openDialog(severity: string, message: string) {
138    if (message?.trim()) {
139      this.messageService.add({
140        key: 'interceptor',
141        severity: severity,
142        summary: 'Информация',
143        detail: message,
144        life: 3000
145      });
146    }
147  }
148}
149
150import { Injectable } from '@angular/core';
151import {
152  HttpRequest,
153  HttpHandler,
154  HttpEvent,
155  HttpInterceptor,
156  HttpErrorResponse
157} from '@angular/common/http';
158import {
159  BehaviorSubject,
160  catchError,
161  EMPTY,
162  filter,
163  finalize,
164  Observable,
165  switchMap,
166  take,
167  throwError
168} from 'rxjs';
169
170import { AuthService } from '@core/services';
171import { AuthResponse } from '@core/types';
172
173@Injectable()
174export class AuthInterceptor implements HttpInterceptor {
175  private refreshTokenInProgress: boolean;
176  private refreshToken$ = new BehaviorSubject&lt;AuthResponse | null&gt;(null);
177
178  constructor(private authService: AuthService) {}
179
180  intercept(request: HttpRequest&lt;any&gt;, next: HttpHandler): Observable&lt;HttpEvent&lt;any&gt;&gt; {
181    return next
182      .handle(this.performRequest(request))
183      .pipe(
184        catchError((error: HttpErrorResponse) =&gt; this.processRequestError(error, request, next))
185      );
186  }
187
188  private performRequest(request: HttpRequest&lt;any&gt;): HttpRequest&lt;any&gt; {
189    const accessToken = this.authService.getAccessToken();
190
191    let headers = request.headers;
192    if (accessToken) {
193      headers = headers.set('Authorization', `Bearer ${accessToken}`);
194    }
195
196    return request.clone({ headers });
197  }
198
199  private processRequestError(
200    error: HttpErrorResponse,
201    request: HttpRequest&lt;any&gt;,
202    next: HttpHandler
203  ): Observable&lt;HttpEvent&lt;any&gt;&gt; {
204    console.log('auth interceptor called');
205
206    if (
207      error instanceof HttpErrorResponse &amp;&amp;
208      error.status === 401 &amp;&amp;
209      this.authService.isSignedIn()
210    ) {
211      return this.refreshToken(request, next);
212    }
213
214    return throwError(error);
215  }
216
217  private refreshToken(request: HttpRequest&lt;any&gt;, next: HttpHandler): Observable&lt;HttpEvent&lt;any&gt;&gt; {
218    console.log('refresh token in auth.interceptor called');
219
220    // in case the page consists of more than one requests
221    if (!this.refreshTokenInProgress) {
222      this.refreshToken$.next(null);
223      this.refreshTokenInProgress = true;
224
225      return this.authService.refreshToken().pipe(
226        switchMap((response) =&gt; {
227          if (response) {
228            this.refreshToken$.next(response);
229            return next.handle(this.performRequest(request));
230          }
231
232          this.authService.signOut();
233          return throwError(() =&gt; new Error(&quot;RefreshTokenFailed&quot;));
234        }),
235        catchError((error) =&gt; {
236          this.authService.signOut();
237          return throwError(error);
238        }),
239        finalize(() =&gt; (this.refreshTokenInProgress = false))
240      );
241    } else {
242      // wait while getting new token
243      return this.refreshToken$.pipe(
244        filter((result) =&gt; result !== null),
245        take(1),
246        switchMap(() =&gt; next.handle(this.performRequest(request)))
247      );
248    }
249  }
250}
251
252    catchError((error) =&gt; {
253      this.authService.signOut();
254      return throwError(error);
255    }),
256    catchError((error) =&gt; {
257      this.authService.signOut();
258      return throwError(() =&gt; error);
259    }),
260  getProducts(): Observable&lt;IProduct[]&gt; {
261    return this.http.get&lt;IProduct[]&gt;(this.productUrl)
262      .pipe(
263        tap(data =&gt; console.log('All: ', JSON.stringify(data))),
264        catchError(this.handleError)
265      );
266  }
267
268  private handleError(err: HttpErrorResponse): Observable&lt;never&gt; {
269    // just a test ... more could would go here
270    return throwError(() =&gt; err);
271  }
272  ngOnInit(): void {
273    this.sub = this.productService.getProducts().subscribe({
274      next: products =&gt; {
275        this.products = products;
276        this.filteredProducts = this.products;
277      },
278      error: err =&gt; this.errorMessage = err.message
279    });
280  }
281

Here I was able to retrieve the message property from the error response and display it in my UI.

Let me know if this works for you.

Source https://stackoverflow.com/questions/68655492

QUESTION

How to open emulators in different windows at Android Studio (Bumblebee | 2021.1.1)?

Asked 2022-Feb-22 at 19:06

I have two running emulators but they open together in different tabs and in one single window.

How to open them in two different window?

enter image description here

enter image description here

1Android Studio Bumblebee | 2021.1.1
2Build #AI-211.7628.21.2111.8092744, built on January 19, 2022
3Runtime version: 11.0.11+0-b60-7590822 amd64
4VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
5Linux 5.4.0-96-generic
6GC: G1 Young Generation, G1 Old Generation
7Memory: 3072M
8Cores: 12
9Registry: external.system.auto.import.disabled=true, debugger.watches.in.variables=false
10Non-Bundled Plugins: JUnit4-Parallel-Runner (1.5), com.intellij.javafx (1.0.3), com.intellij.marketplace (211.7628.36), com.atlassian.bitbucket.references (2021.1.195), com.thoughtworks.gauge (211.6693.111), org.jetbrains.kotlin (211-1.6.10-release-923-AS7442.40), com.developerphil.adbidea (1.6.4)
11Current Desktop: ubuntu:GNOME
12

ANSWER

Answered 2022-Feb-17 at 10:47

File->Settings->Tools->Emulator, and uncheck Launch in a tool window Then they will open in their own stand alone windows again.

Source https://stackoverflow.com/questions/70923189

Community Discussions contain sources that include Stack Exchange Network

Tutorials and Learning Resources in Server

Share this Page

share link

Get latest updates on Server