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

Popular New Releases in Utilities

terminal

Windows Terminal Preview v1.13.1098

thefuck

rust

Rust 1.60.0

webpack

reveal.js

4.3.0

Popular Libraries in Utilities

ohmyzsh

by ohmyzsh doticonshelldoticon

star image 141698 doticonMIT

šŸ™ƒ A delightful community-driven (with 2,000+ contributors) framework for managing your zsh configuration. Includes 300+ optional plugins (rails, git, macOS, hub, docker, homebrew, node, php, python, etc), 140+ themes to spice up your morning, and an auto-update tool so that makes it easy to keep up with the latest updates from the community.

Python-100-Days

by jackfrued doticonpythondoticon

star image 114192 doticon

Python - 100å¤©ä»Žę–°ę‰‹åˆ°å¤§åøˆ

terminal

by microsoft doticonc++doticon

star image 82454 doticonMIT

The new Windows Terminal and the original Windows console host, all in the same place!

thefuck

by nvbn doticonpythondoticon

star image 65678 doticonMIT

Magnificent app which corrects your previous console command.

rust

by rust-lang doticonrustdoticon

star image 65482 doticonNOASSERTION

Empowering everyone to build reliable and efficient software.

django

by django doticonpythondoticon

star image 63447 doticonNOASSERTION

The Web framework for perfectionists with deadlines.

webpack

by webpack doticonjavascriptdoticon

star image 60899 doticonMIT

A bundler for javascript and friends. Packs many modules into a few bundled assets. Code Splitting allows for loading parts of the application on demand. Through "loaders", modules can be CommonJs, AMD, ES6 modules, CSS, Images, JSON, Coffeescript, LESS, ... and your custom stuff.

reveal.js

by hakimel doticonjavascriptdoticon

star image 58580 doticonMIT

The HTML Presentation Framework

markdown-here

by adam-p doticonjavascriptdoticon

star image 54089 doticonMIT

Google Chrome, Firefox, and Thunderbird extension that lets you write email in Markdown and render it before sending.

Trending New libraries in Utilities

slidev

by slidevjs doticontypescriptdoticon

star image 19954 doticonMIT

Presentation Slides for Developers (Beta)

YesPlayMusic

by qier222 doticonjavascriptdoticon

star image 14385 doticonMIT

é«˜é¢œå€¼ēš„ē¬¬äø‰ę–¹ē½‘ę˜“äŗ‘ę’­ę”¾å™Øļ¼Œę”ÆęŒ Windows / macOS / Linux :electron:

ImHex

by WerWolv doticonc++doticon

star image 12561 doticonGPL-2.0

šŸ” A Hex Editor for Reverse Engineers, Programmers and people who value their retinas when working at 3 AM.

foam

by foambubble doticontypescriptdoticon

star image 11783 doticonNOASSERTION

A personal knowledge management and sharing system for VSCode

GHunt

by mxrch doticonpythondoticon

star image 10124 doticonMPL-2.0

šŸ•µļøā€ā™‚ļø Investigate Google emails and documents.

bubbletea

by charmbracelet doticongodoticon

star image 9726 doticonMIT

A powerful little TUI framework šŸ—

bashtop

by aristocratos doticonshelldoticon

star image 9013 doticonApache-2.0

Linux/OSX/FreeBSD resource monitor

compose-jb

by JetBrains doticonkotlindoticon

star image 8605 doticonApache-2.0

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.

duf

by muesli doticongodoticon

star image 8271 doticonNOASSERTION

Disk Usage/Free Utility - a better 'df' alternative

Top Authors in Utilities

1

sindresorhus

244 Libraries

star icon79940

2

cran

227 Libraries

star icon845

3

microsoft

221 Libraries

star icon113960

4

jonschlinkert

196 Libraries

star icon11042

5

google

144 Libraries

star icon154572

6

apache

99 Libraries

star icon17085

7

mafintosh

94 Libraries

star icon5905

8

aliyun

84 Libraries

star icon11441

9

azu

83 Libraries

star icon1306

10

boostorg

81 Libraries

star icon11581

1

244 Libraries

star icon79940

2

227 Libraries

star icon845

3

221 Libraries

star icon113960

4

196 Libraries

star icon11042

5

144 Libraries

star icon154572

6

99 Libraries

star icon17085

7

94 Libraries

star icon5905

8

84 Libraries

star icon11441

9

83 Libraries

star icon1306

10

81 Libraries

star icon11581

Trending Kits in Utilities

Data Summary : Resources that have been shared for the problem statement has info about food items and their description. Also we had order info from both donor and from consumer side orders on daily basis. We have done data cleaning and preprocessing as required. Recommendation system : In order to control the food wastage we have built Recommendation engine using "item-item based collaborative filtering" to recommend the items which expire early and are more in consumption. Data Analysis : We have developed a dashboard on tableau using cleaned datasets and these analysis can be used to match supply-demand of different types of food and to give an overview to the NGO, donors and consumers on how to reduce the food wastage. Use the open source, cloud APIs, or public libraries listed below in your application development based on your technology preferences, such as primary language. The below list also provides a view of the components' rating on different dimensions such as community support availability, security vulnerability, and overall quality, helping you make an informed choice for implementation and maintenance of your application. Please review the components carefully, having a no license alert or proprietary license, and use them appropriately in your applications. Please check the component page for the exact license of the component. You can also get information on the component's features, installation steps, top code snippets, and top community discussions on the component details page. The links to package managers are listed for download, where packages are readily available. Otherwise, build from the respective repositories for use in your application. You can also use the source code from the repositories in your applications based on the respective license types.

analysis

machine learning

Here are some of the famous JavaScript Tours and Guides Libraries. The use cases of these libraries include Creating Interactive Tours for Web and Mobile Applications, Enhancing Customer Experience, Creating Interactive Tutorials, and Improving User Onboarding. 


JavaScript libraries are collections of pre-written code that can be used to create web applications. They provide functions, features, and resources that make the development process faster and easier. They often create dynamic, interactive experiences on websites and applications. JavaScript libraries are used for various tasks, such as DOM manipulation, AJAX requests, data analysis and visualization, client-side storage, and more.  


Let us look at some of these famous libraries. 

webpack

  • Offers advanced features such as code-splitting, hot module replacement (HMR), tree-shaking, and dynamic loading.
  • Provides plugins and loaders that can be used to customize how code is transformed and bundled.
  • Allows to combine multiple modules into a single bundle.

mocha

  • Provides an asynchronous testing interface.
  • Supports a wide variety of testing styles with its flexible syntax.
  • Allows developers to create custom test interfaces and reporters.

intro.js

  • Supports auto-scroll and scroll-hijacking.
  • Allows developers to create custom tours in any language.
  • Provides a modern and lightweight interface, with a minimalistic design.

bower

  • Supports versioning and resolution of dependencies. 
  • Provides command line interface making it easy to instantly search, install, and manage packages in a project. 
  • Allows to manage both front-end and back-end packages. 

grunt

  • Provides wide range of plugins and third-party integrations.
  • Provides built-in support for popular frameworks and libraries.
  • Allows developers to easily configure and create tasks for automating common development workflows.

knockout

  • Provides an easy-to-use two-way data-binding system.
  • Provides a powerful templating system that makes it easy to display complex data structures. 
  • Provides a declarative binding syntax that simplifies linking the data to the HTML elements on the page. 

shepherd

  • Allows developers to create step-by-step product tours and walkthroughs intuitively.
  • Provides options for targeting specific users, including localization and different themes.
  • Supports integration with other libraries and frameworks, such as React and Vue.

mixitup

  • Provides built-in support for powerful animation effects.
  • Allows developers to create custom sorting and filtering rules.
  • Supports integration with external API's, allowing pulling in data from other sources. 

hopscotch

  • Is highly accessible, i.e., it is easy for people with disabilities to use.
  • Offers comprehensive documentation, making it easy for developers to get up and running quickly.
  • Is device-agnostic, meaning it works across different devices and browsers.

joyride

  • Provides a built-in feature called ā€œProgress Indicator,ā€ which allows the user to see their progress through the tour.  
  • A built-in analytics system provides valuable insights into how users interact with the tour. 
  • Allows developers to easily add triggers and custom CSS to enhance the user experience. 

SPEAKER COUNTING It enhances understanding through automatic speech recognition Beneficial for real - world applications like call-center transcription and meeting transcription analytics Speaker Diarization is a developing field of study, with new approaches being published on a frequent basis. The Problem Not many studies have been done for estimating a large number of speakers. Diarization becomes extremely difficult when the number of speakers is huge. Providing the number of speakers to the diarization system can be advantageous Complete solution Architecture - Machine Learning model - To predict the no. of speakers and the time stamps of the speaker. Web App - Frontend for the user to use the feature. Middleware Flask Api - To connect Frontend and ML Model. We have build a Web App that a user can use to communicate and leverage the advantages of the our Machine learning model. Since the model we build and the web app are build on different platforms, we used REST API as a middleware to connect frontend and model.

ML Model Solution Process

These are used to create our Web UI using node as backend and VueJs as front end. 1. Preprocessing: Denoising -> Speech separation 2. Embedding Extraction: YAMNet sound & classification model 3. Speaker Counting: Machine learning model selection -> Model training -> Model prediction

Data Preprocessing

Technologies used for pre processing the audio data.

Audio Pre Processing

The additional libaries are use to processing the audio which are needed to be fed into the classifier model.

Model Trainning

This libaries are used to create the two classifier models which are then both combined into one.

We can create any animation with suitable libraries or combinations of libraries in Python that are well-known for their functionalities and functionalities. For developers looking for options with less complex code with maximum customization options, users can customize their plots and designs depending on their preferences.   


Choosing a suitable library plays a key role in any machine learning or data science project, and we should do it properly to avoid other related issues which may arise. Some libraries offer an interactive plot to attract playing with the graph and visualize it uniquely. It will allow you to edit videos, create animations, and create a map or geological animations where we can analyze the geological data.  


Here is the list of handpicked 18 best Python Animation Libraries in 2023 which will help you with your animation requirements: 

manim - 3b1b: 

  • Is a Python library for creating mathematical animations and educational videos that Grant Sanderson develops.  
  • Is an open source library that allows users to create high-quality animations which visualize mathematical concepts like animations of graphs, functions, fractals, and more.   
  • Uses Python code for creating animations which we can export to animated GIFs or video files.  

PythonRobotics: 

  • Is a Python library for implementing different robotics simulations, visualizations, and algorithms. 
  • Offers various resources and tools for robotics developers, like algorithms for path planning, localization, motion control, mapping, and many more.   
  • Includes simulation environments like 2D and 3D simulators, that will allow developers to test their algorithms in virtual environments before deploying them on real robots.   

matplotlib: 

  • Is a comprehensive library for creating animated, interactive visualizations and static in Python. 
  • Produces publication-quality figures in different interactive environments and hardcopy formats across platforms. 
  • Can be used in Python Scripts, web application servers, various graphical user interface toolkits, and Python/IPython shells.  

manim - ManimCommunity:  

  • Is an animation engine for explanatory math videos used for programmatically creating precise animations. 
  • Includes various tools for creating animations like support for vector graphics, 3D objects, and complex mathematical equations. 
  • Also includes features for creating animations with custom fonts, styles, and colors.  

plotly.py: 

  • Is a Python library used to create interactive data visualizations, built on the plotly JavaScript library that allows developers to create various interactive plots.   
  • Is designed to be easy to use and includes different resources and tools for creating high-quality visualizations. 
  • Includes support for complex data structures like pandas DataFrames and offers various customization options for fonts, styles, and colors.  

seaborn: 

  • Is a Python data visualization library based on Matplotlib, offering a high-level interface to create attractive and informative statistical graphics.  
  • Offers various plotting functions for visualizing various data types like continuous data, data distribution, and categorial data.  
  • Its the ability to create visually appealing plots with minimal effort and supports the customization of plot elements like axes, titles, legends, and labels. 

moviepy: 

  • Is a Python library for video editing, concatenations, cutting, video composting, title insertions, creation of custom effects, and video processing. 
  • Has the ability to add audio to video clips easily and offers various filters and audio effects like changing pitch and speed, adding sound effects, and adjusting volume.  
  • Includes support for creating animations like moving text, images, and shapes and allows users to export their video clips to different file formats. 

termtosvg: 

  • Is a Python library that allows users to record terminal sessions and save them as SVG animations.  
  • Produces clean-looking and lightweight still frames embeddable on the project page or animations.  
  • Includes support for recording multiple terminal sessions, allowing users to control the size and speed of the resulting animation.   

altair: 

  • Is a declarative statistical visualization library that can help you spend more time understanding your data and its meaning. 
  • Offers a simple syntax for creating different visualizations, like line charts, histograms, scatterplots, and bar charts. 
  • Its declarative syntax lets user's express visualizations as a series of high-level mappings between visual and data properties like color, size, and position. 

PathPlanning: 

  • Is a Python library used for path and motion planning applications designed to be accessible to beginners and experts with a straightforward API. 
  • Offers various algorithms for computing collision-free paths for drones, mobile robots, and manipulators in 2D and 3D environments. 
  • Also offers tools for trajectory generation, motion control, and obstacle avoidance and supports simulation and visualization of robot motion. 

alive-progress: 

  • Is a Python library for displaying spinners and progress bars in command-line applications designed to offer a customizable way of showing progress indicators for long-running processes or tasks. 
  • Supports for pausing and resuming progress indicators, nested spinners, and progress bars.  
  • Designed to be intuitive and simple with various default settings and a straightforward API for customizing the behavior and appearance of spinners and progress bars. 

asciimatics: 

  • Is a package for helping people create full-screen text UIs on any platform and offers a single cross-platform Python class to do all the low-level console functions. 
  • Includes cursor positioning, mouse input, screen scraping, colored/styled text, detecting and handling if the console resizes, and keyboard input like Unicode support. 
  • Is a Python library for creating text-based animations and user interfaces in the terminal. 

pygal: 

  • Is a Python library for creating interactive Scalable Vector Graphics (SVG) graphs and charts. 
  • Offers various tools for generating customizable charts, graphs, and high-quality for use in presentations, reports, and web applications. 
  • Includes built-in support for data/time axis labeling, responsive design, and integration with web frameworks and interactive charts elements.   

GANimation: 

  • Is a Python implementation of the GANimation research project, which offers various tools for generating animations from still images using Generative Adversarial Networks (GANs).  
  • Includes tools for augmenting and preprocessing input data, customizable GAN training parameters and architecture, and support for evaluating and visualizing GAN models.  
  • Offers various tools for fine-tuning GAN models and generating high-quality animations for various applications. 

deep-motion-editing: 

  • Offers advanced and fundamental functions to work with 3D character animations in deep learning with Pytorch. 
  • Is a Python implementation of the research project of the same name, which offers tools for editing the motion of human characters in video sequences using deep learning methods.  
  • Its ability to generate realistic, high-quality animations for various applications offers tools for fine-tuning the deep learning model and editing the generated motions to achieve the desired results. 

geoplotlib: 

  • Is a Python library for creating geographical maps and visualizations and offers an easy-to-use interface for creating maps with different data types, like polygons, heatmaps, lines, and points. 
  • Includes support for different tile providers and map projections, customizable styling options for data layers like size, transparency, and color. 
  • Designed for creating interactive maps and visualizations and is suitable for various applications like data analysis, presentation, and exploration. 

Linux-Fake-Background-Webcam: 

  • Is a Python library that will allow users to replace their webcam background with a custom video or image on Linux systems.  
  • Works by creating a virtual webcam device that can be selected as the input source in video conferencing applications, allowing users to appear as if they are in various environments and locations.   
  • Includes the ability to control the position and size of the custom background video or image and support for replacing the webcam background with a custom video or audio. 

celluloid: 

  • Is a Python library that offers a simple interface for creating visualizations and animations in Matplotlib   
  • Designed to make it easy for users to create animations without having to write to deal with low-level details and complex code.  
  • Includes a simple interface for adding and updating data in the animation, the ability to save the animation as an MP4 or GIF video file, and support for customizing the animation style and appearance. 

Flappy Bird is an arcade-style game. It was initially released as a mobile game while tapping the screen to make the bird fly. Later, the game's pc version was released, where the Bird will be controlled using the up key or the space bar. If Bird hits on the pipes or the screen edges, the game ends, and the player needs to restart. Flappy Bird can fly the Bird as far as you can without hitting a pipe. The player is tasked with navigating Faby through pairs of pipes with equally sized gaps placed at random heights. Try to play as long as possible, score as many points as you can!. Following are the steps to be followed for build Flappy Bird Game, 1. Graphics Setup 2. Game Logic 3. Creating Input Controls 4. Generating Sound effects & Display Scores 5. Multi-player

Multi-player

Flappy bird is a single-player game, but it's possible to have multiplayer by using below libraries. Players will play on their game field one who gets more scores will win the game.

Graphic Designs & Game logic

Graphic designs are used in a flappy game to build an image of the player (bird), background, pipe, base and for displaying messages. Game logic and Graphic designs are build by using below libraries.

Creating Input Controls

Key mapper is an open-source library that allows users to use a key or combination of keys to perform a specific action(fly), which can be used for navigating.

Sound effects & Scores

Sound effects are used while the bird hits the pipe, generating scores for every move of a bird and a Game over by sfb & FlapPyBird libraries . Using flairfly library, scores can be calculated by the number of pipes crossed.

As we are in the digital era, real-time video games are ruling the young generation. Tank games are one of the addictive games of this generation. The objective of this game is to destroy the enemy's tank with our tank, which will decrease the energy level of the opponent. Similarly, our energy level will be reduced when the opponent attacks us with their tank. The attacking capacity ultimately depends on the energy level. The more is the energy level, the high is the attacking capacity. Following are the steps to be followed for building Tank Fight Game, 1.Graphic design & Sound effects 2.Firing and exploiting the tanks 3.Customize control over keyboard 4.Multi-player 5.3D Tank game

Customize control over keyboard

Key mapper is an open-source library that allows users to use a key or combination of keys to perform a specific action, which can be used for navigating and shooting. The below libraries can help you to create your control.

Graphic design & Sound effects

Listed below libraries help in creating the best graphic design and sound effects for gaming applications using python, C#, JavaScript, which can be used to design tanks, animate the movement of tanks, explosion of tanks, and display energy level bars.

Firing and exploiting the tanks

Random module, an open-source library, generates a random number provided the range, which can be used for firing and exploiting the tanks, decides the playing turn at the start of every game.

3D Tank game

The tank game can be built in 3D by using the below library.

Multi-player

Tank game can be played as multiplayer by using the below libraries. Multiplayers will play on the game field they shoot each other. The more is the energy level. The high is the attacking capacity.

Tetris has established itself as a famous game since the early video games. Even though the game looks simple requires intelligence and skills to play. The gameplay consists of tiles or tetrominoes of different shapes and a game field grid. The game's objective is to position the tiles in the game field, which fills the grid. The disappearing line will grant points. Accumulated points help users to move a level up. Once the game is over, the final score will be displayed to the user. Following steps to be followed to build your own Tetris game, 1.Create Blocks for Tetris 2.Graphic designs 3.Multi-player Tetris 4.Creating customized Game field 5.2D Tetris 6.3D Tetris 7.Control keys

Create Blocks & Graphics

Listed below libraries help in creating the best graphic design for gaming applications can help the moving tiles across the game field, selecting colors for tiles, making different shapes of tiles using different sizes of arrays, and matrix rotation. In the case of a single-player game, the game gets over when all blocks are formed such that no lines are disappearing.

2D Tetris Game

2D games are titles with only two axes of motion. Typically, these are "flat" games where you can move left and right up and down. You can create a 2D Tetris game using the below libraries.

3D Tetris Game

Players control multiple falling blocks, positioning and rotating them to clear layers in a three-dimensional environment similar to Tetris gameplay. You can create a 3D Tetris game using the below libraries.

Creating own Game field

The libraries listed below help to create custom matrices for the Tetris game.

Multi-player Tetris

Listed below libraries helps to build a multi-player Tetris game, two players will play on their game field one who gets more scores will win the battle.

Control Keys

Key mapper is an open-source that allows users to use a key or combination of keys to perform a rotation and move, which can be used for navigating. You can create your keys to play using the below libraries.

Regex libraries are essential for searching text, validating input in forms, or modifying wildcards to produce more specific and accurate search results. Using regex, you can parse out email addresses, URLs, phone numbers, or any other specific phrase from a larger document of text. Regex libraries were designed for this kind of search and extraction, serving as both a tool and a language understood by most software applications. Regex libraries are the most efficient and reliable way to parse text. They can be used to search, edit, and delete data with extreme precision. Regex libraries come in handy while working on text-based data such as documents, emails, scripts, etc. These libraries use regular expressions to parse text and filter out useful information from it. In this kit, we will be looking at some of the best Python regex libraries.

Open Source Intelligence has played a pivotal role in key events like tracing Covid-19 origins, MH17 downing, the Boston Marathon bombing, and the Myanmar refugee crisis. Approximately 500 million tweets are published every day, totaling over 200 billion posts in a year. Facebook users upload 350 million photos per day. YouTube users add nearly 720,000 hours of new video every day. Almost all devices are online today in the connected world.

While monitoring messages was exclusive to intelligence agencies, the tons of information available in the public realm today has made it possible for general and security enthusiasts to look for insights that might not have been possible earlier. The U.S. Department of State defines OSINT as "intelligence that is produced from publicly available information and is collected, exploited, and disseminated promptly to an appropriate audience to address a specific intelligence requirement."

Designed correctly, OSINT can reduce risk across a variety of common risks such as weather conditions, disease outbreaks, corporate risk management, data privacy, reputation management, in addition to higher-order tasks like national security and cybersecurity. Do not construe this as legal advice, promotion, or authorization to indulge in any activity whatsoever.

OSINT Framework

The OSINT framework enables gathering information from free tools or resources. The below open source libraries introduce and enable gathering information based on the OSINT Framework.

Target Reconnaissance

Recon-ng is a full-featured reconnaissance framework designed with the goal of providing a powerful environment to conduct open source web-based reconnaissance quickly and thoroughly.

Information Collection

theHarvester and similar tools gather emails, names, subdomains, IPs and URLs using multiple public data sources.

Track Online Assets

Shodan and Amass enable researchers to see the exposed assets.

Google Search

Google dorks provides information through the usage of operators, which are otherwise difficult to extract using simple searches.

According to ISO data, 249 countries are operating at different time zones in the world today. Each country has its people, culture, heritage, language, etc. The digital world distinguishes people based on their country of origin for distinct reasons. A time zone is a region with a standard time. There are over 24 different Time zones for the world. Working with the Time zone and country is highly critical in this digital era.

Getting User Time zone using JavaScript

Time zone data is essential in sending, storing, receiving, and displaying them to the users. If your application needs to show time zone-specific events or data to a user, you will need to retrieve the Time zone from where the application has been used or browsed. Some of the libraries that help you detect time zones are below.

Getting User Country using JavaScript

When a country's specific information is needed for users, you must detect the application's country. To achieve this, you need to catch each request's country of origin and show data or recommendations based on that. Some of the libraries used to detect user country are below.

this is related to UI Test tools.

Gr1

this is GR1

.NET is a well-established programming language. It has hundreds of libraries across several platforms. And developers have used them for many years. Following are the key features of Build tools, Big Builds: A collection of tasks and targets for MSBuild that improve build performance in a number of ways. Code Analysis: Contains the MSBuild targets and tasks necessary to run code analysis on your projects outside of Visual Studio. Compute Clusters: Provides a set of MSBuild tasks that can be used to execute jobs across multiple machines in a compute cluster. FSM (Finite State Machine): A scalable, extensible state machine implementation for C Continuous integration and deployment is the practice of automating the build, test, and deployment of applications. Find the currated C# libraries to enable optimized build tools and process in your application. Full list of the best open source C# Build Tools libraries below.

Audio Analysis from team Triple_trouble

Group Name 1

Group Name 2

Group Name 3

Group Name 4

Group Name 5

A Dictionary is used to find the meaning of the word. You can also use a dictionary to check the spelling of the particular word. Use the following libraries for creating your own Dictionary App with open-Source libraries.

Generally, people store information in files to track them easily on their need, and this basis file management system has been a great pillar to track, manage, and keep their data. File Management System is also used to send and receive our data and information in their necessity. File Management System also provides security to our files and also prevents them from destroying in future use. Use the following curated libraries to develop your own file management system.

This is Stella, an AI chatbot that runs on a web browser and capable of maintaining conversations with humans and also handle to-do lists. This project is for the HackMakers hackathon. - from Team Stellars.

development environment

VSCode and Jupyter Notebook are used for development and debugging. Jupyter Notebook is a web based interactive environment often used for experiments, whereas VSCode is used to get a typical experience of IDE for developers.

Exploratory Data Analysis

For extensive analysis and exploration of data, and to deal with arrays, these libraries are used. They are also used for performing scientific computation and data manipulation.

Text mining

Libraries in this group are used for analysis and processing of unstructured natural language. The data, as in its original form aren't used as it has to go through processing pipeline to become suitable for applying machine learning techniques and algorithms.

Machine Learning

We used to following libraries to train our model.

Request servicing via REST API

Web frameworks help build serving solution as REST APIs. The resources involved for servicing request can be handled by containerising and hosting on hyperscalers.

An ordered list of values is called a JSON array. It can store multiple values, strings, numbers, booleans, or objects in a JSON array. A comma must separate the values in the JSON array. A normal text file or stored data in column by column and split by a comma is called a CSV(comma-separated values).


Now will see the procedure to convert the JSON array to CSV,

  • Read the data from the JSON file and store the result as a string.
  • Construct a JSON object using the above string.
  • Get the JSON Array from the JSON Object.
  • Create a new CSV file using java. io. File.
  • Deliver a comma-delimited text from the JSONArray of JSONObjects and write it to the newly created CSV file.


The JSON can be used as a 'data-interchange format' and it is 'lightweight' and 'language independent'. It can parse text from a string to produce vector-like objects. The advantage of using JSON for data storage, it is safe for transferring the data and suitable across platforms. To store the data comparatively JSON is preferred better than CSV In terms of scalability of application or file and while working with a large volume of data. The most common usage of JSON is used in JavaScript-based applications that have browser extensions and websites as a part of their features.


Here is an example of how you can convert JSON array to CSV in Java:

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

Code

Instructions

  1. Copy the code using the "Copy" button above, and paste it in a Java file in your IDE.
  2. Add the required dependencies and import them in java file.
  3. Run the file to generate the output csv file.

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 'json array list to csv format' 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 Java 11.0.17.
  2. The solution is tested on JSON Version:20210307 and apache.commons:commons-io:1.3.2.


Using this solution, we are able to convert an json array to csv with simple steps. This process also facilities an easy way to use, hassle-free method to create a hands-on working version of code which would help us to convert an json array to csv.

Dependent Libraries

You can add the dependent library in your gradle or maven files. you can get the dependancy xml in above link

You can search for any dependent library on kandi like apache commons io and json java

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.

The technique for converting a JSON array to a CSV file using Apache Commons IO in Java can be helpful in several situations where you want to export data stored in a JSON array to a CSV file. This may be helpful in the following cases, for instance:  

  • converting data saved in a database or other storage system that is represented as a JSON array;  
  • exporting data from a web application or API that returns data in JSON format;  
  • Transforming data from one format to another is part of the ETL (extract, transform, load) process. 

 

It offers a large selection of classes and methods that can be utilized to carry out different I/O-related operations, including reading and writing files, navigating directories and files, reading and writing to input and output streams, and more. When working with I/O operations in Java, Apache Commons IO is a valuable tool in your toolbox because it is a widely used library.  

Here is an example of how you can convert JSON array to CSV using Apache common-io in Java for your application: 


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

Code

  1. Copy the code using the "Copy" button above, and paste it in a Java file in your IDE.
  2. Add dependent library and import in java file.
  3. Run the file to generate csv file.

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 "json array to csv in java" in kandi. You can try any such use case!

Development Libraries

You can add the dependent library in your gradle or maven files. you can get the dependancy xml in above link

You can search for any dependent library on kandi like apache commons io and json java

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.


OpenCV is a library of programming functions mainly aimed at real-time computer vision. It is written in C, C++, and Python, and runs on Windows, Linux, Android, and macOS.OpenCV is widely used in the field of computer vision for tasks such as object recognition, face detection, and image and video analysis. It has a large community of developers and users and is continuously updated and improved.


OpenCV provides a large collection of algorithms and functions for image and video processing, including:

  • Image processing operations like filtering, morphological transformations, thresholding, etc.
  • Object detection and recognition, including face detection and recognition, object tracking, etc.
  • Image and video analysis, including edge detection, feature extraction, and optical flow.
  • Camera calibration and 3D reconstruction.
  • Machine learning algorithms, including support for deep learning frameworks like TensorFlow and Caffe.


You can divide an image into two equal parts vertically or horizontally using OpenCV by simply slicing the image array. Here's an example of how you could divide an image into two equal parts horizontally in Python using OpenCV:


This code splits the image into two equal parts, horizontally. It first retrieves the shape of the image and calculates the height and width of the image. It then calculates the starting and ending row and column pixel coordinates for the top and bottom halves of the image. The image is then sliced and each half is stored in the cropped_top and cropped_bot variables. Finally, each of the two cropped images is displayed using the OpenCV function cv2.imshow() and is shown until a key is pressed using the cv2.waitKey(0) function


Here is an example of how you can Divide the image into two equal parts using OpenCV

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

CODE

In this solution we use the Imread function of the OpenCV.

  1. Copy the code using the "Copy" button above, and paste it in a Python file in your IDE.
  2. Modify the name, location of the image to display in the code.
  3. Run the file to divide the image to Top and Bottom


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 "divide image into tow equal parts python opencv" 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 and executed in python version 3.7.15 .
  2. The solution is tested on OpenCV 4.6.0
  3. The solution is tested on numpy 1.21.6


Using this solution, we are able to divide an image using the OpenCV 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 us divide an image in Python

Dependent Library

If you do not have OpenCV and numpy 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 OpenCV page in kandi.

You can search for any dependent library on kandi like OpenCV and numpy

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.

OpenCV is a computer vision library written in C++ and widely used for image and video processing. It offers a range of features for working with photographs and movies, including the ability to load and save images, use filters, find edges, and find and track objects. In collaboration, applications involving image and video processing are frequently created using Python and OpenCV. This combination enables you to develop solid and adaptable programs that can address various computer vision issues.  


In our work as developers, we frequently must read and rotate the photos in our applications to complete various image processing activities, such as recognition, upload, augmentation, training, and many more. There are numerous libraries for Python that enable working with images. Python has features for manipulating, enhancing, and creating more images. In addition to using additional OpenCV functions to apply other transformations to the image, such as scaling, cropping, and applying filters, you can modify the angle of rotation and the image's size to get the desired effect.  


Here is an example of how we can draw a line beyond the second point using opencv


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

CODE

In this solution we use the numpy and open cv library

  1. Copy the code using the "Copy" button above, and paste it in a Python file in your IDE.
  2. Import open Cv library and Numpy library.
  3. Modify the name and Length of the points.
  4. Run the file to draw a line.


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


ifound this code snippet by searching for "Draw a line in open cv and python beyond given points" in kandi. You can try any such use case!

Dependent Library

If you do not have OpenCV and numpy 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 OpenCV page in kandi.

You can search for any dependent library on kandi like OpenCV and numpy

Environment Test

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


  1. The solution is created and executed in python version 3.7.15 .
  2. The solution is tested on OpenCV 4.6.0 version
  3. The solution is tested on numpy 1.21.6


Using this solution, we are going to draw a line beyond the second given point using the OpenCv library and numpy 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 us draw a image in Python

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.


Trending Discussions on Utilities

Getting the error "Nested CSS was detected, but CSS nesting has not been configured correctly" in React app?

Apollo Client "Named export 'remove' not found"

Nuxt3: how to use tailwindcss

Laravel Mix URL Processing error with css-loader

How to get 2D scene coordinates of a 3D object in JavaFX

Basic angular app fails to run, Error module build failed : cannot find module ../@angular-devkit/src/babel/X

Why does my tailwind output file not include the utilities and components

How can I compare system_clock::now() to a local time in c++20?

Count trailing newlines with POSIX utilities or GNU coreutils or Perl

Create new color scheme for dark-light mode in bootstrap sass

QUESTION

Getting the error "Nested CSS was detected, but CSS nesting has not been configured correctly" in React app?

Asked 2022-Mar-23 at 09:04

I've been upgrading my CRA project to TailwindCSS 3, but now CSS nesting no longer works. Upon starting the server, the console spits out:

1(8:3) Nested CSS was detected, but CSS nesting has not been configured correctly.
2Please enable a CSS nesting plugin *before* Tailwind in your configuration.
3See how here: https://tailwindcss.com/docs/using-with-preprocessors#nesting
4

However, I don't see what must be done to correct this. I've tried setting up a plain CRA project with Tailwind (following this guide) just to make sure I have no conflicts, and still no success.

postcss.config.js:

1(8:3) Nested CSS was detected, but CSS nesting has not been configured correctly.
2Please enable a CSS nesting plugin *before* Tailwind in your configuration.
3See how here: https://tailwindcss.com/docs/using-with-preprocessors#nesting
4module.exports = {
5  plugins: {
6    "tailwindcss/nesting": {},
7    tailwindcss: {},
8    autoprefixer: {},
9  },
10};
11

As you can see, I have added the nesting plugin before Tailwind. It appears to me as if the plugin isn't being detected whatsoever. I've also tried replacing it with postcss-nesting with same outcome.

Note: I've also tried using the array syntax with require('tailwind/nesting') like the guide suggests.

Interestingly, removing all plugins from postcss.config.js (or using a require that fails to resolve) still outputs the same error, implying that this file isn't needed to get Tailwind to load. Maybe I am missing something that causes the whole postcss.config.js file to not be loaded in the first place?


index.js:

1(8:3) Nested CSS was detected, but CSS nesting has not been configured correctly.
2Please enable a CSS nesting plugin *before* Tailwind in your configuration.
3See how here: https://tailwindcss.com/docs/using-with-preprocessors#nesting
4module.exports = {
5  plugins: {
6    "tailwindcss/nesting": {},
7    tailwindcss: {},
8    autoprefixer: {},
9  },
10};
11import React from "react";
12import ReactDOM from "react-dom";
13import "./index.css";
14
15ReactDOM.render(
16  <React.StrictMode>
17    <div className="a">
18      aaa
19      <div className="b">bbb</div>
20    </div>
21  </React.StrictMode>,
22  document.getElementById("root")
23);
24

index.css:

1(8:3) Nested CSS was detected, but CSS nesting has not been configured correctly.
2Please enable a CSS nesting plugin *before* Tailwind in your configuration.
3See how here: https://tailwindcss.com/docs/using-with-preprocessors#nesting
4module.exports = {
5  plugins: {
6    "tailwindcss/nesting": {},
7    tailwindcss: {},
8    autoprefixer: {},
9  },
10};
11import React from "react";
12import ReactDOM from "react-dom";
13import "./index.css";
14
15ReactDOM.render(
16  <React.StrictMode>
17    <div className="a">
18      aaa
19      <div className="b">bbb</div>
20    </div>
21  </React.StrictMode>,
22  document.getElementById("root")
23);
24@tailwind base;
25@tailwind components;
26@tailwind utilities;
27
28.a {
29  @apply text-blue-500;
30
31  .b {
32    @apply text-green-500;
33  }
34}
35

package.json: (omitted things for brevity)

1(8:3) Nested CSS was detected, but CSS nesting has not been configured correctly.
2Please enable a CSS nesting plugin *before* Tailwind in your configuration.
3See how here: https://tailwindcss.com/docs/using-with-preprocessors#nesting
4module.exports = {
5  plugins: {
6    "tailwindcss/nesting": {},
7    tailwindcss: {},
8    autoprefixer: {},
9  },
10};
11import React from "react";
12import ReactDOM from "react-dom";
13import "./index.css";
14
15ReactDOM.render(
16  <React.StrictMode>
17    <div className="a">
18      aaa
19      <div className="b">bbb</div>
20    </div>
21  </React.StrictMode>,
22  document.getElementById("root")
23);
24@tailwind base;
25@tailwind components;
26@tailwind utilities;
27
28.a {
29  @apply text-blue-500;
30
31  .b {
32    @apply text-green-500;
33  }
34}
35{
36  "name": "tailwindtest",
37  "dependencies": {
38    "react": "^17.0.2",
39    "react-dom": "^17.0.2",
40    "react-scripts": "5.0.0"
41  },
42  "scripts": {
43    "start": "react-scripts start",
44    "build": "react-scripts build",
45    "test": "react-scripts test",
46    "eject": "react-scripts eject"
47  },
48  "devDependencies": {
49    "autoprefixer": "^10.4.2",
50    "postcss": "^8.4.5",
51    "tailwindcss": "^3.0.12"
52  }
53}
54

ANSWER

Answered 2022-Feb-03 at 18:38

This is mostly just bad news.

Create React App's Tailwind support means that they will detect tailwind.config.js in the project and add tailwindcss to their existing postcss configuration. Source in CRA

The guide that Tailwind offers on their site creates a dummy postcss.config.js - Making changes in this file does not change the actual postcss configuration. (misleading if anything)

This is a known issue currently - Github discussion on Tailwind support PR between Adam Wathan (Tailwind founder) and Ian Sutherland (CRA maintainer). But it does not seem like there is an intention to be fixed soon.

If you want to use nesting (or any PostCSS plugin really) is to eject from CRA using:

1(8:3) Nested CSS was detected, but CSS nesting has not been configured correctly.
2Please enable a CSS nesting plugin *before* Tailwind in your configuration.
3See how here: https://tailwindcss.com/docs/using-with-preprocessors#nesting
4module.exports = {
5  plugins: {
6    "tailwindcss/nesting": {},
7    tailwindcss: {},
8    autoprefixer: {},
9  },
10};
11import React from "react";
12import ReactDOM from "react-dom";
13import "./index.css";
14
15ReactDOM.render(
16  <React.StrictMode>
17    <div className="a">
18      aaa
19      <div className="b">bbb</div>
20    </div>
21  </React.StrictMode>,
22  document.getElementById("root")
23);
24@tailwind base;
25@tailwind components;
26@tailwind utilities;
27
28.a {
29  @apply text-blue-500;
30
31  .b {
32    @apply text-green-500;
33  }
34}
35{
36  "name": "tailwindtest",
37  "dependencies": {
38    "react": "^17.0.2",
39    "react-dom": "^17.0.2",
40    "react-scripts": "5.0.0"
41  },
42  "scripts": {
43    "start": "react-scripts start",
44    "build": "react-scripts build",
45    "test": "react-scripts test",
46    "eject": "react-scripts eject"
47  },
48  "devDependencies": {
49    "autoprefixer": "^10.4.2",
50    "postcss": "^8.4.5",
51    "tailwindcss": "^3.0.12"
52  }
53}
54npm run eject
55

After ejecting you can find CRA's postcss configuration in config/webpack.config.js - look for postcss-loader. Editing the configuration there can enable any postcss features.

PS: Look out for postcss-preset-env in the default configuration while enabling nesting. Tailwind requires you to edit configuration if this is present.

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

QUESTION

Apollo Client "Named export 'remove' not found"

Asked 2022-Mar-12 at 09:45

I'm attempting to create an apollo client plugin for a Nuxt 3 application. It's currently throwing an error regarding a package called ts-invariant:

1file:///Users/[my name]/Repositories/[project]/node_modules/@apollo/client/utilities/globals/fix-graphql.js:1
2import { remove } from "ts-invariant/process/index.js";
3         ^^^^^^
4SyntaxError: Named export 'remove' not found. The requested module 'ts-invariant/process/index.js' is a CommonJS module, which may not support all module.exports as named exports.
5CommonJS modules can always be imported via the default export, for example using:
6
7import pkg from 'ts-invariant/process/index.js';
8const { remove } = pkg;
9
10    at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)
11    at async ModuleJob.run (node:internal/modules/esm/module_job:181:5)
12    at async Promise.all (index 0)
13    at async ESMLoader.import (node:internal/modules/esm/loader:281:24)
14    at async __instantiateModule__ (file:///Users/[my name]/Repositories/[project]/.nuxt/dist/server/server.mjs:4550:3)
15[vite dev] Error loading external "/Users/[my name]/Repositories/[project]/node_modules/@apollo/client/core/index.js".
16  at file://./.nuxt/dist/server/server.mjs:3170:289  
17  at async __instantiateModule__ (file://./.nuxt/dist/server/server.mjs:4550:3)
18

I feel like I know enough about this error to know it has something to do with how Nuxt 3 deals with ESM, but I can't be for certain.

Here's the nuxt plugin:
plugins/apollo-client.js

1file:///Users/[my name]/Repositories/[project]/node_modules/@apollo/client/utilities/globals/fix-graphql.js:1
2import { remove } from "ts-invariant/process/index.js";
3         ^^^^^^
4SyntaxError: Named export 'remove' not found. The requested module 'ts-invariant/process/index.js' is a CommonJS module, which may not support all module.exports as named exports.
5CommonJS modules can always be imported via the default export, for example using:
6
7import pkg from 'ts-invariant/process/index.js';
8const { remove } = pkg;
9
10    at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)
11    at async ModuleJob.run (node:internal/modules/esm/module_job:181:5)
12    at async Promise.all (index 0)
13    at async ESMLoader.import (node:internal/modules/esm/loader:281:24)
14    at async __instantiateModule__ (file:///Users/[my name]/Repositories/[project]/.nuxt/dist/server/server.mjs:4550:3)
15[vite dev] Error loading external "/Users/[my name]/Repositories/[project]/node_modules/@apollo/client/core/index.js".
16  at file://./.nuxt/dist/server/server.mjs:3170:289  
17  at async __instantiateModule__ (file://./.nuxt/dist/server/server.mjs:4550:3)
18import { defineNuxtPlugin } from "#app"
19import { ApolloClient, InMemoryCache } from "@apollo/client/core"
20import { DefaultApolloClient } from "@vue/apollo-composable"
21
22export default defineNuxtPlugin((nuxtApp) => {
23  const config = useRuntimeConfig()
24  const apolloClient = new ApolloClient({
25    uri: config.PUBLIC_API_ENDPOINT,
26    cache: new InMemoryCache(),
27  })
28  nuxtApp.vueApp.provide(DefaultApolloClient, apolloClient)
29})
30

In a normal scenario, I might use the nuxt-apollo community module, but it is currently afk regarding a nuxt 3 port, so a plugin it is.

Here's some documentation I relied on for my plugin:
https://v4.apollo.vuejs.org/guide-composable/setup.html#vue-3
https://v3.nuxtjs.org/docs/directory-structure/plugins

ANSWER

Answered 2022-Jan-07 at 01:52

Solved by including @apollo/client and ts-invariant/process into the nuxt build transpile like so:

1file:///Users/[my name]/Repositories/[project]/node_modules/@apollo/client/utilities/globals/fix-graphql.js:1
2import { remove } from "ts-invariant/process/index.js";
3         ^^^^^^
4SyntaxError: Named export 'remove' not found. The requested module 'ts-invariant/process/index.js' is a CommonJS module, which may not support all module.exports as named exports.
5CommonJS modules can always be imported via the default export, for example using:
6
7import pkg from 'ts-invariant/process/index.js';
8const { remove } = pkg;
9
10    at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)
11    at async ModuleJob.run (node:internal/modules/esm/module_job:181:5)
12    at async Promise.all (index 0)
13    at async ESMLoader.import (node:internal/modules/esm/loader:281:24)
14    at async __instantiateModule__ (file:///Users/[my name]/Repositories/[project]/.nuxt/dist/server/server.mjs:4550:3)
15[vite dev] Error loading external "/Users/[my name]/Repositories/[project]/node_modules/@apollo/client/core/index.js".
16  at file://./.nuxt/dist/server/server.mjs:3170:289  
17  at async __instantiateModule__ (file://./.nuxt/dist/server/server.mjs:4550:3)
18import { defineNuxtPlugin } from "#app"
19import { ApolloClient, InMemoryCache } from "@apollo/client/core"
20import { DefaultApolloClient } from "@vue/apollo-composable"
21
22export default defineNuxtPlugin((nuxtApp) => {
23  const config = useRuntimeConfig()
24  const apolloClient = new ApolloClient({
25    uri: config.PUBLIC_API_ENDPOINT,
26    cache: new InMemoryCache(),
27  })
28  nuxtApp.vueApp.provide(DefaultApolloClient, apolloClient)
29})
30  // nuxt.config.js
31  // ...
32  build: {
33    postcss: {
34      postcssOptions: require('./postcss.config.js')
35    },
36    transpile: [
37      '@apollo/client',
38      'ts-invariant/process',
39    ],
40  },
41  // ...
42

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

QUESTION

Nuxt3: how to use tailwindcss

Asked 2022-Mar-02 at 14:50

Very first try on Nuxt3 via Nuxt3 Starter

I wonder how can I use tailwindcss in Nuxt3 Starter manually.

(Not via @nuxtjs/tailwindcss , because it's for Nuxt2, and not work with Nuxt3.)

I created a blank Nuxt3 project by

1npx degit "nuxt/starter#v3" my-nuxt3-project
2

then, I installed the tailwindcss manually

1npx degit "nuxt/starter#v3" my-nuxt3-project
2npm install -D tailwindcss@latest postcss@latest autoprefixer@latest
3

nuxt.config.ts

1npx degit "nuxt/starter#v3" my-nuxt3-project
2npm install -D tailwindcss@latest postcss@latest autoprefixer@latest
3export default {
4    css: [
5        '~/assets/tailwind.css',
6    ]
7}
8

assets/tailwind.css

1npx degit "nuxt/starter#v3" my-nuxt3-project
2npm install -D tailwindcss@latest postcss@latest autoprefixer@latest
3export default {
4    css: [
5        '~/assets/tailwind.css',
6    ]
7}
8@tailwind base;
9@tailwind components;
10@tailwind utilities;
11

but I can only get the raw code but not the compiled css: raw code but not the compiled css

How can I use tailwindcss in Nuxt3?

Any help is greatly appreciated!


online mini demo

ANSWER

Answered 2021-Oct-04 at 04:17

Maybe your problem is because you need a tailwindcss.config.js.

For this, simply type in the console:

1npx degit "nuxt/starter#v3" my-nuxt3-project
2npm install -D tailwindcss@latest postcss@latest autoprefixer@latest
3export default {
4    css: [
5        '~/assets/tailwind.css',
6    ]
7}
8@tailwind base;
9@tailwind components;
10@tailwind utilities;
11yarn run tailwindcss init
12

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

QUESTION

Laravel Mix URL Processing error with css-loader

Asked 2022-Feb-22 at 10:55

In a fresh Laravel 9 installation, the URL processing from Laravel Mix does not work anymore.

npm outputs the following:

1āœ– Mix
2  Compiled with some errors in 2.62s
3
4ERROR in ./resources/css/app.css
5Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
6ModuleBuildError: Module build failed (from ./node_modules/css-loader/dist/cjs.js):
7Error: Can't resolve './fonts/Inter-Regular.woff' in '/mnt/c/projects/test-project/resources/css'
8    at finishWithoutResolve (/mnt/c/projects/test-project/node_modules/enhanced-resolve/lib/Resolver.js:304:18)
9    at /mnt/c/projects/test-project/node_modules/enhanced-resolve/lib/Resolver.js:381:15
10    at /mnt/c/projects/test-project/node_modules/enhanced-resolve/lib/Resolver.js:430:5
11    at eval (eval at create (/mnt/c/projects/test-project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
12    at /mnt/c/projects/test-project/node_modules/enhanced-resolve/lib/Resolver.js:430:5
13    at eval (eval at create (/mnt/c/projects/test-project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
14    at /mnt/c/projects/test-project/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:87:43
15    at /mnt/c/projects/test-project/node_modules/enhanced-resolve/lib/Resolver.js:430:5
16    at eval (eval at create (/mnt/c/projects/test-project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
17    at /mnt/c/projects/test-project/node_modules/enhanced-resolve/lib/Resolver.js:430:5
18    at processResult (/mnt/c/projects/test-project/node_modules/webpack/lib/NormalModule.js:753:19)
19    at /mnt/c/projects/test-project/node_modules/webpack/lib/NormalModule.js:855:5
20    at /mnt/c/projects/test-project/node_modules/loader-runner/lib/LoaderRunner.js:399:11
21    at /mnt/c/projects/test-project/node_modules/loader-runner/lib/LoaderRunner.js:251:18
22    at context.callback (/mnt/c/projects/test-project/node_modules/loader-runner/lib/LoaderRunner.js:124:13)
23    at Object.loader (/mnt/c/projects/test-project/node_modules/css-loader/dist/index.js:155:5)
24    at runMicrotasks (<anonymous>)
25    at processTicksAndRejections (node:internal/process/task_queues:96:5)
26
271 ERROR in child compilations (Use 'stats.children: true' resp. '--stats-children' for more details)
28webpack compiled with 2 errors
29

The font file is just one of many. My app.css looks like this:

1āœ– Mix
2  Compiled with some errors in 2.62s
3
4ERROR in ./resources/css/app.css
5Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
6ModuleBuildError: Module build failed (from ./node_modules/css-loader/dist/cjs.js):
7Error: Can't resolve './fonts/Inter-Regular.woff' in '/mnt/c/projects/test-project/resources/css'
8    at finishWithoutResolve (/mnt/c/projects/test-project/node_modules/enhanced-resolve/lib/Resolver.js:304:18)
9    at /mnt/c/projects/test-project/node_modules/enhanced-resolve/lib/Resolver.js:381:15
10    at /mnt/c/projects/test-project/node_modules/enhanced-resolve/lib/Resolver.js:430:5
11    at eval (eval at create (/mnt/c/projects/test-project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
12    at /mnt/c/projects/test-project/node_modules/enhanced-resolve/lib/Resolver.js:430:5
13    at eval (eval at create (/mnt/c/projects/test-project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
14    at /mnt/c/projects/test-project/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:87:43
15    at /mnt/c/projects/test-project/node_modules/enhanced-resolve/lib/Resolver.js:430:5
16    at eval (eval at create (/mnt/c/projects/test-project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
17    at /mnt/c/projects/test-project/node_modules/enhanced-resolve/lib/Resolver.js:430:5
18    at processResult (/mnt/c/projects/test-project/node_modules/webpack/lib/NormalModule.js:753:19)
19    at /mnt/c/projects/test-project/node_modules/webpack/lib/NormalModule.js:855:5
20    at /mnt/c/projects/test-project/node_modules/loader-runner/lib/LoaderRunner.js:399:11
21    at /mnt/c/projects/test-project/node_modules/loader-runner/lib/LoaderRunner.js:251:18
22    at context.callback (/mnt/c/projects/test-project/node_modules/loader-runner/lib/LoaderRunner.js:124:13)
23    at Object.loader (/mnt/c/projects/test-project/node_modules/css-loader/dist/index.js:155:5)
24    at runMicrotasks (<anonymous>)
25    at processTicksAndRejections (node:internal/process/task_queues:96:5)
26
271 ERROR in child compilations (Use 'stats.children: true' resp. '--stats-children' for more details)
28webpack compiled with 2 errors
29@import 'tailwindcss/base';
30@import 'tailwindcss/components';
31@import 'tailwindcss/utilities';
32
33@import 'primevue/resources/primevue.css';
34@import 'primevue/resources/themes/lara-light-indigo/theme.css';
35@import 'primeflex/primeflex.css';
36@import 'primeicons/primeicons.css';
37

The package.json contains the following dependencies/versions:

1āœ– Mix
2  Compiled with some errors in 2.62s
3
4ERROR in ./resources/css/app.css
5Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
6ModuleBuildError: Module build failed (from ./node_modules/css-loader/dist/cjs.js):
7Error: Can't resolve './fonts/Inter-Regular.woff' in '/mnt/c/projects/test-project/resources/css'
8    at finishWithoutResolve (/mnt/c/projects/test-project/node_modules/enhanced-resolve/lib/Resolver.js:304:18)
9    at /mnt/c/projects/test-project/node_modules/enhanced-resolve/lib/Resolver.js:381:15
10    at /mnt/c/projects/test-project/node_modules/enhanced-resolve/lib/Resolver.js:430:5
11    at eval (eval at create (/mnt/c/projects/test-project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
12    at /mnt/c/projects/test-project/node_modules/enhanced-resolve/lib/Resolver.js:430:5
13    at eval (eval at create (/mnt/c/projects/test-project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
14    at /mnt/c/projects/test-project/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:87:43
15    at /mnt/c/projects/test-project/node_modules/enhanced-resolve/lib/Resolver.js:430:5
16    at eval (eval at create (/mnt/c/projects/test-project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
17    at /mnt/c/projects/test-project/node_modules/enhanced-resolve/lib/Resolver.js:430:5
18    at processResult (/mnt/c/projects/test-project/node_modules/webpack/lib/NormalModule.js:753:19)
19    at /mnt/c/projects/test-project/node_modules/webpack/lib/NormalModule.js:855:5
20    at /mnt/c/projects/test-project/node_modules/loader-runner/lib/LoaderRunner.js:399:11
21    at /mnt/c/projects/test-project/node_modules/loader-runner/lib/LoaderRunner.js:251:18
22    at context.callback (/mnt/c/projects/test-project/node_modules/loader-runner/lib/LoaderRunner.js:124:13)
23    at Object.loader (/mnt/c/projects/test-project/node_modules/css-loader/dist/index.js:155:5)
24    at runMicrotasks (<anonymous>)
25    at processTicksAndRejections (node:internal/process/task_queues:96:5)
26
271 ERROR in child compilations (Use 'stats.children: true' resp. '--stats-children' for more details)
28webpack compiled with 2 errors
29@import 'tailwindcss/base';
30@import 'tailwindcss/components';
31@import 'tailwindcss/utilities';
32
33@import 'primevue/resources/primevue.css';
34@import 'primevue/resources/themes/lara-light-indigo/theme.css';
35@import 'primeflex/primeflex.css';
36@import 'primeicons/primeicons.css';
37    "devDependencies": {
38        "@inertiajs/inertia": "^0.10.0",
39        "@inertiajs/inertia-vue3": "^0.5.1",
40        "@inertiajs/progress": "^0.2.6",
41        "@tailwindcss/forms": "^0.4.0",
42        "@vue/compiler-sfc": "^3.0.5",
43        "autoprefixer": "^10.2.4",
44        "axios": "^0.25",
45        "laravel-mix": "^6.0.6",
46        "lodash": "^4.17.19",
47        "postcss": "^8.2.13",
48        "postcss-import": "^14.0.1",
49        "tailwindcss": "^3.0.0",
50        "vue": "^3.0.5",
51        "vue-loader": "^16.1.2"
52    },
53    "dependencies": {
54        "primeflex": "^3.1.2",
55        "primeicons": "^5.0.0",
56        "primevue": "^3.11.1",
57        "vue-i18n": "^9.1.9"
58    }
59

The webpack.mix.js is default:

1āœ– Mix
2  Compiled with some errors in 2.62s
3
4ERROR in ./resources/css/app.css
5Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
6ModuleBuildError: Module build failed (from ./node_modules/css-loader/dist/cjs.js):
7Error: Can't resolve './fonts/Inter-Regular.woff' in '/mnt/c/projects/test-project/resources/css'
8    at finishWithoutResolve (/mnt/c/projects/test-project/node_modules/enhanced-resolve/lib/Resolver.js:304:18)
9    at /mnt/c/projects/test-project/node_modules/enhanced-resolve/lib/Resolver.js:381:15
10    at /mnt/c/projects/test-project/node_modules/enhanced-resolve/lib/Resolver.js:430:5
11    at eval (eval at create (/mnt/c/projects/test-project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
12    at /mnt/c/projects/test-project/node_modules/enhanced-resolve/lib/Resolver.js:430:5
13    at eval (eval at create (/mnt/c/projects/test-project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
14    at /mnt/c/projects/test-project/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:87:43
15    at /mnt/c/projects/test-project/node_modules/enhanced-resolve/lib/Resolver.js:430:5
16    at eval (eval at create (/mnt/c/projects/test-project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
17    at /mnt/c/projects/test-project/node_modules/enhanced-resolve/lib/Resolver.js:430:5
18    at processResult (/mnt/c/projects/test-project/node_modules/webpack/lib/NormalModule.js:753:19)
19    at /mnt/c/projects/test-project/node_modules/webpack/lib/NormalModule.js:855:5
20    at /mnt/c/projects/test-project/node_modules/loader-runner/lib/LoaderRunner.js:399:11
21    at /mnt/c/projects/test-project/node_modules/loader-runner/lib/LoaderRunner.js:251:18
22    at context.callback (/mnt/c/projects/test-project/node_modules/loader-runner/lib/LoaderRunner.js:124:13)
23    at Object.loader (/mnt/c/projects/test-project/node_modules/css-loader/dist/index.js:155:5)
24    at runMicrotasks (<anonymous>)
25    at processTicksAndRejections (node:internal/process/task_queues:96:5)
26
271 ERROR in child compilations (Use 'stats.children: true' resp. '--stats-children' for more details)
28webpack compiled with 2 errors
29@import 'tailwindcss/base';
30@import 'tailwindcss/components';
31@import 'tailwindcss/utilities';
32
33@import 'primevue/resources/primevue.css';
34@import 'primevue/resources/themes/lara-light-indigo/theme.css';
35@import 'primeflex/primeflex.css';
36@import 'primeicons/primeicons.css';
37    "devDependencies": {
38        "@inertiajs/inertia": "^0.10.0",
39        "@inertiajs/inertia-vue3": "^0.5.1",
40        "@inertiajs/progress": "^0.2.6",
41        "@tailwindcss/forms": "^0.4.0",
42        "@vue/compiler-sfc": "^3.0.5",
43        "autoprefixer": "^10.2.4",
44        "axios": "^0.25",
45        "laravel-mix": "^6.0.6",
46        "lodash": "^4.17.19",
47        "postcss": "^8.2.13",
48        "postcss-import": "^14.0.1",
49        "tailwindcss": "^3.0.0",
50        "vue": "^3.0.5",
51        "vue-loader": "^16.1.2"
52    },
53    "dependencies": {
54        "primeflex": "^3.1.2",
55        "primeicons": "^5.0.0",
56        "primevue": "^3.11.1",
57        "vue-i18n": "^9.1.9"
58    }
59mix.js('resources/js/app.js', 'public/js')
60    .vue()
61    .postCss('resources/css/app.css', 'public/css', [
62        require('postcss-import'),
63        require('tailwindcss'),
64        require('autoprefixer'),
65    ])
66    .webpackConfig(require('./webpack.config'));
67

Is there something I haven't seen?

ANSWER

Answered 2022-Feb-22 at 10:55

Actually moving the css imports into resources/js/app.js solves this problem. However, this results in the imported css to be included in the public/js/app.js, not the public/css/app.css.

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

QUESTION

How to get 2D scene coordinates of a 3D object in JavaFX

Asked 2022-Feb-02 at 12:28

I'm trying the create a 3D subscene with objects being labelled using Label objects in a 2D overlay. I've seen similar questions to mine on this subject, and they all point to using the Node.localToScene method on the node to be labelled in the 3D space. But this doesn't seem to work for my case. I've taken example code from the FXyz FloatingLabels example here:

FloatingLabels.java

The Label objects need to have their positions updated as the 3D scene in modified, which I've done but when I print out the coordinates returned by the Node.localToScene method, they're much too large to be within the application scene, and so the labels are never visible in the scene. I've written an example program that illustrates the issue, set up very similarly to the FXyz sample code but I've created an extra SubScene object to hold the 2D and 3D SubScene objects in order to plant them into a larger application window with slider controls. The 3D scene uses a perspective camera and shows a large sphere with coloured spheres along the x/y/z axes, and some extra little nubs on the surface for reference:

1import javafx.application.Application;
2import javafx.application.Platform;
3import javafx.scene.Group;
4import javafx.scene.Node;
5import javafx.scene.PerspectiveCamera;
6import javafx.scene.SubScene;
7import javafx.scene.Scene;
8import javafx.scene.SceneAntialiasing;
9import javafx.scene.AmbientLight;
10import javafx.scene.PointLight;
11import javafx.scene.control.Label;
12import javafx.scene.control.Slider;
13import javafx.scene.control.ToolBar;
14import javafx.scene.layout.GridPane;
15import javafx.scene.layout.StackPane;
16import javafx.scene.layout.Priority;
17import javafx.scene.shape.Sphere;
18import javafx.scene.paint.Color;
19import javafx.scene.paint.PhongMaterial;
20import javafx.scene.transform.Rotate;
21import javafx.scene.transform.Translate;
22import javafx.stage.Stage;
23import javafx.geometry.Point3D;
24
25import java.util.Map;
26import java.util.HashMap;
27
28public class LabelTest extends Application {
29
30  private Map<Node, Label> nodeToLabelMap;
31
32  @Override
33  public void start (Stage stage) {
34
35    // Create main scene graph
36
37    var objects3d = new Group();
38
39    Rotate xRotate = new Rotate (0, 0, 0, 0, Rotate.X_AXIS);
40    Rotate yRotate = new Rotate (0, 0, 0, 0, Rotate.Y_AXIS);
41    objects3d.getTransforms().addAll (
42      xRotate,
43      yRotate
44    );
45
46    var root3d = new Group();
47    root3d.getChildren().add (objects3d);
48
49    var camera = new PerspectiveCamera (true);
50    camera.setTranslateZ (-25);
51    
52    var scene3d = new SubScene (root3d, 500, 500, true, SceneAntialiasing.BALANCED);
53    scene3d.setFill (Color.rgb (20, 20, 80));
54    scene3d.setCamera (camera);
55
56    var sceneRoot = new Group (scene3d);
57    var objects2d = new Group();
58    sceneRoot.getChildren().add (objects2d);
59    var viewScene = new SubScene (sceneRoot, 500, 500);
60
61    scene3d.widthProperty().bind (viewScene.widthProperty());
62    scene3d.heightProperty().bind (viewScene.heightProperty());
63
64    // Add lights and objects
65
66    var ambient = new AmbientLight (Color.color (0.7, 0.7, 0.7));
67    var point = new PointLight (Color.color (0.3, 0.3, 0.3));
68    point.setTranslateX (-25);
69    point.setTranslateY (-25);
70    point.setTranslateZ (-50);
71    
72    root3d.getChildren().addAll (ambient, point);
73
74    var globe = new Sphere (5);
75    globe.setMaterial (new PhongMaterial (Color.color (0.3, 0.3, 0.3)));
76
77    var xSphere = new Sphere (0.5);
78    xSphere.setMaterial (new PhongMaterial (Color.RED));
79    xSphere.setTranslateX (5);
80
81    var ySphere = new Sphere (0.5);
82    ySphere.setMaterial (new PhongMaterial (Color.GREEN));
83    ySphere.setTranslateY (5);
84
85    var zSphere = new Sphere (0.5);
86    zSphere.setMaterial (new PhongMaterial (Color.BLUE));
87    zSphere.setTranslateZ (5);
88    
89    objects3d.getChildren().addAll (globe, xSphere, ySphere, zSphere);
90
91    var nubMaterial = new PhongMaterial (Color.color (0.2, 0.2, 0.2));
92    for (int i = 0; i < 200; i++) {
93      var nub = new Sphere (0.125);
94      nub.setMaterial (nubMaterial);
95      var phi = 2*Math.PI*Math.random();
96      var theta = Math.acos (2*Math.random() - 1);
97      var z = -5 * Math.sin (theta) * Math.cos (phi);
98      var x = 5 * Math.sin (theta) * Math.sin (phi);
99      var y = -5 * Math.cos (theta);
100      nub.setTranslateX (x);
101      nub.setTranslateY (y);
102      nub.setTranslateZ (z);
103      objects3d.getChildren().add (nub);
104    } // for
105
106    // Add labels
107
108    var xLabel = new Label ("X axis");
109    xLabel.setTextFill (Color.RED);
110
111    var yLabel = new Label ("Y axis");
112    yLabel.setTextFill (Color.GREEN);
113
114    var zLabel = new Label ("Z axis");
115    zLabel.setTextFill (Color.BLUE);
116
117    objects2d.getChildren().addAll (xLabel, yLabel, zLabel);
118
119    nodeToLabelMap = new HashMap<>();
120    nodeToLabelMap.put (xSphere, xLabel);
121    nodeToLabelMap.put (ySphere, yLabel);
122    nodeToLabelMap.put (zSphere, zLabel);
123
124    xRotate.angleProperty().addListener ((obs, oldVal, newVal) -> updateLabels());
125    yRotate.angleProperty().addListener ((obs, oldVal, newVal) -> updateLabels());
126    camera.translateZProperty().addListener ((obs, oldVal, newVal) -> updateLabels());
127    Platform.runLater (() -> updateLabels());
128
129    // Create main pane
130
131    var gridPane = new GridPane();
132    
133    var stackPane = new StackPane (viewScene);
134    viewScene.heightProperty().bind (stackPane.heightProperty());
135    viewScene.widthProperty().bind (stackPane.widthProperty());
136    viewScene.setManaged (false);
137
138    gridPane.add (stackPane, 0, 0);
139    gridPane.setVgrow (stackPane, Priority.ALWAYS);
140    gridPane.setHgrow (stackPane, Priority.ALWAYS);
141
142    // Add controls
143
144    var xSlider = new Slider (-90, 90, 0);
145    xRotate.angleProperty().bind (xSlider.valueProperty());
146    var ySlider = new Slider (-180, 180, 0);
147    yRotate.angleProperty().bind (ySlider.valueProperty());
148    var zSlider = new Slider (-60, -25, -25);
149    camera.translateZProperty().bind (zSlider.valueProperty());
150
151    ToolBar toolbar = new ToolBar (
152      new Label ("X rotation:"),
153      xSlider,
154      new Label ("Y rotation:"),
155      ySlider,
156      new Label ("Z position:"),
157      zSlider
158    );
159    gridPane.add (toolbar, 0, 1);
160
161    // Start the show
162
163    stage.setTitle ("Label Test");
164    stage.setScene (new Scene (gridPane, 800, 600));
165    stage.show();
166
167  } // start
168  
169  private void updateLabels () {
170    
171    nodeToLabelMap.forEach ((node, label) -> {
172      var coord = node.localToScene (Point3D.ZERO, true);
173      System.out.println ("label = " + label.getText() + ", coord = " + coord);
174      label.getTransforms().setAll (new Translate(coord.getX(), coord.getY()));
175    });
176
177  } // updateLabels
178  
179  public static void main (String[] args) {
180
181    launch (args);
182
183  } // main
184
185} // LabelTest class
186

You can compile and run the LabelTest.java program using this script (I'm using JavaFX 14 and JDK 14.0.2 on a Mac):

1import javafx.application.Application;
2import javafx.application.Platform;
3import javafx.scene.Group;
4import javafx.scene.Node;
5import javafx.scene.PerspectiveCamera;
6import javafx.scene.SubScene;
7import javafx.scene.Scene;
8import javafx.scene.SceneAntialiasing;
9import javafx.scene.AmbientLight;
10import javafx.scene.PointLight;
11import javafx.scene.control.Label;
12import javafx.scene.control.Slider;
13import javafx.scene.control.ToolBar;
14import javafx.scene.layout.GridPane;
15import javafx.scene.layout.StackPane;
16import javafx.scene.layout.Priority;
17import javafx.scene.shape.Sphere;
18import javafx.scene.paint.Color;
19import javafx.scene.paint.PhongMaterial;
20import javafx.scene.transform.Rotate;
21import javafx.scene.transform.Translate;
22import javafx.stage.Stage;
23import javafx.geometry.Point3D;
24
25import java.util.Map;
26import java.util.HashMap;
27
28public class LabelTest extends Application {
29
30  private Map<Node, Label> nodeToLabelMap;
31
32  @Override
33  public void start (Stage stage) {
34
35    // Create main scene graph
36
37    var objects3d = new Group();
38
39    Rotate xRotate = new Rotate (0, 0, 0, 0, Rotate.X_AXIS);
40    Rotate yRotate = new Rotate (0, 0, 0, 0, Rotate.Y_AXIS);
41    objects3d.getTransforms().addAll (
42      xRotate,
43      yRotate
44    );
45
46    var root3d = new Group();
47    root3d.getChildren().add (objects3d);
48
49    var camera = new PerspectiveCamera (true);
50    camera.setTranslateZ (-25);
51    
52    var scene3d = new SubScene (root3d, 500, 500, true, SceneAntialiasing.BALANCED);
53    scene3d.setFill (Color.rgb (20, 20, 80));
54    scene3d.setCamera (camera);
55
56    var sceneRoot = new Group (scene3d);
57    var objects2d = new Group();
58    sceneRoot.getChildren().add (objects2d);
59    var viewScene = new SubScene (sceneRoot, 500, 500);
60
61    scene3d.widthProperty().bind (viewScene.widthProperty());
62    scene3d.heightProperty().bind (viewScene.heightProperty());
63
64    // Add lights and objects
65
66    var ambient = new AmbientLight (Color.color (0.7, 0.7, 0.7));
67    var point = new PointLight (Color.color (0.3, 0.3, 0.3));
68    point.setTranslateX (-25);
69    point.setTranslateY (-25);
70    point.setTranslateZ (-50);
71    
72    root3d.getChildren().addAll (ambient, point);
73
74    var globe = new Sphere (5);
75    globe.setMaterial (new PhongMaterial (Color.color (0.3, 0.3, 0.3)));
76
77    var xSphere = new Sphere (0.5);
78    xSphere.setMaterial (new PhongMaterial (Color.RED));
79    xSphere.setTranslateX (5);
80
81    var ySphere = new Sphere (0.5);
82    ySphere.setMaterial (new PhongMaterial (Color.GREEN));
83    ySphere.setTranslateY (5);
84
85    var zSphere = new Sphere (0.5);
86    zSphere.setMaterial (new PhongMaterial (Color.BLUE));
87    zSphere.setTranslateZ (5);
88    
89    objects3d.getChildren().addAll (globe, xSphere, ySphere, zSphere);
90
91    var nubMaterial = new PhongMaterial (Color.color (0.2, 0.2, 0.2));
92    for (int i = 0; i < 200; i++) {
93      var nub = new Sphere (0.125);
94      nub.setMaterial (nubMaterial);
95      var phi = 2*Math.PI*Math.random();
96      var theta = Math.acos (2*Math.random() - 1);
97      var z = -5 * Math.sin (theta) * Math.cos (phi);
98      var x = 5 * Math.sin (theta) * Math.sin (phi);
99      var y = -5 * Math.cos (theta);
100      nub.setTranslateX (x);
101      nub.setTranslateY (y);
102      nub.setTranslateZ (z);
103      objects3d.getChildren().add (nub);
104    } // for
105
106    // Add labels
107
108    var xLabel = new Label ("X axis");
109    xLabel.setTextFill (Color.RED);
110
111    var yLabel = new Label ("Y axis");
112    yLabel.setTextFill (Color.GREEN);
113
114    var zLabel = new Label ("Z axis");
115    zLabel.setTextFill (Color.BLUE);
116
117    objects2d.getChildren().addAll (xLabel, yLabel, zLabel);
118
119    nodeToLabelMap = new HashMap<>();
120    nodeToLabelMap.put (xSphere, xLabel);
121    nodeToLabelMap.put (ySphere, yLabel);
122    nodeToLabelMap.put (zSphere, zLabel);
123
124    xRotate.angleProperty().addListener ((obs, oldVal, newVal) -> updateLabels());
125    yRotate.angleProperty().addListener ((obs, oldVal, newVal) -> updateLabels());
126    camera.translateZProperty().addListener ((obs, oldVal, newVal) -> updateLabels());
127    Platform.runLater (() -> updateLabels());
128
129    // Create main pane
130
131    var gridPane = new GridPane();
132    
133    var stackPane = new StackPane (viewScene);
134    viewScene.heightProperty().bind (stackPane.heightProperty());
135    viewScene.widthProperty().bind (stackPane.widthProperty());
136    viewScene.setManaged (false);
137
138    gridPane.add (stackPane, 0, 0);
139    gridPane.setVgrow (stackPane, Priority.ALWAYS);
140    gridPane.setHgrow (stackPane, Priority.ALWAYS);
141
142    // Add controls
143
144    var xSlider = new Slider (-90, 90, 0);
145    xRotate.angleProperty().bind (xSlider.valueProperty());
146    var ySlider = new Slider (-180, 180, 0);
147    yRotate.angleProperty().bind (ySlider.valueProperty());
148    var zSlider = new Slider (-60, -25, -25);
149    camera.translateZProperty().bind (zSlider.valueProperty());
150
151    ToolBar toolbar = new ToolBar (
152      new Label ("X rotation:"),
153      xSlider,
154      new Label ("Y rotation:"),
155      ySlider,
156      new Label ("Z position:"),
157      zSlider
158    );
159    gridPane.add (toolbar, 0, 1);
160
161    // Start the show
162
163    stage.setTitle ("Label Test");
164    stage.setScene (new Scene (gridPane, 800, 600));
165    stage.show();
166
167  } // start
168  
169  private void updateLabels () {
170    
171    nodeToLabelMap.forEach ((node, label) -> {
172      var coord = node.localToScene (Point3D.ZERO, true);
173      System.out.println ("label = " + label.getText() + ", coord = " + coord);
174      label.getTransforms().setAll (new Translate(coord.getX(), coord.getY()));
175    });
176
177  } // updateLabels
178  
179  public static void main (String[] args) {
180
181    launch (args);
182
183  } // main
184
185} // LabelTest class
186#!/bin/sh
187
188set -x
189
190export PATH_TO_FX=javafx-sdk-14/lib
191
192javac --module-path $PATH_TO_FX --add-modules javafx.controls LabelTest.java
193if [ $? -ne 0 ] ; then
194  exit 1
195fi
196
197java -cp . --module-path $PATH_TO_FX --add-modules javafx.controls LabelTest
198

My test program output contains very large label coordinates that don't represent the position of the coloured axis spheres, for example:

1import javafx.application.Application;
2import javafx.application.Platform;
3import javafx.scene.Group;
4import javafx.scene.Node;
5import javafx.scene.PerspectiveCamera;
6import javafx.scene.SubScene;
7import javafx.scene.Scene;
8import javafx.scene.SceneAntialiasing;
9import javafx.scene.AmbientLight;
10import javafx.scene.PointLight;
11import javafx.scene.control.Label;
12import javafx.scene.control.Slider;
13import javafx.scene.control.ToolBar;
14import javafx.scene.layout.GridPane;
15import javafx.scene.layout.StackPane;
16import javafx.scene.layout.Priority;
17import javafx.scene.shape.Sphere;
18import javafx.scene.paint.Color;
19import javafx.scene.paint.PhongMaterial;
20import javafx.scene.transform.Rotate;
21import javafx.scene.transform.Translate;
22import javafx.stage.Stage;
23import javafx.geometry.Point3D;
24
25import java.util.Map;
26import java.util.HashMap;
27
28public class LabelTest extends Application {
29
30  private Map<Node, Label> nodeToLabelMap;
31
32  @Override
33  public void start (Stage stage) {
34
35    // Create main scene graph
36
37    var objects3d = new Group();
38
39    Rotate xRotate = new Rotate (0, 0, 0, 0, Rotate.X_AXIS);
40    Rotate yRotate = new Rotate (0, 0, 0, 0, Rotate.Y_AXIS);
41    objects3d.getTransforms().addAll (
42      xRotate,
43      yRotate
44    );
45
46    var root3d = new Group();
47    root3d.getChildren().add (objects3d);
48
49    var camera = new PerspectiveCamera (true);
50    camera.setTranslateZ (-25);
51    
52    var scene3d = new SubScene (root3d, 500, 500, true, SceneAntialiasing.BALANCED);
53    scene3d.setFill (Color.rgb (20, 20, 80));
54    scene3d.setCamera (camera);
55
56    var sceneRoot = new Group (scene3d);
57    var objects2d = new Group();
58    sceneRoot.getChildren().add (objects2d);
59    var viewScene = new SubScene (sceneRoot, 500, 500);
60
61    scene3d.widthProperty().bind (viewScene.widthProperty());
62    scene3d.heightProperty().bind (viewScene.heightProperty());
63
64    // Add lights and objects
65
66    var ambient = new AmbientLight (Color.color (0.7, 0.7, 0.7));
67    var point = new PointLight (Color.color (0.3, 0.3, 0.3));
68    point.setTranslateX (-25);
69    point.setTranslateY (-25);
70    point.setTranslateZ (-50);
71    
72    root3d.getChildren().addAll (ambient, point);
73
74    var globe = new Sphere (5);
75    globe.setMaterial (new PhongMaterial (Color.color (0.3, 0.3, 0.3)));
76
77    var xSphere = new Sphere (0.5);
78    xSphere.setMaterial (new PhongMaterial (Color.RED));
79    xSphere.setTranslateX (5);
80
81    var ySphere = new Sphere (0.5);
82    ySphere.setMaterial (new PhongMaterial (Color.GREEN));
83    ySphere.setTranslateY (5);
84
85    var zSphere = new Sphere (0.5);
86    zSphere.setMaterial (new PhongMaterial (Color.BLUE));
87    zSphere.setTranslateZ (5);
88    
89    objects3d.getChildren().addAll (globe, xSphere, ySphere, zSphere);
90
91    var nubMaterial = new PhongMaterial (Color.color (0.2, 0.2, 0.2));
92    for (int i = 0; i < 200; i++) {
93      var nub = new Sphere (0.125);
94      nub.setMaterial (nubMaterial);
95      var phi = 2*Math.PI*Math.random();
96      var theta = Math.acos (2*Math.random() - 1);
97      var z = -5 * Math.sin (theta) * Math.cos (phi);
98      var x = 5 * Math.sin (theta) * Math.sin (phi);
99      var y = -5 * Math.cos (theta);
100      nub.setTranslateX (x);
101      nub.setTranslateY (y);
102      nub.setTranslateZ (z);
103      objects3d.getChildren().add (nub);
104    } // for
105
106    // Add labels
107
108    var xLabel = new Label ("X axis");
109    xLabel.setTextFill (Color.RED);
110
111    var yLabel = new Label ("Y axis");
112    yLabel.setTextFill (Color.GREEN);
113
114    var zLabel = new Label ("Z axis");
115    zLabel.setTextFill (Color.BLUE);
116
117    objects2d.getChildren().addAll (xLabel, yLabel, zLabel);
118
119    nodeToLabelMap = new HashMap<>();
120    nodeToLabelMap.put (xSphere, xLabel);
121    nodeToLabelMap.put (ySphere, yLabel);
122    nodeToLabelMap.put (zSphere, zLabel);
123
124    xRotate.angleProperty().addListener ((obs, oldVal, newVal) -> updateLabels());
125    yRotate.angleProperty().addListener ((obs, oldVal, newVal) -> updateLabels());
126    camera.translateZProperty().addListener ((obs, oldVal, newVal) -> updateLabels());
127    Platform.runLater (() -> updateLabels());
128
129    // Create main pane
130
131    var gridPane = new GridPane();
132    
133    var stackPane = new StackPane (viewScene);
134    viewScene.heightProperty().bind (stackPane.heightProperty());
135    viewScene.widthProperty().bind (stackPane.widthProperty());
136    viewScene.setManaged (false);
137
138    gridPane.add (stackPane, 0, 0);
139    gridPane.setVgrow (stackPane, Priority.ALWAYS);
140    gridPane.setHgrow (stackPane, Priority.ALWAYS);
141
142    // Add controls
143
144    var xSlider = new Slider (-90, 90, 0);
145    xRotate.angleProperty().bind (xSlider.valueProperty());
146    var ySlider = new Slider (-180, 180, 0);
147    yRotate.angleProperty().bind (ySlider.valueProperty());
148    var zSlider = new Slider (-60, -25, -25);
149    camera.translateZProperty().bind (zSlider.valueProperty());
150
151    ToolBar toolbar = new ToolBar (
152      new Label ("X rotation:"),
153      xSlider,
154      new Label ("Y rotation:"),
155      ySlider,
156      new Label ("Z position:"),
157      zSlider
158    );
159    gridPane.add (toolbar, 0, 1);
160
161    // Start the show
162
163    stage.setTitle ("Label Test");
164    stage.setScene (new Scene (gridPane, 800, 600));
165    stage.show();
166
167  } // start
168  
169  private void updateLabels () {
170    
171    nodeToLabelMap.forEach ((node, label) -> {
172      var coord = node.localToScene (Point3D.ZERO, true);
173      System.out.println ("label = " + label.getText() + ", coord = " + coord);
174      label.getTransforms().setAll (new Translate(coord.getX(), coord.getY()));
175    });
176
177  } // updateLabels
178  
179  public static void main (String[] args) {
180
181    launch (args);
182
183  } // main
184
185} // LabelTest class
186#!/bin/sh
187
188set -x
189
190export PATH_TO_FX=javafx-sdk-14/lib
191
192javac --module-path $PATH_TO_FX --add-modules javafx.controls LabelTest.java
193if [ $? -ne 0 ] ; then
194  exit 1
195fi
196
197java -cp . --module-path $PATH_TO_FX --add-modules javafx.controls LabelTest
198label = Y axis, coord = Point3D [x = 17448.00808897467, y = 21535.846392310217, z = 0.0]
199label = X axis, coord = Point3D [x = 26530.33870777918, y = 12453.515773505665, z = 0.0]
200label = Z axis, coord = Point3D [x = 17448.008088974653, y = 12453.515773505665, z = 0.0]
201

My display looks like this:

Label Test Screenshot

where as it should look more like the example from FXyz with labels next to the axis spheres:

FXyz Floating Labels Screenshot

ANSWER

Answered 2022-Feb-02 at 12:28

If you follow what has been done in the link you have posted you'll make it work.

For starters, there is one subScene, not two.

So I've removed these lines:

1import javafx.application.Application;
2import javafx.application.Platform;
3import javafx.scene.Group;
4import javafx.scene.Node;
5import javafx.scene.PerspectiveCamera;
6import javafx.scene.SubScene;
7import javafx.scene.Scene;
8import javafx.scene.SceneAntialiasing;
9import javafx.scene.AmbientLight;
10import javafx.scene.PointLight;
11import javafx.scene.control.Label;
12import javafx.scene.control.Slider;
13import javafx.scene.control.ToolBar;
14import javafx.scene.layout.GridPane;
15import javafx.scene.layout.StackPane;
16import javafx.scene.layout.Priority;
17import javafx.scene.shape.Sphere;
18import javafx.scene.paint.Color;
19import javafx.scene.paint.PhongMaterial;
20import javafx.scene.transform.Rotate;
21import javafx.scene.transform.Translate;
22import javafx.stage.Stage;
23import javafx.geometry.Point3D;
24
25import java.util.Map;
26import java.util.HashMap;
27
28public class LabelTest extends Application {
29
30  private Map<Node, Label> nodeToLabelMap;
31
32  @Override
33  public void start (Stage stage) {
34
35    // Create main scene graph
36
37    var objects3d = new Group();
38
39    Rotate xRotate = new Rotate (0, 0, 0, 0, Rotate.X_AXIS);
40    Rotate yRotate = new Rotate (0, 0, 0, 0, Rotate.Y_AXIS);
41    objects3d.getTransforms().addAll (
42      xRotate,
43      yRotate
44    );
45
46    var root3d = new Group();
47    root3d.getChildren().add (objects3d);
48
49    var camera = new PerspectiveCamera (true);
50    camera.setTranslateZ (-25);
51    
52    var scene3d = new SubScene (root3d, 500, 500, true, SceneAntialiasing.BALANCED);
53    scene3d.setFill (Color.rgb (20, 20, 80));
54    scene3d.setCamera (camera);
55
56    var sceneRoot = new Group (scene3d);
57    var objects2d = new Group();
58    sceneRoot.getChildren().add (objects2d);
59    var viewScene = new SubScene (sceneRoot, 500, 500);
60
61    scene3d.widthProperty().bind (viewScene.widthProperty());
62    scene3d.heightProperty().bind (viewScene.heightProperty());
63
64    // Add lights and objects
65
66    var ambient = new AmbientLight (Color.color (0.7, 0.7, 0.7));
67    var point = new PointLight (Color.color (0.3, 0.3, 0.3));
68    point.setTranslateX (-25);
69    point.setTranslateY (-25);
70    point.setTranslateZ (-50);
71    
72    root3d.getChildren().addAll (ambient, point);
73
74    var globe = new Sphere (5);
75    globe.setMaterial (new PhongMaterial (Color.color (0.3, 0.3, 0.3)));
76
77    var xSphere = new Sphere (0.5);
78    xSphere.setMaterial (new PhongMaterial (Color.RED));
79    xSphere.setTranslateX (5);
80
81    var ySphere = new Sphere (0.5);
82    ySphere.setMaterial (new PhongMaterial (Color.GREEN));
83    ySphere.setTranslateY (5);
84
85    var zSphere = new Sphere (0.5);
86    zSphere.setMaterial (new PhongMaterial (Color.BLUE));
87    zSphere.setTranslateZ (5);
88    
89    objects3d.getChildren().addAll (globe, xSphere, ySphere, zSphere);
90
91    var nubMaterial = new PhongMaterial (Color.color (0.2, 0.2, 0.2));
92    for (int i = 0; i < 200; i++) {
93      var nub = new Sphere (0.125);
94      nub.setMaterial (nubMaterial);
95      var phi = 2*Math.PI*Math.random();
96      var theta = Math.acos (2*Math.random() - 1);
97      var z = -5 * Math.sin (theta) * Math.cos (phi);
98      var x = 5 * Math.sin (theta) * Math.sin (phi);
99      var y = -5 * Math.cos (theta);
100      nub.setTranslateX (x);
101      nub.setTranslateY (y);
102      nub.setTranslateZ (z);
103      objects3d.getChildren().add (nub);
104    } // for
105
106    // Add labels
107
108    var xLabel = new Label ("X axis");
109    xLabel.setTextFill (Color.RED);
110
111    var yLabel = new Label ("Y axis");
112    yLabel.setTextFill (Color.GREEN);
113
114    var zLabel = new Label ("Z axis");
115    zLabel.setTextFill (Color.BLUE);
116
117    objects2d.getChildren().addAll (xLabel, yLabel, zLabel);
118
119    nodeToLabelMap = new HashMap<>();
120    nodeToLabelMap.put (xSphere, xLabel);
121    nodeToLabelMap.put (ySphere, yLabel);
122    nodeToLabelMap.put (zSphere, zLabel);
123
124    xRotate.angleProperty().addListener ((obs, oldVal, newVal) -> updateLabels());
125    yRotate.angleProperty().addListener ((obs, oldVal, newVal) -> updateLabels());
126    camera.translateZProperty().addListener ((obs, oldVal, newVal) -> updateLabels());
127    Platform.runLater (() -> updateLabels());
128
129    // Create main pane
130
131    var gridPane = new GridPane();
132    
133    var stackPane = new StackPane (viewScene);
134    viewScene.heightProperty().bind (stackPane.heightProperty());
135    viewScene.widthProperty().bind (stackPane.widthProperty());
136    viewScene.setManaged (false);
137
138    gridPane.add (stackPane, 0, 0);
139    gridPane.setVgrow (stackPane, Priority.ALWAYS);
140    gridPane.setHgrow (stackPane, Priority.ALWAYS);
141
142    // Add controls
143
144    var xSlider = new Slider (-90, 90, 0);
145    xRotate.angleProperty().bind (xSlider.valueProperty());
146    var ySlider = new Slider (-180, 180, 0);
147    yRotate.angleProperty().bind (ySlider.valueProperty());
148    var zSlider = new Slider (-60, -25, -25);
149    camera.translateZProperty().bind (zSlider.valueProperty());
150
151    ToolBar toolbar = new ToolBar (
152      new Label ("X rotation:"),
153      xSlider,
154      new Label ("Y rotation:"),
155      ySlider,
156      new Label ("Z position:"),
157      zSlider
158    );
159    gridPane.add (toolbar, 0, 1);
160
161    // Start the show
162
163    stage.setTitle ("Label Test");
164    stage.setScene (new Scene (gridPane, 800, 600));
165    stage.show();
166
167  } // start
168  
169  private void updateLabels () {
170    
171    nodeToLabelMap.forEach ((node, label) -> {
172      var coord = node.localToScene (Point3D.ZERO, true);
173      System.out.println ("label = " + label.getText() + ", coord = " + coord);
174      label.getTransforms().setAll (new Translate(coord.getX(), coord.getY()));
175    });
176
177  } // updateLabels
178  
179  public static void main (String[] args) {
180
181    launch (args);
182
183  } // main
184
185} // LabelTest class
186#!/bin/sh
187
188set -x
189
190export PATH_TO_FX=javafx-sdk-14/lib
191
192javac --module-path $PATH_TO_FX --add-modules javafx.controls LabelTest.java
193if [ $? -ne 0 ] ; then
194  exit 1
195fi
196
197java -cp . --module-path $PATH_TO_FX --add-modules javafx.controls LabelTest
198label = Y axis, coord = Point3D [x = 17448.00808897467, y = 21535.846392310217, z = 0.0]
199label = X axis, coord = Point3D [x = 26530.33870777918, y = 12453.515773505665, z = 0.0]
200label = Z axis, coord = Point3D [x = 17448.008088974653, y = 12453.515773505665, z = 0.0]
201-        var viewScene = new SubScene (new Group (scene3d), 500, 500);
202
203-        scene3d.widthProperty().bind (viewScene.widthProperty());
204-        scene3d.heightProperty().bind (viewScene.heightProperty());
205

and replaced these:

1import javafx.application.Application;
2import javafx.application.Platform;
3import javafx.scene.Group;
4import javafx.scene.Node;
5import javafx.scene.PerspectiveCamera;
6import javafx.scene.SubScene;
7import javafx.scene.Scene;
8import javafx.scene.SceneAntialiasing;
9import javafx.scene.AmbientLight;
10import javafx.scene.PointLight;
11import javafx.scene.control.Label;
12import javafx.scene.control.Slider;
13import javafx.scene.control.ToolBar;
14import javafx.scene.layout.GridPane;
15import javafx.scene.layout.StackPane;
16import javafx.scene.layout.Priority;
17import javafx.scene.shape.Sphere;
18import javafx.scene.paint.Color;
19import javafx.scene.paint.PhongMaterial;
20import javafx.scene.transform.Rotate;
21import javafx.scene.transform.Translate;
22import javafx.stage.Stage;
23import javafx.geometry.Point3D;
24
25import java.util.Map;
26import java.util.HashMap;
27
28public class LabelTest extends Application {
29
30  private Map<Node, Label> nodeToLabelMap;
31
32  @Override
33  public void start (Stage stage) {
34
35    // Create main scene graph
36
37    var objects3d = new Group();
38
39    Rotate xRotate = new Rotate (0, 0, 0, 0, Rotate.X_AXIS);
40    Rotate yRotate = new Rotate (0, 0, 0, 0, Rotate.Y_AXIS);
41    objects3d.getTransforms().addAll (
42      xRotate,
43      yRotate
44    );
45
46    var root3d = new Group();
47    root3d.getChildren().add (objects3d);
48
49    var camera = new PerspectiveCamera (true);
50    camera.setTranslateZ (-25);
51    
52    var scene3d = new SubScene (root3d, 500, 500, true, SceneAntialiasing.BALANCED);
53    scene3d.setFill (Color.rgb (20, 20, 80));
54    scene3d.setCamera (camera);
55
56    var sceneRoot = new Group (scene3d);
57    var objects2d = new Group();
58    sceneRoot.getChildren().add (objects2d);
59    var viewScene = new SubScene (sceneRoot, 500, 500);
60
61    scene3d.widthProperty().bind (viewScene.widthProperty());
62    scene3d.heightProperty().bind (viewScene.heightProperty());
63
64    // Add lights and objects
65
66    var ambient = new AmbientLight (Color.color (0.7, 0.7, 0.7));
67    var point = new PointLight (Color.color (0.3, 0.3, 0.3));
68    point.setTranslateX (-25);
69    point.setTranslateY (-25);
70    point.setTranslateZ (-50);
71    
72    root3d.getChildren().addAll (ambient, point);
73
74    var globe = new Sphere (5);
75    globe.setMaterial (new PhongMaterial (Color.color (0.3, 0.3, 0.3)));
76
77    var xSphere = new Sphere (0.5);
78    xSphere.setMaterial (new PhongMaterial (Color.RED));
79    xSphere.setTranslateX (5);
80
81    var ySphere = new Sphere (0.5);
82    ySphere.setMaterial (new PhongMaterial (Color.GREEN));
83    ySphere.setTranslateY (5);
84
85    var zSphere = new Sphere (0.5);
86    zSphere.setMaterial (new PhongMaterial (Color.BLUE));
87    zSphere.setTranslateZ (5);
88    
89    objects3d.getChildren().addAll (globe, xSphere, ySphere, zSphere);
90
91    var nubMaterial = new PhongMaterial (Color.color (0.2, 0.2, 0.2));
92    for (int i = 0; i < 200; i++) {
93      var nub = new Sphere (0.125);
94      nub.setMaterial (nubMaterial);
95      var phi = 2*Math.PI*Math.random();
96      var theta = Math.acos (2*Math.random() - 1);
97      var z = -5 * Math.sin (theta) * Math.cos (phi);
98      var x = 5 * Math.sin (theta) * Math.sin (phi);
99      var y = -5 * Math.cos (theta);
100      nub.setTranslateX (x);
101      nub.setTranslateY (y);
102      nub.setTranslateZ (z);
103      objects3d.getChildren().add (nub);
104    } // for
105
106    // Add labels
107
108    var xLabel = new Label ("X axis");
109    xLabel.setTextFill (Color.RED);
110
111    var yLabel = new Label ("Y axis");
112    yLabel.setTextFill (Color.GREEN);
113
114    var zLabel = new Label ("Z axis");
115    zLabel.setTextFill (Color.BLUE);
116
117    objects2d.getChildren().addAll (xLabel, yLabel, zLabel);
118
119    nodeToLabelMap = new HashMap<>();
120    nodeToLabelMap.put (xSphere, xLabel);
121    nodeToLabelMap.put (ySphere, yLabel);
122    nodeToLabelMap.put (zSphere, zLabel);
123
124    xRotate.angleProperty().addListener ((obs, oldVal, newVal) -> updateLabels());
125    yRotate.angleProperty().addListener ((obs, oldVal, newVal) -> updateLabels());
126    camera.translateZProperty().addListener ((obs, oldVal, newVal) -> updateLabels());
127    Platform.runLater (() -> updateLabels());
128
129    // Create main pane
130
131    var gridPane = new GridPane();
132    
133    var stackPane = new StackPane (viewScene);
134    viewScene.heightProperty().bind (stackPane.heightProperty());
135    viewScene.widthProperty().bind (stackPane.widthProperty());
136    viewScene.setManaged (false);
137
138    gridPane.add (stackPane, 0, 0);
139    gridPane.setVgrow (stackPane, Priority.ALWAYS);
140    gridPane.setHgrow (stackPane, Priority.ALWAYS);
141
142    // Add controls
143
144    var xSlider = new Slider (-90, 90, 0);
145    xRotate.angleProperty().bind (xSlider.valueProperty());
146    var ySlider = new Slider (-180, 180, 0);
147    yRotate.angleProperty().bind (ySlider.valueProperty());
148    var zSlider = new Slider (-60, -25, -25);
149    camera.translateZProperty().bind (zSlider.valueProperty());
150
151    ToolBar toolbar = new ToolBar (
152      new Label ("X rotation:"),
153      xSlider,
154      new Label ("Y rotation:"),
155      ySlider,
156      new Label ("Z position:"),
157      zSlider
158    );
159    gridPane.add (toolbar, 0, 1);
160
161    // Start the show
162
163    stage.setTitle ("Label Test");
164    stage.setScene (new Scene (gridPane, 800, 600));
165    stage.show();
166
167  } // start
168  
169  private void updateLabels () {
170    
171    nodeToLabelMap.forEach ((node, label) -> {
172      var coord = node.localToScene (Point3D.ZERO, true);
173      System.out.println ("label = " + label.getText() + ", coord = " + coord);
174      label.getTransforms().setAll (new Translate(coord.getX(), coord.getY()));
175    });
176
177  } // updateLabels
178  
179  public static void main (String[] args) {
180
181    launch (args);
182
183  } // main
184
185} // LabelTest class
186#!/bin/sh
187
188set -x
189
190export PATH_TO_FX=javafx-sdk-14/lib
191
192javac --module-path $PATH_TO_FX --add-modules javafx.controls LabelTest.java
193if [ $? -ne 0 ] ; then
194  exit 1
195fi
196
197java -cp . --module-path $PATH_TO_FX --add-modules javafx.controls LabelTest
198label = Y axis, coord = Point3D [x = 17448.00808897467, y = 21535.846392310217, z = 0.0]
199label = X axis, coord = Point3D [x = 26530.33870777918, y = 12453.515773505665, z = 0.0]
200label = Z axis, coord = Point3D [x = 17448.008088974653, y = 12453.515773505665, z = 0.0]
201-        var viewScene = new SubScene (new Group (scene3d), 500, 500);
202
203-        scene3d.widthProperty().bind (viewScene.widthProperty());
204-        scene3d.heightProperty().bind (viewScene.heightProperty());
205-    var stackPane = new StackPane (viewScene);
206-    viewScene.heightProperty().bind (stackPane.heightProperty());
207-    viewScene.widthProperty().bind (stackPane.widthProperty());
208-    viewScene.setManaged (false);
209
210+    var stackPane = new StackPane (sceneRoot);
211+    scene3d.heightProperty().bind (stackPane.heightProperty());
212+    scene3d.widthProperty().bind (stackPane.widthProperty());
213

That works fine now for me:

1import javafx.application.Application;
2import javafx.application.Platform;
3import javafx.scene.Group;
4import javafx.scene.Node;
5import javafx.scene.PerspectiveCamera;
6import javafx.scene.SubScene;
7import javafx.scene.Scene;
8import javafx.scene.SceneAntialiasing;
9import javafx.scene.AmbientLight;
10import javafx.scene.PointLight;
11import javafx.scene.control.Label;
12import javafx.scene.control.Slider;
13import javafx.scene.control.ToolBar;
14import javafx.scene.layout.GridPane;
15import javafx.scene.layout.StackPane;
16import javafx.scene.layout.Priority;
17import javafx.scene.shape.Sphere;
18import javafx.scene.paint.Color;
19import javafx.scene.paint.PhongMaterial;
20import javafx.scene.transform.Rotate;
21import javafx.scene.transform.Translate;
22import javafx.stage.Stage;
23import javafx.geometry.Point3D;
24
25import java.util.Map;
26import java.util.HashMap;
27
28public class LabelTest extends Application {
29
30  private Map<Node, Label> nodeToLabelMap;
31
32  @Override
33  public void start (Stage stage) {
34
35    // Create main scene graph
36
37    var objects3d = new Group();
38
39    Rotate xRotate = new Rotate (0, 0, 0, 0, Rotate.X_AXIS);
40    Rotate yRotate = new Rotate (0, 0, 0, 0, Rotate.Y_AXIS);
41    objects3d.getTransforms().addAll (
42      xRotate,
43      yRotate
44    );
45
46    var root3d = new Group();
47    root3d.getChildren().add (objects3d);
48
49    var camera = new PerspectiveCamera (true);
50    camera.setTranslateZ (-25);
51    
52    var scene3d = new SubScene (root3d, 500, 500, true, SceneAntialiasing.BALANCED);
53    scene3d.setFill (Color.rgb (20, 20, 80));
54    scene3d.setCamera (camera);
55
56    var sceneRoot = new Group (scene3d);
57    var objects2d = new Group();
58    sceneRoot.getChildren().add (objects2d);
59    var viewScene = new SubScene (sceneRoot, 500, 500);
60
61    scene3d.widthProperty().bind (viewScene.widthProperty());
62    scene3d.heightProperty().bind (viewScene.heightProperty());
63
64    // Add lights and objects
65
66    var ambient = new AmbientLight (Color.color (0.7, 0.7, 0.7));
67    var point = new PointLight (Color.color (0.3, 0.3, 0.3));
68    point.setTranslateX (-25);
69    point.setTranslateY (-25);
70    point.setTranslateZ (-50);
71    
72    root3d.getChildren().addAll (ambient, point);
73
74    var globe = new Sphere (5);
75    globe.setMaterial (new PhongMaterial (Color.color (0.3, 0.3, 0.3)));
76
77    var xSphere = new Sphere (0.5);
78    xSphere.setMaterial (new PhongMaterial (Color.RED));
79    xSphere.setTranslateX (5);
80
81    var ySphere = new Sphere (0.5);
82    ySphere.setMaterial (new PhongMaterial (Color.GREEN));
83    ySphere.setTranslateY (5);
84
85    var zSphere = new Sphere (0.5);
86    zSphere.setMaterial (new PhongMaterial (Color.BLUE));
87    zSphere.setTranslateZ (5);
88    
89    objects3d.getChildren().addAll (globe, xSphere, ySphere, zSphere);
90
91    var nubMaterial = new PhongMaterial (Color.color (0.2, 0.2, 0.2));
92    for (int i = 0; i < 200; i++) {
93      var nub = new Sphere (0.125);
94      nub.setMaterial (nubMaterial);
95      var phi = 2*Math.PI*Math.random();
96      var theta = Math.acos (2*Math.random() - 1);
97      var z = -5 * Math.sin (theta) * Math.cos (phi);
98      var x = 5 * Math.sin (theta) * Math.sin (phi);
99      var y = -5 * Math.cos (theta);
100      nub.setTranslateX (x);
101      nub.setTranslateY (y);
102      nub.setTranslateZ (z);
103      objects3d.getChildren().add (nub);
104    } // for
105
106    // Add labels
107
108    var xLabel = new Label ("X axis");
109    xLabel.setTextFill (Color.RED);
110
111    var yLabel = new Label ("Y axis");
112    yLabel.setTextFill (Color.GREEN);
113
114    var zLabel = new Label ("Z axis");
115    zLabel.setTextFill (Color.BLUE);
116
117    objects2d.getChildren().addAll (xLabel, yLabel, zLabel);
118
119    nodeToLabelMap = new HashMap<>();
120    nodeToLabelMap.put (xSphere, xLabel);
121    nodeToLabelMap.put (ySphere, yLabel);
122    nodeToLabelMap.put (zSphere, zLabel);
123
124    xRotate.angleProperty().addListener ((obs, oldVal, newVal) -> updateLabels());
125    yRotate.angleProperty().addListener ((obs, oldVal, newVal) -> updateLabels());
126    camera.translateZProperty().addListener ((obs, oldVal, newVal) -> updateLabels());
127    Platform.runLater (() -> updateLabels());
128
129    // Create main pane
130
131    var gridPane = new GridPane();
132    
133    var stackPane = new StackPane (viewScene);
134    viewScene.heightProperty().bind (stackPane.heightProperty());
135    viewScene.widthProperty().bind (stackPane.widthProperty());
136    viewScene.setManaged (false);
137
138    gridPane.add (stackPane, 0, 0);
139    gridPane.setVgrow (stackPane, Priority.ALWAYS);
140    gridPane.setHgrow (stackPane, Priority.ALWAYS);
141
142    // Add controls
143
144    var xSlider = new Slider (-90, 90, 0);
145    xRotate.angleProperty().bind (xSlider.valueProperty());
146    var ySlider = new Slider (-180, 180, 0);
147    yRotate.angleProperty().bind (ySlider.valueProperty());
148    var zSlider = new Slider (-60, -25, -25);
149    camera.translateZProperty().bind (zSlider.valueProperty());
150
151    ToolBar toolbar = new ToolBar (
152      new Label ("X rotation:"),
153      xSlider,
154      new Label ("Y rotation:"),
155      ySlider,
156      new Label ("Z position:"),
157      zSlider
158    );
159    gridPane.add (toolbar, 0, 1);
160
161    // Start the show
162
163    stage.setTitle ("Label Test");
164    stage.setScene (new Scene (gridPane, 800, 600));
165    stage.show();
166
167  } // start
168  
169  private void updateLabels () {
170    
171    nodeToLabelMap.forEach ((node, label) -> {
172      var coord = node.localToScene (Point3D.ZERO, true);
173      System.out.println ("label = " + label.getText() + ", coord = " + coord);
174      label.getTransforms().setAll (new Translate(coord.getX(), coord.getY()));
175    });
176
177  } // updateLabels
178  
179  public static void main (String[] args) {
180
181    launch (args);
182
183  } // main
184
185} // LabelTest class
186#!/bin/sh
187
188set -x
189
190export PATH_TO_FX=javafx-sdk-14/lib
191
192javac --module-path $PATH_TO_FX --add-modules javafx.controls LabelTest.java
193if [ $? -ne 0 ] ; then
194  exit 1
195fi
196
197java -cp . --module-path $PATH_TO_FX --add-modules javafx.controls LabelTest
198label = Y axis, coord = Point3D [x = 17448.00808897467, y = 21535.846392310217, z = 0.0]
199label = X axis, coord = Point3D [x = 26530.33870777918, y = 12453.515773505665, z = 0.0]
200label = Z axis, coord = Point3D [x = 17448.008088974653, y = 12453.515773505665, z = 0.0]
201-        var viewScene = new SubScene (new Group (scene3d), 500, 500);
202
203-        scene3d.widthProperty().bind (viewScene.widthProperty());
204-        scene3d.heightProperty().bind (viewScene.heightProperty());
205-    var stackPane = new StackPane (viewScene);
206-    viewScene.heightProperty().bind (stackPane.heightProperty());
207-    viewScene.widthProperty().bind (stackPane.widthProperty());
208-    viewScene.setManaged (false);
209
210+    var stackPane = new StackPane (sceneRoot);
211+    scene3d.heightProperty().bind (stackPane.heightProperty());
212+    scene3d.widthProperty().bind (stackPane.widthProperty());
213label = Z axis, coord = Point3D [x = 613.2085772621016, y = 286.33580935946725, z = 0.0]
214label = X axis, coord = Point3D [x = 401.67010722785966, y = 219.90328164976754, z = 0.0]
215label = Y axis, coord = Point3D [x = 400.0, y = 503.57735384935296, z = 0.0]
216

rotations

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

QUESTION

Basic angular app fails to run, Error module build failed : cannot find module ../@angular-devkit/src/babel/X

Asked 2022-Feb-01 at 12:16

I am new to angular and was following the documentation to build a basic app.

Node - v14.7.3
npm - 7.22.0
Angular CLI: 12.2.4
OS: win32 x64
@angular-devkit/architect 0.1202.4
@angular-devkit/build-angular 12.2.4
@angular-devkit/core 12.2.4
@angular-devkit/schematics 12.2.4
@schematics/angular 12.2.4
rxjs 6.6.7
typescript 4.3.5

So far all I have done is

npm install @angular/cli

followed by ng new firstApp

and ng serve

Following is the error that I am receiving,

1√ Browser application bundle generation complete.
2
3Initial Chunk Files | Names         |     Size
4runtime.js          | runtime       |  4.89 kB
5main.js             | main          |  3.56 kB
6polyfills.js        | polyfills     |  3.55 kB
7styles.js           | styles        |  3.54 kB
8
9                    | Initial Total | 15.54 kB
10
11Build at: 2021-09-06T06:20:42.162Z - Hash: f81b11c218148f716cf3 - Time: 10951ms
12
13../../../../#Development/Files/angularProjects/firstApp/src/main.ts - Error: Module build failed: Error: Cannot find module 'F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-angular\src\babel\webpack-loader.js'
14Require stack:
15- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\ProgressPlugin.js
16- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\index.js
17- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\webpack\index.js
18- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\index.js
19- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-angular\src\dev-server\index.js
20- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js
21- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\index.js
22- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\architect-command.js
23- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\commands\serve-impl.js
24- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\export-ref.js
25- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\index.js
26- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\utilities\json-schema.js
27- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\command-runner.js
28- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\lib\cli\index.js
29- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\lib\init.js
30- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng
31    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
32    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
33    at Module.require (internal/modules/cjs/loader.js:974:19)
34    at require (internal/modules/cjs/helpers.js:92:18)
35    at F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\ProgressPlugin.js:412:9
36    at Hook.eval [as call] (eval at create (F:\#Development\Files\angularProjects\firstApp\node_modules\tapable\lib\HookCodeFactory.js:19:10), <anonymous>:7:1)
37    at NormalModule.doBuild (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:768:24)
38    at NormalModule.build (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:920:15)
39    at F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\Compilation.js:1322:12
40    at NormalModule.needBuild (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:1192:32)
41
42../../../../#Development/Files/angularProjects/firstApp/src/polyfills.ts - Error: Module build failed: Error: Cannot find module 'F:\#Development\Files\angularProjects\firstApp\node_modules\@ngtools\webpack\src\ivy\index.js'
43Require stack:
44- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\ProgressPlugin.js
45- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\index.js
46- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\webpack\index.js
47- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\index.js
48- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-angular\src\dev-server\index.js
49- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js
50- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\index.js
51- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\architect-command.js
52- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\commands\serve-impl.js
53- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\export-ref.js
54- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\index.js
55- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\utilities\json-schema.js
56- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\command-runner.js
57- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\lib\cli\index.js
58- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\lib\init.js
59- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng
60    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
61    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
62    at Module.require (internal/modules/cjs/loader.js:974:19)
63    at require (internal/modules/cjs/helpers.js:92:18)
64    at F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\ProgressPlugin.js:412:9
65    at Hook.eval [as call] (eval at create (F:\#Development\Files\angularProjects\firstApp\node_modules\tapable\lib\HookCodeFactory.js:19:10), <anonymous>:7:1)
66    at NormalModule.doBuild (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:768:24)
67    at NormalModule.build (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:920:15)
68    at F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\Compilation.js:1322:12
69    at NormalModule.needBuild (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:1192:32)
70
71../../../../#Development/Files/angularProjects/firstApp/src/styles.css - Error: Module build failed: Error: Cannot find module 'F:\#Development\Files\angularProjects\firstApp\node_modules\mini-css-extract-plugin\dist\loader.js'
72Require stack:
73- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\ProgressPlugin.js
74- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\index.js
75- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\webpack\index.js
76- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\index.js
77- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-angular\src\dev-server\index.js
78- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js
79- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\index.js
80- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\architect-command.js
81- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\commands\serve-impl.js
82- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\export-ref.js
83- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\index.js
84- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\utilities\json-schema.js
85- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\command-runner.js
86- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\lib\cli\index.js
87- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\lib\init.js
88- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng
89    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
90    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
91    at Module.require (internal/modules/cjs/loader.js:974:19)
92    at require (internal/modules/cjs/helpers.js:92:18)
93    at F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\ProgressPlugin.js:412:9
94    at Hook.eval [as call] (eval at create (F:\#Development\Files\angularProjects\firstApp\node_modules\tapable\lib\HookCodeFactory.js:19:10), <anonymous>:7:1)
95    at Hook.CALL_DELEGATE [as _call] (F:\#Development\Files\angularProjects\firstApp\node_modules\tapable\lib\Hook.js:14:14)
96    at NormalModule.doBuild (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:768:24)
97    at NormalModule.build (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:920:15)
98    at F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\Compilation.js:1322:12
99
100../../../../#Development/Files/angularProjects/firstApp/src/app/app.component.css - Error: Module build failed (from ../../../../#Development/Files/angularProjects/firstApp/node_modules/postcss-loader/dist/cjs.js):
101Error: Cannot find module 'F:\#Development\Files\angularProjects\firstApp\node_modules\postcss-loader\dist\cjs.js'
102Require stack:
103- F:\#Development\Files\angularProjects\firstApp\node_modules\loader-runner\lib\loadLoader.js
104- F:\#Development\Files\angularProjects\firstApp\node_modules\loader-runner\lib\LoaderRunner.js
105- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModuleFactory.js
106- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\Compiler.js
107- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\ProgressPlugin.js
108- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\index.js
109- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\webpack\index.js
110- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\index.js
111- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-angular\src\dev-server\index.js
112- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js
113- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\index.js
114- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\architect-command.js
115- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\commands\serve-impl.js
116- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\export-ref.js
117- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\index.js
118- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\utilities\json-schema.js
119- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\command-runner.js
120- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\lib\cli\index.js
121- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\lib\init.js
122- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng
123    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
124    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
125    at Module.require (internal/modules/cjs/loader.js:974:19)
126    at require (internal/modules/cjs/helpers.js:92:18)
127    at loadLoader (F:\#Development\Files\angularProjects\firstApp\node_modules\loader-runner\lib\loadLoader.js:19:17)
128    at iteratePitchingLoaders (F:\#Development\Files\angularProjects\firstApp\node_modules\loader-runner\lib\LoaderRunner.js:182:2)
129    at runLoaders (F:\#Development\Files\angularProjects\firstApp\node_modules\loader-runner\lib\LoaderRunner.js:397:2)
130    at NormalModule.doBuild (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:773:3)
131    at NormalModule.build (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:920:15)
132    at F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\Compilation.js:1322:12
133
134Error: Module not found: Error: Can't resolve 'F:\#Development\Files\angularProjects\firstApp\node_modules\webpack-dev-server\client\index.js?http://0.0.0.0:0&sockPath=/sockjs-node' in 'F:\#Development\Files\angularProjects\firstApp'
135
136Error: Module not found: Error: Can't resolve 'F:\#Development\Files\angularProjects\firstApp\node_modules\webpack-dev-server\client\index.js?http://0.0.0.0:0&sockPath=/sockjs-node' in 'F:\#Development\Files\angularProjects\firstApp'
137
138Error: Module not found: Error: Can't resolve 'F:\#Development\Files\angularProjects\firstApp\node_modules\webpack-dev-server\client\index.js?http://0.0.0.0:0&sockPath=/sockjs-node' in 'F:\#Development\Files\angularProjects\firstApp'
139
140Error: node_modules/@angular/platform-browser/platform-browser.d.ts:45:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.
141
142This likely means that the library (@angular/platform-browser) which declares BrowserModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.
143
14445 export declare class BrowserModule {
145

I have tried the following approaches to fix this issue,

  1. Tried deleting node_modules, deleted packacge-lock, cleared npm cache, and then finally npm installed, This approach has worked on many previous stack-overflow problems however for me the problem still persists.
  2. I have tried installing different versions of angular-cli, tried to match their compatibility with different node versions and different npm versions, that however I wasn't able to do properly because of multiple broken dependencies.

Please suggest some solutions, thank you

ANSWER

Answered 2021-Sep-10 at 07:17

Try to install those modules separately npm install:

1√ Browser application bundle generation complete.
2
3Initial Chunk Files | Names         |     Size
4runtime.js          | runtime       |  4.89 kB
5main.js             | main          |  3.56 kB
6polyfills.js        | polyfills     |  3.55 kB
7styles.js           | styles        |  3.54 kB
8
9                    | Initial Total | 15.54 kB
10
11Build at: 2021-09-06T06:20:42.162Z - Hash: f81b11c218148f716cf3 - Time: 10951ms
12
13../../../../#Development/Files/angularProjects/firstApp/src/main.ts - Error: Module build failed: Error: Cannot find module 'F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-angular\src\babel\webpack-loader.js'
14Require stack:
15- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\ProgressPlugin.js
16- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\index.js
17- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\webpack\index.js
18- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\index.js
19- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-angular\src\dev-server\index.js
20- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js
21- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\index.js
22- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\architect-command.js
23- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\commands\serve-impl.js
24- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\export-ref.js
25- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\index.js
26- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\utilities\json-schema.js
27- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\command-runner.js
28- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\lib\cli\index.js
29- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\lib\init.js
30- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng
31    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
32    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
33    at Module.require (internal/modules/cjs/loader.js:974:19)
34    at require (internal/modules/cjs/helpers.js:92:18)
35    at F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\ProgressPlugin.js:412:9
36    at Hook.eval [as call] (eval at create (F:\#Development\Files\angularProjects\firstApp\node_modules\tapable\lib\HookCodeFactory.js:19:10), <anonymous>:7:1)
37    at NormalModule.doBuild (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:768:24)
38    at NormalModule.build (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:920:15)
39    at F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\Compilation.js:1322:12
40    at NormalModule.needBuild (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:1192:32)
41
42../../../../#Development/Files/angularProjects/firstApp/src/polyfills.ts - Error: Module build failed: Error: Cannot find module 'F:\#Development\Files\angularProjects\firstApp\node_modules\@ngtools\webpack\src\ivy\index.js'
43Require stack:
44- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\ProgressPlugin.js
45- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\index.js
46- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\webpack\index.js
47- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\index.js
48- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-angular\src\dev-server\index.js
49- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js
50- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\index.js
51- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\architect-command.js
52- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\commands\serve-impl.js
53- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\export-ref.js
54- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\index.js
55- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\utilities\json-schema.js
56- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\command-runner.js
57- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\lib\cli\index.js
58- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\lib\init.js
59- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng
60    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
61    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
62    at Module.require (internal/modules/cjs/loader.js:974:19)
63    at require (internal/modules/cjs/helpers.js:92:18)
64    at F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\ProgressPlugin.js:412:9
65    at Hook.eval [as call] (eval at create (F:\#Development\Files\angularProjects\firstApp\node_modules\tapable\lib\HookCodeFactory.js:19:10), <anonymous>:7:1)
66    at NormalModule.doBuild (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:768:24)
67    at NormalModule.build (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:920:15)
68    at F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\Compilation.js:1322:12
69    at NormalModule.needBuild (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:1192:32)
70
71../../../../#Development/Files/angularProjects/firstApp/src/styles.css - Error: Module build failed: Error: Cannot find module 'F:\#Development\Files\angularProjects\firstApp\node_modules\mini-css-extract-plugin\dist\loader.js'
72Require stack:
73- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\ProgressPlugin.js
74- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\index.js
75- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\webpack\index.js
76- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\index.js
77- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-angular\src\dev-server\index.js
78- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js
79- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\index.js
80- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\architect-command.js
81- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\commands\serve-impl.js
82- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\export-ref.js
83- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\index.js
84- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\utilities\json-schema.js
85- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\command-runner.js
86- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\lib\cli\index.js
87- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\lib\init.js
88- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng
89    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
90    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
91    at Module.require (internal/modules/cjs/loader.js:974:19)
92    at require (internal/modules/cjs/helpers.js:92:18)
93    at F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\ProgressPlugin.js:412:9
94    at Hook.eval [as call] (eval at create (F:\#Development\Files\angularProjects\firstApp\node_modules\tapable\lib\HookCodeFactory.js:19:10), <anonymous>:7:1)
95    at Hook.CALL_DELEGATE [as _call] (F:\#Development\Files\angularProjects\firstApp\node_modules\tapable\lib\Hook.js:14:14)
96    at NormalModule.doBuild (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:768:24)
97    at NormalModule.build (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:920:15)
98    at F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\Compilation.js:1322:12
99
100../../../../#Development/Files/angularProjects/firstApp/src/app/app.component.css - Error: Module build failed (from ../../../../#Development/Files/angularProjects/firstApp/node_modules/postcss-loader/dist/cjs.js):
101Error: Cannot find module 'F:\#Development\Files\angularProjects\firstApp\node_modules\postcss-loader\dist\cjs.js'
102Require stack:
103- F:\#Development\Files\angularProjects\firstApp\node_modules\loader-runner\lib\loadLoader.js
104- F:\#Development\Files\angularProjects\firstApp\node_modules\loader-runner\lib\LoaderRunner.js
105- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModuleFactory.js
106- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\Compiler.js
107- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\ProgressPlugin.js
108- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\index.js
109- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\webpack\index.js
110- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\index.js
111- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-angular\src\dev-server\index.js
112- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js
113- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\index.js
114- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\architect-command.js
115- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\commands\serve-impl.js
116- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\export-ref.js
117- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\index.js
118- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\utilities\json-schema.js
119- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\command-runner.js
120- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\lib\cli\index.js
121- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\lib\init.js
122- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng
123    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
124    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
125    at Module.require (internal/modules/cjs/loader.js:974:19)
126    at require (internal/modules/cjs/helpers.js:92:18)
127    at loadLoader (F:\#Development\Files\angularProjects\firstApp\node_modules\loader-runner\lib\loadLoader.js:19:17)
128    at iteratePitchingLoaders (F:\#Development\Files\angularProjects\firstApp\node_modules\loader-runner\lib\LoaderRunner.js:182:2)
129    at runLoaders (F:\#Development\Files\angularProjects\firstApp\node_modules\loader-runner\lib\LoaderRunner.js:397:2)
130    at NormalModule.doBuild (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:773:3)
131    at NormalModule.build (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:920:15)
132    at F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\Compilation.js:1322:12
133
134Error: Module not found: Error: Can't resolve 'F:\#Development\Files\angularProjects\firstApp\node_modules\webpack-dev-server\client\index.js?http://0.0.0.0:0&sockPath=/sockjs-node' in 'F:\#Development\Files\angularProjects\firstApp'
135
136Error: Module not found: Error: Can't resolve 'F:\#Development\Files\angularProjects\firstApp\node_modules\webpack-dev-server\client\index.js?http://0.0.0.0:0&sockPath=/sockjs-node' in 'F:\#Development\Files\angularProjects\firstApp'
137
138Error: Module not found: Error: Can't resolve 'F:\#Development\Files\angularProjects\firstApp\node_modules\webpack-dev-server\client\index.js?http://0.0.0.0:0&sockPath=/sockjs-node' in 'F:\#Development\Files\angularProjects\firstApp'
139
140Error: node_modules/@angular/platform-browser/platform-browser.d.ts:45:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.
141
142This likely means that the library (@angular/platform-browser) which declares BrowserModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.
143
14445 export declare class BrowserModule {
145npm i @angular-devkit/build-angular
146
1√ Browser application bundle generation complete.
2
3Initial Chunk Files | Names         |     Size
4runtime.js          | runtime       |  4.89 kB
5main.js             | main          |  3.56 kB
6polyfills.js        | polyfills     |  3.55 kB
7styles.js           | styles        |  3.54 kB
8
9                    | Initial Total | 15.54 kB
10
11Build at: 2021-09-06T06:20:42.162Z - Hash: f81b11c218148f716cf3 - Time: 10951ms
12
13../../../../#Development/Files/angularProjects/firstApp/src/main.ts - Error: Module build failed: Error: Cannot find module 'F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-angular\src\babel\webpack-loader.js'
14Require stack:
15- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\ProgressPlugin.js
16- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\index.js
17- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\webpack\index.js
18- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\index.js
19- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-angular\src\dev-server\index.js
20- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js
21- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\index.js
22- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\architect-command.js
23- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\commands\serve-impl.js
24- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\export-ref.js
25- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\index.js
26- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\utilities\json-schema.js
27- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\command-runner.js
28- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\lib\cli\index.js
29- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\lib\init.js
30- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng
31    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
32    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
33    at Module.require (internal/modules/cjs/loader.js:974:19)
34    at require (internal/modules/cjs/helpers.js:92:18)
35    at F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\ProgressPlugin.js:412:9
36    at Hook.eval [as call] (eval at create (F:\#Development\Files\angularProjects\firstApp\node_modules\tapable\lib\HookCodeFactory.js:19:10), <anonymous>:7:1)
37    at NormalModule.doBuild (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:768:24)
38    at NormalModule.build (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:920:15)
39    at F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\Compilation.js:1322:12
40    at NormalModule.needBuild (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:1192:32)
41
42../../../../#Development/Files/angularProjects/firstApp/src/polyfills.ts - Error: Module build failed: Error: Cannot find module 'F:\#Development\Files\angularProjects\firstApp\node_modules\@ngtools\webpack\src\ivy\index.js'
43Require stack:
44- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\ProgressPlugin.js
45- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\index.js
46- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\webpack\index.js
47- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\index.js
48- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-angular\src\dev-server\index.js
49- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js
50- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\index.js
51- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\architect-command.js
52- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\commands\serve-impl.js
53- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\export-ref.js
54- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\index.js
55- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\utilities\json-schema.js
56- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\command-runner.js
57- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\lib\cli\index.js
58- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\lib\init.js
59- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng
60    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
61    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
62    at Module.require (internal/modules/cjs/loader.js:974:19)
63    at require (internal/modules/cjs/helpers.js:92:18)
64    at F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\ProgressPlugin.js:412:9
65    at Hook.eval [as call] (eval at create (F:\#Development\Files\angularProjects\firstApp\node_modules\tapable\lib\HookCodeFactory.js:19:10), <anonymous>:7:1)
66    at NormalModule.doBuild (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:768:24)
67    at NormalModule.build (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:920:15)
68    at F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\Compilation.js:1322:12
69    at NormalModule.needBuild (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:1192:32)
70
71../../../../#Development/Files/angularProjects/firstApp/src/styles.css - Error: Module build failed: Error: Cannot find module 'F:\#Development\Files\angularProjects\firstApp\node_modules\mini-css-extract-plugin\dist\loader.js'
72Require stack:
73- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\ProgressPlugin.js
74- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\index.js
75- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\webpack\index.js
76- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\index.js
77- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-angular\src\dev-server\index.js
78- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js
79- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\index.js
80- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\architect-command.js
81- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\commands\serve-impl.js
82- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\export-ref.js
83- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\index.js
84- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\utilities\json-schema.js
85- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\command-runner.js
86- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\lib\cli\index.js
87- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\lib\init.js
88- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng
89    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
90    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
91    at Module.require (internal/modules/cjs/loader.js:974:19)
92    at require (internal/modules/cjs/helpers.js:92:18)
93    at F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\ProgressPlugin.js:412:9
94    at Hook.eval [as call] (eval at create (F:\#Development\Files\angularProjects\firstApp\node_modules\tapable\lib\HookCodeFactory.js:19:10), <anonymous>:7:1)
95    at Hook.CALL_DELEGATE [as _call] (F:\#Development\Files\angularProjects\firstApp\node_modules\tapable\lib\Hook.js:14:14)
96    at NormalModule.doBuild (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:768:24)
97    at NormalModule.build (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:920:15)
98    at F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\Compilation.js:1322:12
99
100../../../../#Development/Files/angularProjects/firstApp/src/app/app.component.css - Error: Module build failed (from ../../../../#Development/Files/angularProjects/firstApp/node_modules/postcss-loader/dist/cjs.js):
101Error: Cannot find module 'F:\#Development\Files\angularProjects\firstApp\node_modules\postcss-loader\dist\cjs.js'
102Require stack:
103- F:\#Development\Files\angularProjects\firstApp\node_modules\loader-runner\lib\loadLoader.js
104- F:\#Development\Files\angularProjects\firstApp\node_modules\loader-runner\lib\LoaderRunner.js
105- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModuleFactory.js
106- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\Compiler.js
107- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\ProgressPlugin.js
108- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\index.js
109- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\webpack\index.js
110- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\index.js
111- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-angular\src\dev-server\index.js
112- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js
113- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\index.js
114- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\architect-command.js
115- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\commands\serve-impl.js
116- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\export-ref.js
117- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\index.js
118- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\utilities\json-schema.js
119- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\command-runner.js
120- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\lib\cli\index.js
121- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\lib\init.js
122- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng
123    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
124    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
125    at Module.require (internal/modules/cjs/loader.js:974:19)
126    at require (internal/modules/cjs/helpers.js:92:18)
127    at loadLoader (F:\#Development\Files\angularProjects\firstApp\node_modules\loader-runner\lib\loadLoader.js:19:17)
128    at iteratePitchingLoaders (F:\#Development\Files\angularProjects\firstApp\node_modules\loader-runner\lib\LoaderRunner.js:182:2)
129    at runLoaders (F:\#Development\Files\angularProjects\firstApp\node_modules\loader-runner\lib\LoaderRunner.js:397:2)
130    at NormalModule.doBuild (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:773:3)
131    at NormalModule.build (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:920:15)
132    at F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\Compilation.js:1322:12
133
134Error: Module not found: Error: Can't resolve 'F:\#Development\Files\angularProjects\firstApp\node_modules\webpack-dev-server\client\index.js?http://0.0.0.0:0&sockPath=/sockjs-node' in 'F:\#Development\Files\angularProjects\firstApp'
135
136Error: Module not found: Error: Can't resolve 'F:\#Development\Files\angularProjects\firstApp\node_modules\webpack-dev-server\client\index.js?http://0.0.0.0:0&sockPath=/sockjs-node' in 'F:\#Development\Files\angularProjects\firstApp'
137
138Error: Module not found: Error: Can't resolve 'F:\#Development\Files\angularProjects\firstApp\node_modules\webpack-dev-server\client\index.js?http://0.0.0.0:0&sockPath=/sockjs-node' in 'F:\#Development\Files\angularProjects\firstApp'
139
140Error: node_modules/@angular/platform-browser/platform-browser.d.ts:45:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.
141
142This likely means that the library (@angular/platform-browser) which declares BrowserModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.
143
14445 export declare class BrowserModule {
145npm i @angular-devkit/build-angular
146npm i @ngtools/webpack
147
1√ Browser application bundle generation complete.
2
3Initial Chunk Files | Names         |     Size
4runtime.js          | runtime       |  4.89 kB
5main.js             | main          |  3.56 kB
6polyfills.js        | polyfills     |  3.55 kB
7styles.js           | styles        |  3.54 kB
8
9                    | Initial Total | 15.54 kB
10
11Build at: 2021-09-06T06:20:42.162Z - Hash: f81b11c218148f716cf3 - Time: 10951ms
12
13../../../../#Development/Files/angularProjects/firstApp/src/main.ts - Error: Module build failed: Error: Cannot find module 'F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-angular\src\babel\webpack-loader.js'
14Require stack:
15- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\ProgressPlugin.js
16- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\index.js
17- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\webpack\index.js
18- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\index.js
19- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-angular\src\dev-server\index.js
20- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js
21- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\index.js
22- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\architect-command.js
23- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\commands\serve-impl.js
24- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\export-ref.js
25- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\index.js
26- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\utilities\json-schema.js
27- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\command-runner.js
28- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\lib\cli\index.js
29- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\lib\init.js
30- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng
31    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
32    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
33    at Module.require (internal/modules/cjs/loader.js:974:19)
34    at require (internal/modules/cjs/helpers.js:92:18)
35    at F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\ProgressPlugin.js:412:9
36    at Hook.eval [as call] (eval at create (F:\#Development\Files\angularProjects\firstApp\node_modules\tapable\lib\HookCodeFactory.js:19:10), <anonymous>:7:1)
37    at NormalModule.doBuild (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:768:24)
38    at NormalModule.build (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:920:15)
39    at F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\Compilation.js:1322:12
40    at NormalModule.needBuild (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:1192:32)
41
42../../../../#Development/Files/angularProjects/firstApp/src/polyfills.ts - Error: Module build failed: Error: Cannot find module 'F:\#Development\Files\angularProjects\firstApp\node_modules\@ngtools\webpack\src\ivy\index.js'
43Require stack:
44- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\ProgressPlugin.js
45- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\index.js
46- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\webpack\index.js
47- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\index.js
48- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-angular\src\dev-server\index.js
49- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js
50- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\index.js
51- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\architect-command.js
52- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\commands\serve-impl.js
53- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\export-ref.js
54- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\index.js
55- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\utilities\json-schema.js
56- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\command-runner.js
57- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\lib\cli\index.js
58- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\lib\init.js
59- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng
60    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
61    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
62    at Module.require (internal/modules/cjs/loader.js:974:19)
63    at require (internal/modules/cjs/helpers.js:92:18)
64    at F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\ProgressPlugin.js:412:9
65    at Hook.eval [as call] (eval at create (F:\#Development\Files\angularProjects\firstApp\node_modules\tapable\lib\HookCodeFactory.js:19:10), <anonymous>:7:1)
66    at NormalModule.doBuild (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:768:24)
67    at NormalModule.build (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:920:15)
68    at F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\Compilation.js:1322:12
69    at NormalModule.needBuild (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:1192:32)
70
71../../../../#Development/Files/angularProjects/firstApp/src/styles.css - Error: Module build failed: Error: Cannot find module 'F:\#Development\Files\angularProjects\firstApp\node_modules\mini-css-extract-plugin\dist\loader.js'
72Require stack:
73- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\ProgressPlugin.js
74- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\index.js
75- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\webpack\index.js
76- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\index.js
77- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-angular\src\dev-server\index.js
78- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js
79- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\index.js
80- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\architect-command.js
81- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\commands\serve-impl.js
82- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\export-ref.js
83- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\index.js
84- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\utilities\json-schema.js
85- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\command-runner.js
86- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\lib\cli\index.js
87- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\lib\init.js
88- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng
89    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
90    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
91    at Module.require (internal/modules/cjs/loader.js:974:19)
92    at require (internal/modules/cjs/helpers.js:92:18)
93    at F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\ProgressPlugin.js:412:9
94    at Hook.eval [as call] (eval at create (F:\#Development\Files\angularProjects\firstApp\node_modules\tapable\lib\HookCodeFactory.js:19:10), <anonymous>:7:1)
95    at Hook.CALL_DELEGATE [as _call] (F:\#Development\Files\angularProjects\firstApp\node_modules\tapable\lib\Hook.js:14:14)
96    at NormalModule.doBuild (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:768:24)
97    at NormalModule.build (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:920:15)
98    at F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\Compilation.js:1322:12
99
100../../../../#Development/Files/angularProjects/firstApp/src/app/app.component.css - Error: Module build failed (from ../../../../#Development/Files/angularProjects/firstApp/node_modules/postcss-loader/dist/cjs.js):
101Error: Cannot find module 'F:\#Development\Files\angularProjects\firstApp\node_modules\postcss-loader\dist\cjs.js'
102Require stack:
103- F:\#Development\Files\angularProjects\firstApp\node_modules\loader-runner\lib\loadLoader.js
104- F:\#Development\Files\angularProjects\firstApp\node_modules\loader-runner\lib\LoaderRunner.js
105- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModuleFactory.js
106- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\Compiler.js
107- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\ProgressPlugin.js
108- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\index.js
109- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\webpack\index.js
110- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\index.js
111- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-angular\src\dev-server\index.js
112- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js
113- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\index.js
114- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\architect-command.js
115- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\commands\serve-impl.js
116- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\export-ref.js
117- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\index.js
118- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\utilities\json-schema.js
119- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\command-runner.js
120- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\lib\cli\index.js
121- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\lib\init.js
122- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng
123    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
124    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
125    at Module.require (internal/modules/cjs/loader.js:974:19)
126    at require (internal/modules/cjs/helpers.js:92:18)
127    at loadLoader (F:\#Development\Files\angularProjects\firstApp\node_modules\loader-runner\lib\loadLoader.js:19:17)
128    at iteratePitchingLoaders (F:\#Development\Files\angularProjects\firstApp\node_modules\loader-runner\lib\LoaderRunner.js:182:2)
129    at runLoaders (F:\#Development\Files\angularProjects\firstApp\node_modules\loader-runner\lib\LoaderRunner.js:397:2)
130    at NormalModule.doBuild (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:773:3)
131    at NormalModule.build (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:920:15)
132    at F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\Compilation.js:1322:12
133
134Error: Module not found: Error: Can't resolve 'F:\#Development\Files\angularProjects\firstApp\node_modules\webpack-dev-server\client\index.js?http://0.0.0.0:0&sockPath=/sockjs-node' in 'F:\#Development\Files\angularProjects\firstApp'
135
136Error: Module not found: Error: Can't resolve 'F:\#Development\Files\angularProjects\firstApp\node_modules\webpack-dev-server\client\index.js?http://0.0.0.0:0&sockPath=/sockjs-node' in 'F:\#Development\Files\angularProjects\firstApp'
137
138Error: Module not found: Error: Can't resolve 'F:\#Development\Files\angularProjects\firstApp\node_modules\webpack-dev-server\client\index.js?http://0.0.0.0:0&sockPath=/sockjs-node' in 'F:\#Development\Files\angularProjects\firstApp'
139
140Error: node_modules/@angular/platform-browser/platform-browser.d.ts:45:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.
141
142This likely means that the library (@angular/platform-browser) which declares BrowserModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.
143
14445 export declare class BrowserModule {
145npm i @angular-devkit/build-angular
146npm i @ngtools/webpack
147npm i mini-css-extract-plugin
148
1√ Browser application bundle generation complete.
2
3Initial Chunk Files | Names         |     Size
4runtime.js          | runtime       |  4.89 kB
5main.js             | main          |  3.56 kB
6polyfills.js        | polyfills     |  3.55 kB
7styles.js           | styles        |  3.54 kB
8
9                    | Initial Total | 15.54 kB
10
11Build at: 2021-09-06T06:20:42.162Z - Hash: f81b11c218148f716cf3 - Time: 10951ms
12
13../../../../#Development/Files/angularProjects/firstApp/src/main.ts - Error: Module build failed: Error: Cannot find module 'F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-angular\src\babel\webpack-loader.js'
14Require stack:
15- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\ProgressPlugin.js
16- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\index.js
17- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\webpack\index.js
18- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\index.js
19- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-angular\src\dev-server\index.js
20- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js
21- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\index.js
22- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\architect-command.js
23- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\commands\serve-impl.js
24- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\export-ref.js
25- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\index.js
26- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\utilities\json-schema.js
27- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\command-runner.js
28- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\lib\cli\index.js
29- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\lib\init.js
30- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng
31    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
32    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
33    at Module.require (internal/modules/cjs/loader.js:974:19)
34    at require (internal/modules/cjs/helpers.js:92:18)
35    at F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\ProgressPlugin.js:412:9
36    at Hook.eval [as call] (eval at create (F:\#Development\Files\angularProjects\firstApp\node_modules\tapable\lib\HookCodeFactory.js:19:10), <anonymous>:7:1)
37    at NormalModule.doBuild (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:768:24)
38    at NormalModule.build (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:920:15)
39    at F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\Compilation.js:1322:12
40    at NormalModule.needBuild (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:1192:32)
41
42../../../../#Development/Files/angularProjects/firstApp/src/polyfills.ts - Error: Module build failed: Error: Cannot find module 'F:\#Development\Files\angularProjects\firstApp\node_modules\@ngtools\webpack\src\ivy\index.js'
43Require stack:
44- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\ProgressPlugin.js
45- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\index.js
46- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\webpack\index.js
47- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\index.js
48- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-angular\src\dev-server\index.js
49- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js
50- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\index.js
51- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\architect-command.js
52- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\commands\serve-impl.js
53- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\export-ref.js
54- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\index.js
55- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\utilities\json-schema.js
56- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\command-runner.js
57- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\lib\cli\index.js
58- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\lib\init.js
59- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng
60    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
61    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
62    at Module.require (internal/modules/cjs/loader.js:974:19)
63    at require (internal/modules/cjs/helpers.js:92:18)
64    at F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\ProgressPlugin.js:412:9
65    at Hook.eval [as call] (eval at create (F:\#Development\Files\angularProjects\firstApp\node_modules\tapable\lib\HookCodeFactory.js:19:10), <anonymous>:7:1)
66    at NormalModule.doBuild (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:768:24)
67    at NormalModule.build (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:920:15)
68    at F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\Compilation.js:1322:12
69    at NormalModule.needBuild (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:1192:32)
70
71../../../../#Development/Files/angularProjects/firstApp/src/styles.css - Error: Module build failed: Error: Cannot find module 'F:\#Development\Files\angularProjects\firstApp\node_modules\mini-css-extract-plugin\dist\loader.js'
72Require stack:
73- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\ProgressPlugin.js
74- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\index.js
75- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\webpack\index.js
76- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\index.js
77- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-angular\src\dev-server\index.js
78- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js
79- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\index.js
80- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\architect-command.js
81- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\commands\serve-impl.js
82- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\export-ref.js
83- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\index.js
84- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\utilities\json-schema.js
85- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\command-runner.js
86- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\lib\cli\index.js
87- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\lib\init.js
88- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng
89    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
90    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
91    at Module.require (internal/modules/cjs/loader.js:974:19)
92    at require (internal/modules/cjs/helpers.js:92:18)
93    at F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\ProgressPlugin.js:412:9
94    at Hook.eval [as call] (eval at create (F:\#Development\Files\angularProjects\firstApp\node_modules\tapable\lib\HookCodeFactory.js:19:10), <anonymous>:7:1)
95    at Hook.CALL_DELEGATE [as _call] (F:\#Development\Files\angularProjects\firstApp\node_modules\tapable\lib\Hook.js:14:14)
96    at NormalModule.doBuild (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:768:24)
97    at NormalModule.build (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:920:15)
98    at F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\Compilation.js:1322:12
99
100../../../../#Development/Files/angularProjects/firstApp/src/app/app.component.css - Error: Module build failed (from ../../../../#Development/Files/angularProjects/firstApp/node_modules/postcss-loader/dist/cjs.js):
101Error: Cannot find module 'F:\#Development\Files\angularProjects\firstApp\node_modules\postcss-loader\dist\cjs.js'
102Require stack:
103- F:\#Development\Files\angularProjects\firstApp\node_modules\loader-runner\lib\loadLoader.js
104- F:\#Development\Files\angularProjects\firstApp\node_modules\loader-runner\lib\LoaderRunner.js
105- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModuleFactory.js
106- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\Compiler.js
107- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\ProgressPlugin.js
108- F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\index.js
109- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\webpack\index.js
110- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-webpack\src\index.js
111- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\build-angular\src\dev-server\index.js
112- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js
113- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\architect\node\index.js
114- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\architect-command.js
115- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\commands\serve-impl.js
116- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\export-ref.js
117- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular-devkit\schematics\tools\index.js
118- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\utilities\json-schema.js
119- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\models\command-runner.js
120- F:\#Development\Files\angularProjects\firstApp\node_modules\@angular\cli\lib\cli\index.js
121- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\lib\init.js
122- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng
123    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
124    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
125    at Module.require (internal/modules/cjs/loader.js:974:19)
126    at require (internal/modules/cjs/helpers.js:92:18)
127    at loadLoader (F:\#Development\Files\angularProjects\firstApp\node_modules\loader-runner\lib\loadLoader.js:19:17)
128    at iteratePitchingLoaders (F:\#Development\Files\angularProjects\firstApp\node_modules\loader-runner\lib\LoaderRunner.js:182:2)
129    at runLoaders (F:\#Development\Files\angularProjects\firstApp\node_modules\loader-runner\lib\LoaderRunner.js:397:2)
130    at NormalModule.doBuild (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:773:3)
131    at NormalModule.build (F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\NormalModule.js:920:15)
132    at F:\#Development\Files\angularProjects\firstApp\node_modules\webpack\lib\Compilation.js:1322:12
133
134Error: Module not found: Error: Can't resolve 'F:\#Development\Files\angularProjects\firstApp\node_modules\webpack-dev-server\client\index.js?http://0.0.0.0:0&sockPath=/sockjs-node' in 'F:\#Development\Files\angularProjects\firstApp'
135
136Error: Module not found: Error: Can't resolve 'F:\#Development\Files\angularProjects\firstApp\node_modules\webpack-dev-server\client\index.js?http://0.0.0.0:0&sockPath=/sockjs-node' in 'F:\#Development\Files\angularProjects\firstApp'
137
138Error: Module not found: Error: Can't resolve 'F:\#Development\Files\angularProjects\firstApp\node_modules\webpack-dev-server\client\index.js?http://0.0.0.0:0&sockPath=/sockjs-node' in 'F:\#Development\Files\angularProjects\firstApp'
139
140Error: node_modules/@angular/platform-browser/platform-browser.d.ts:45:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.
141
142This likely means that the library (@angular/platform-browser) which declares BrowserModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.
143
14445 export declare class BrowserModule {
145npm i @angular-devkit/build-angular
146npm i @ngtools/webpack
147npm i mini-css-extract-plugin
148npm i postcss-loader
149

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

QUESTION

Why does my tailwind output file not include the utilities and components

Asked 2022-Jan-21 at 16:43

I've installed tailwind using npm install tailwindcss I then create my src/style.css file and include

1    `@tailwind base;`
2    `@tailwind components;`
3    `@tailwind utilities;`
4

When I run my build-css command I get a generated output.css file, but the file is only 425 lines long. It looks likes it's missing the components and the utilities. When I link my HTML to the output.css I get the base tailwind css styles applied, but utilities have absolutely no effect. I have followed the docs to the best of my ability as well as several tutorials with the same result every time. No clue what I am I doing wrong, the tuts I have watched show this file to be thousands of lines of code while mine is always 425.

ANSWER

Answered 2021-Dec-25 at 20:47

You need to add a config js file for the tailwind engine, inside the config file use content attribute to define where is your HTML or JS files, the new engine automatically looks inside these files and compiles only the classes that you used.

Check this video for more information:https://youtu.be/mSC6GwizOag?t=22

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

QUESTION

How can I compare system_clock::now() to a local time in c++20?

Asked 2022-Jan-20 at 14:01

I am testing a library like follows:

1std::chrono::system_clock::time_point FromDateTime(const DateTime& dateTime)
2{
3    std::tm tm{};
4    tm.tm_year = dateTime.Year - 1900;
5    tm.tm_mon = dateTime.Month - 1;
6    tm.tm_mday = dateTime.Day;
7    tm.tm_hour = dateTime.Hour;
8    tm.tm_min = dateTime.Minute;
9    tm.tm_sec = dateTime.Second;
10
11    const auto& time = std::mktime(&tm);
12    const auto& timePoint = std::chrono::system_clock::from_time_t(time);
13
14    return timePoint;
15}
16
17TEST_F(MyLibraryFixture, GetDateTime)
18{
19    // Arrange
20    const auto& now = std::chrono::system_clock::now();
21
22    // Act
23    const auto& actual = _testee->GetDateTime();
24
25    // Assert
26    const auto& timeDiscrepanceInSec = std::chrono::duration_cast<std::chrono::seconds>(FromDateTime(actual) - now);
27    ASSERT_TRUE(timeDiscrepanceInSec.count() < 10);
28}
29

The DateTime type is just a raw struct with the above used fields. The call

1std::chrono::system_clock::time_point FromDateTime(const DateTime& dateTime)
2{
3    std::tm tm{};
4    tm.tm_year = dateTime.Year - 1900;
5    tm.tm_mon = dateTime.Month - 1;
6    tm.tm_mday = dateTime.Day;
7    tm.tm_hour = dateTime.Hour;
8    tm.tm_min = dateTime.Minute;
9    tm.tm_sec = dateTime.Second;
10
11    const auto& time = std::mktime(&tm);
12    const auto& timePoint = std::chrono::system_clock::from_time_t(time);
13
14    return timePoint;
15}
16
17TEST_F(MyLibraryFixture, GetDateTime)
18{
19    // Arrange
20    const auto& now = std::chrono::system_clock::now();
21
22    // Act
23    const auto& actual = _testee->GetDateTime();
24
25    // Assert
26    const auto& timeDiscrepanceInSec = std::chrono::duration_cast<std::chrono::seconds>(FromDateTime(actual) - now);
27    ASSERT_TRUE(timeDiscrepanceInSec.count() < 10);
28}
29_testee->GetDateTime();
30

gives a DateTime struct back and the date time is actually local time. For some reason inherent to the library I am testing, I need to compare the local time with the time it is now. My code above seems to be working fine, I "hope" it will still work when we get back to Summer time.

Now, c++20 exposes a lot of date time utilities. I have browsed the documentation, I have tried some stuff, but I was not able to come up with a reliable counterpart to the above snippet. Is it any possible (I mean, without using std::mktime and the strange std::tm)?

The closest I was able to come is this, but it is still wrong (I get a discrepancy of one hour):

1std::chrono::system_clock::time_point FromDateTime(const DateTime& dateTime)
2{
3    std::tm tm{};
4    tm.tm_year = dateTime.Year - 1900;
5    tm.tm_mon = dateTime.Month - 1;
6    tm.tm_mday = dateTime.Day;
7    tm.tm_hour = dateTime.Hour;
8    tm.tm_min = dateTime.Minute;
9    tm.tm_sec = dateTime.Second;
10
11    const auto& time = std::mktime(&tm);
12    const auto& timePoint = std::chrono::system_clock::from_time_t(time);
13
14    return timePoint;
15}
16
17TEST_F(MyLibraryFixture, GetDateTime)
18{
19    // Arrange
20    const auto& now = std::chrono::system_clock::now();
21
22    // Act
23    const auto& actual = _testee->GetDateTime();
24
25    // Assert
26    const auto& timeDiscrepanceInSec = std::chrono::duration_cast<std::chrono::seconds>(FromDateTime(actual) - now);
27    ASSERT_TRUE(timeDiscrepanceInSec.count() < 10);
28}
29_testee->GetDateTime();
30std::chrono::time_point<std::chrono::local_t, std::chrono::seconds> FromDateTime(const DateTime& dateTime)
31{
32    const auto& d = std::chrono::year_month_day(std::chrono::year(dateTime.Year), std::chrono::month(dateTime.Month), std::chrono::day(dateTime.Day));
33    const auto& t = std::chrono::hours(dateTime.Hour) + std::chrono::minutes(dateTime.Minute) + std::chrono::seconds(dateTime.Second);
34    const auto& dt = std::chrono::local_days(d) + t;
35
36    return dt;
37}
38
39TEST_F(MyLibraryFixture, GetDateTime)
40{
41    // Arrange
42    const auto& now = std::chrono::utc_clock::now();
43
44    // Act
45    const auto& actual = _testee->GetDateTime();
46
47    // Assert
48    const auto& timeDiscrepanceInSec = std::chrono::duration_cast<std::chrono::seconds>(FromDateTime(actual).time_since_epoch() - now.time_since_epoch());
49    ASSERT_TRUE(timeDiscrepanceInSec.count() < 10);
50}
51

ANSWER

Answered 2022-Jan-20 at 14:01

Here's the equivalent C++20 code to your first version of FromDateTime:

1std::chrono::system_clock::time_point FromDateTime(const DateTime& dateTime)
2{
3    std::tm tm{};
4    tm.tm_year = dateTime.Year - 1900;
5    tm.tm_mon = dateTime.Month - 1;
6    tm.tm_mday = dateTime.Day;
7    tm.tm_hour = dateTime.Hour;
8    tm.tm_min = dateTime.Minute;
9    tm.tm_sec = dateTime.Second;
10
11    const auto& time = std::mktime(&tm);
12    const auto& timePoint = std::chrono::system_clock::from_time_t(time);
13
14    return timePoint;
15}
16
17TEST_F(MyLibraryFixture, GetDateTime)
18{
19    // Arrange
20    const auto& now = std::chrono::system_clock::now();
21
22    // Act
23    const auto& actual = _testee->GetDateTime();
24
25    // Assert
26    const auto& timeDiscrepanceInSec = std::chrono::duration_cast<std::chrono::seconds>(FromDateTime(actual) - now);
27    ASSERT_TRUE(timeDiscrepanceInSec.count() < 10);
28}
29_testee->GetDateTime();
30std::chrono::time_point<std::chrono::local_t, std::chrono::seconds> FromDateTime(const DateTime& dateTime)
31{
32    const auto& d = std::chrono::year_month_day(std::chrono::year(dateTime.Year), std::chrono::month(dateTime.Month), std::chrono::day(dateTime.Day));
33    const auto& t = std::chrono::hours(dateTime.Hour) + std::chrono::minutes(dateTime.Minute) + std::chrono::seconds(dateTime.Second);
34    const auto& dt = std::chrono::local_days(d) + t;
35
36    return dt;
37}
38
39TEST_F(MyLibraryFixture, GetDateTime)
40{
41    // Arrange
42    const auto& now = std::chrono::utc_clock::now();
43
44    // Act
45    const auto& actual = _testee->GetDateTime();
46
47    // Assert
48    const auto& timeDiscrepanceInSec = std::chrono::duration_cast<std::chrono::seconds>(FromDateTime(actual).time_since_epoch() - now.time_since_epoch());
49    ASSERT_TRUE(timeDiscrepanceInSec.count() < 10);
50}
51std::chrono::system_clock::time_point
52FromDateTime(const DateTime& dateTime)
53{
54    using namespace std::chrono;
55    auto local_tp = local_days{year{dateTime.Year}/dateTime.Month/dateTime.Day} +
56        hours{dateTime.Hour} + minutes{dateTime.Minute} + seconds{dateTime.Second};
57    zoned_time zt{current_zone(), local_tp};
58    return zt.get_sys_time();
59}
60

You were on the right track with creating a local_time using local_days.

There's no need to explicitly name the year_month_day type. This is generated for you using the / notation.

Once you have the local time, you can associate it with your computer's local time zone by constructing a zoned_time with current_zone() and the local_time.

Then you can extract the sys_time out of the zoned_time. The sys_time is a time_point<system_clock, seconds> (seconds-precision system_clock::time_point), which is UTC (excluding leap seconds). And this implicitly converts to the return type: system_clock::time_point.

If desired, you could interpret the local_time with respect to some other time zone, rather than your computer's local time zone. For example:

1std::chrono::system_clock::time_point FromDateTime(const DateTime&amp; dateTime)
2{
3    std::tm tm{};
4    tm.tm_year = dateTime.Year - 1900;
5    tm.tm_mon = dateTime.Month - 1;
6    tm.tm_mday = dateTime.Day;
7    tm.tm_hour = dateTime.Hour;
8    tm.tm_min = dateTime.Minute;
9    tm.tm_sec = dateTime.Second;
10
11    const auto&amp; time = std::mktime(&amp;tm);
12    const auto&amp; timePoint = std::chrono::system_clock::from_time_t(time);
13
14    return timePoint;
15}
16
17TEST_F(MyLibraryFixture, GetDateTime)
18{
19    // Arrange
20    const auto&amp; now = std::chrono::system_clock::now();
21
22    // Act
23    const auto&amp; actual = _testee-&gt;GetDateTime();
24
25    // Assert
26    const auto&amp; timeDiscrepanceInSec = std::chrono::duration_cast&lt;std::chrono::seconds&gt;(FromDateTime(actual) - now);
27    ASSERT_TRUE(timeDiscrepanceInSec.count() &lt; 10);
28}
29_testee-&gt;GetDateTime();
30std::chrono::time_point&lt;std::chrono::local_t, std::chrono::seconds&gt; FromDateTime(const DateTime&amp; dateTime)
31{
32    const auto&amp; d = std::chrono::year_month_day(std::chrono::year(dateTime.Year), std::chrono::month(dateTime.Month), std::chrono::day(dateTime.Day));
33    const auto&amp; t = std::chrono::hours(dateTime.Hour) + std::chrono::minutes(dateTime.Minute) + std::chrono::seconds(dateTime.Second);
34    const auto&amp; dt = std::chrono::local_days(d) + t;
35
36    return dt;
37}
38
39TEST_F(MyLibraryFixture, GetDateTime)
40{
41    // Arrange
42    const auto&amp; now = std::chrono::utc_clock::now();
43
44    // Act
45    const auto&amp; actual = _testee-&gt;GetDateTime();
46
47    // Assert
48    const auto&amp; timeDiscrepanceInSec = std::chrono::duration_cast&lt;std::chrono::seconds&gt;(FromDateTime(actual).time_since_epoch() - now.time_since_epoch());
49    ASSERT_TRUE(timeDiscrepanceInSec.count() &lt; 10);
50}
51std::chrono::system_clock::time_point
52FromDateTime(const DateTime&amp; dateTime)
53{
54    using namespace std::chrono;
55    auto local_tp = local_days{year{dateTime.Year}/dateTime.Month/dateTime.Day} +
56        hours{dateTime.Hour} + minutes{dateTime.Minute} + seconds{dateTime.Second};
57    zoned_time zt{current_zone(), local_tp};
58    return zt.get_sys_time();
59}
60    zoned_time zt{&quot;America/New_York&quot;, local_tp};
61

In general, zoned_time is a convenience type used to translate between local_time and sys_time.

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

QUESTION

Count trailing newlines with POSIX utilities or GNU coreutils or Perl

Asked 2022-Jan-19 at 22:10

I'm looking for ways to count the number of trailing newlines from possibly binary data either:

  • read from standard input
  • or already in a shell variable (then of course the "binary" excludes at least 0x0) using POSIX or coreutils utilities or maybe Perl.

This should work without temporary files or FIFOs.

When the input is in a shell variable, I already have the following (possibly ugly but) working solution:

1original_string=$'abc\n\n\def\n\n\n'
2string_without_trailing_newlines=&quot;$( printf '%s' &quot;${original_string}&quot; )&quot;
3printf '%s' $(( ${#original_string}-${#string_without_trailing_newlines} ))
4

which gives 3 in the above example.

The idea above is simply to subtract the string lengths and use the "feature" of command substitution that it discards any trailing newlines.

Test-Cases:
1original_string=$'abc\n\n\def\n\n\n'
2string_without_trailing_newlines=&quot;$( printf '%s' &quot;${original_string}&quot; )&quot;
3printf '%s' $(( ${#original_string}-${#string_without_trailing_newlines} ))
4printf ''             |  function   results in: 0
5printf '\n'           |  function   results in: 1
6printf '\n\n'         |  function   results in: 2
7printf '\n\n\n'       |  function   results in: 3
8printf 'a'            |  function   results in: 0
9printf 'a\n'          |  function   results in: 1
10printf 'a\n\n'        |  function   results in: 2
11printf '\na\n\n'      |  function   results in: 2
12printf 'a\n\nb\n'     |  function   results in: 1
13

For the special cases when NUL is part of the string (which anyway just works when reading from stdin, not when giving the string in the shell via avariable), the results are undefined but should typically be either:

1original_string=$'abc\n\n\def\n\n\n'
2string_without_trailing_newlines=&quot;$( printf '%s' &quot;${original_string}&quot; )&quot;
3printf '%s' $(( ${#original_string}-${#string_without_trailing_newlines} ))
4printf ''             |  function   results in: 0
5printf '\n'           |  function   results in: 1
6printf '\n\n'         |  function   results in: 2
7printf '\n\n\n'       |  function   results in: 3
8printf 'a'            |  function   results in: 0
9printf 'a\n'          |  function   results in: 1
10printf 'a\n\n'        |  function   results in: 2
11printf '\na\n\n'      |  function   results in: 2
12printf 'a\n\nb\n'     |  function   results in: 1
13printf '\n\x00\n\n'   |  function   results in: 1
14printf 'a\n\n\x00\n'  |  function   results in: 2
15

that is counting the new lines up to the NUL

or:

1original_string=$'abc\n\n\def\n\n\n'
2string_without_trailing_newlines=&quot;$( printf '%s' &quot;${original_string}&quot; )&quot;
3printf '%s' $(( ${#original_string}-${#string_without_trailing_newlines} ))
4printf ''             |  function   results in: 0
5printf '\n'           |  function   results in: 1
6printf '\n\n'         |  function   results in: 2
7printf '\n\n\n'       |  function   results in: 3
8printf 'a'            |  function   results in: 0
9printf 'a\n'          |  function   results in: 1
10printf 'a\n\n'        |  function   results in: 2
11printf '\na\n\n'      |  function   results in: 2
12printf 'a\n\nb\n'     |  function   results in: 1
13printf '\n\x00\n\n'   |  function   results in: 1
14printf 'a\n\n\x00\n'  |  function   results in: 2
15printf '\n\x00\n\n'   |  function   results in: 2
16printf 'a\n\n\x00\n'  |  function   results in: 1
17

that is counting the newlines from the NUL

or:

1original_string=$'abc\n\n\def\n\n\n'
2string_without_trailing_newlines=&quot;$( printf '%s' &quot;${original_string}&quot; )&quot;
3printf '%s' $(( ${#original_string}-${#string_without_trailing_newlines} ))
4printf ''             |  function   results in: 0
5printf '\n'           |  function   results in: 1
6printf '\n\n'         |  function   results in: 2
7printf '\n\n\n'       |  function   results in: 3
8printf 'a'            |  function   results in: 0
9printf 'a\n'          |  function   results in: 1
10printf 'a\n\n'        |  function   results in: 2
11printf '\na\n\n'      |  function   results in: 2
12printf 'a\n\nb\n'     |  function   results in: 1
13printf '\n\x00\n\n'   |  function   results in: 1
14printf 'a\n\n\x00\n'  |  function   results in: 2
15printf '\n\x00\n\n'   |  function   results in: 2
16printf 'a\n\n\x00\n'  |  function   results in: 1
17printf '\n\x00\n\n'   |  function   results in: 3
18printf 'a\n\n\x00\n'  |  function   results in: 3
19

that is ignoring any "trailing" NUL, as long as these are right before, within or right after the trailing NULs

or:
giving an error

ANSWER

Answered 2022-Jan-18 at 13:29

Using GNU awk for RT and without reading all of the input into memory at once:

1original_string=$'abc\n\n\def\n\n\n'
2string_without_trailing_newlines=&quot;$( printf '%s' &quot;${original_string}&quot; )&quot;
3printf '%s' $(( ${#original_string}-${#string_without_trailing_newlines} ))
4printf ''             |  function   results in: 0
5printf '\n'           |  function   results in: 1
6printf '\n\n'         |  function   results in: 2
7printf '\n\n\n'       |  function   results in: 3
8printf 'a'            |  function   results in: 0
9printf 'a\n'          |  function   results in: 1
10printf 'a\n\n'        |  function   results in: 2
11printf '\na\n\n'      |  function   results in: 2
12printf 'a\n\nb\n'     |  function   results in: 1
13printf '\n\x00\n\n'   |  function   results in: 1
14printf 'a\n\n\x00\n'  |  function   results in: 2
15printf '\n\x00\n\n'   |  function   results in: 2
16printf 'a\n\n\x00\n'  |  function   results in: 1
17printf '\n\x00\n\n'   |  function   results in: 3
18printf 'a\n\n\x00\n'  |  function   results in: 3
19$ printf 'abc\n\n\def\n\n\n' | awk '/./{n=NR} END{print NR-n+(n &amp;&amp; (RT==RS))}'
203
21
22$ printf 'a\n' | awk '/./{n=NR} END{print NR-n+(n &amp;&amp; (RT==RS))}'
231
24
25$ printf 'a' | awk '/./{n=NR} END{print NR-n+(n &amp;&amp; (RT==RS))}'
260
27
28$ printf '' | awk '/./{n=NR} END{print NR-n+(n &amp;&amp; (RT==RS))}'
290
30
31$ printf '\n' | awk '/./{n=NR} END{print NR-n+(n &amp;&amp; (RT==RS))}'
321
33
34$ printf '\n\n' | awk '/./{n=NR} END{print NR-n+(n &amp;&amp; (RT==RS))}'
352
36

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

QUESTION

Create new color scheme for dark-light mode in bootstrap sass

Asked 2022-Jan-16 at 19:50

I want to create dark mode for a web site which use bootstrap. I have to add new root class which includes all boostrap colors. Here is my colors.scss:

1$primary:#065FC6;
2$secondary:#263C5C;
3$success:#49C96D;
4$danger:#FD7972;
5$warning:#FF965D;
6$light:#F8F8F8;
7$body-color: #263C5C;
8
9$custom-colors: (
10  &quot;brd-default&quot;: $body-color
11  );
12  
13

I want create new class like this:

1$primary:#065FC6;
2$secondary:#263C5C;
3$success:#49C96D;
4$danger:#FD7972;
5$warning:#FF965D;
6$light:#F8F8F8;
7$body-color: #263C5C;
8
9$custom-colors: (
10  &quot;brd-default&quot;: $body-color
11  );
12  
13:root.dark{
14    // override colors and classes for dark mode
15    $primary:#012345;
16    $secondary:#111111;
17    $success:#222222;
18}
19

So how can i copy and paste all bootstrap colors for new color scheme?

If i can add colors, i will change HTML class so my root(color scheme) will be:

enter image description here

in my styles.scss:

1$primary:#065FC6;
2$secondary:#263C5C;
3$success:#49C96D;
4$danger:#FD7972;
5$warning:#FF965D;
6$light:#F8F8F8;
7$body-color: #263C5C;
8
9$custom-colors: (
10  &quot;brd-default&quot;: $body-color
11  );
12  
13:root.dark{
14    // override colors and classes for dark mode
15    $primary:#012345;
16    $secondary:#111111;
17    $success:#222222;
18}
19@import &quot;./colors&quot;;// custom colors
20@import &quot;bootstrap/scss/functions&quot;;
21@import &quot;bootstrap/scss/variables&quot;;
22@import &quot;bootstrap/scss/utilities&quot;;
23

ANSWER

Answered 2021-Aug-07 at 20:32

As explained here, there's no way to attach a class to :root. However, you don't need this to achieve what you want.

Simply make a dark class then you can add that as desired to the html or body tag.

Make all the needed theme color changes inside .dark{}, and then @import "bootstrap". When .dark doesn't exist on the body, the theme colors will return to Bootstrap defaults.

1$primary:#065FC6;
2$secondary:#263C5C;
3$success:#49C96D;
4$danger:#FD7972;
5$warning:#FF965D;
6$light:#F8F8F8;
7$body-color: #263C5C;
8
9$custom-colors: (
10  &quot;brd-default&quot;: $body-color
11  );
12  
13:root.dark{
14    // override colors and classes for dark mode
15    $primary:#012345;
16    $secondary:#111111;
17    $success:#222222;
18}
19@import &quot;./colors&quot;;// custom colors
20@import &quot;bootstrap/scss/functions&quot;;
21@import &quot;bootstrap/scss/variables&quot;;
22@import &quot;bootstrap/scss/utilities&quot;;
23@import &quot;functions&quot;;
24@import &quot;variables&quot;;
25@import &quot;mixins&quot;;
26
27
28.dark {
29
30    /* redefine theme colors for dark theme */
31    $primary: #012345;
32    $secondary: #111111;
33    $success: #222222;
34    $dark: #000;
35    
36    $theme-colors: (
37        &quot;primary&quot;: $primary,
38        &quot;secondary&quot;: $secondary,
39        &quot;success&quot;: $success,
40        &quot;danger&quot;: $danger,
41        &quot;info&quot;: $indigo,
42        &quot;dark&quot;: $dark,
43        &quot;light&quot;: $light,
44    );
45
46    /* redefine theme color variables */
47    @each $color, $value in $theme-colors {
48        --#{$variable-prefix}#{$color}: #{$value};
49    }
50
51    /* redefine theme color rgb vars (used for bg- colors) */
52    $theme-colors-rgb: map-loop($theme-colors, to-rgb, &quot;$value&quot;);
53    @each $color, $value in $theme-colors-rgb {
54        --#{$variable-prefix}#{$color}-rgb: #{$value};
55    }
56
57    $body-color: #eeeeee;
58    $body-bg: #263C5C;
59    
60    --#{$variable-prefix}body-color: #{$body-color};
61    --#{$variable-prefix}body-bg: #{$body-bg};
62      
63    @import &quot;bootstrap&quot;;
64}
65
66

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

Community Discussions contain sources that include Stack Exchange Network

Tutorials and Learning Resources in Utilities

Tutorials and Learning Resources are not available at this moment for Utilities

Share this Page

share link

Get latest updates on Utilities