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

JavaScript libraries are collections of pre-written code that can be used to create web applications. They provide functions, features, and resources.


It makes 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. It includes Creating Interactive Tours, Enhancing Customer Experience, Creating Interactive Tutorials, and Improving User Onboarding.  


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. 

We can create any animation with suitable libraries or combinations of libraries that are well-known for their functionalities using Python Animation Libraries. 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. 

FAQ

What are the best data visualizations for Python animation libraries?  

The Python Animation libraries create amazing visuals that can move and change. Here are the best data visualization libraries:  

  • Matplotlib  
  • Bokeh  
  • Plotly  
  • Pygal  
  • Plotnine  
  • Seaborn  
  • Holoviews  

  

Which animation library is most used by Python coders today?  

Matplotlib is a powerful 2D plotting library. It supports various visualizations. It is used in the scientific and data analysis communities. The 'FuncAnimation' class provides its animation capabilities. It allows coders to create dynamic and interactive visualizations. Its popularity is due to its advanced development, clear documentation, and reliability. Other higher-level visualization libraries use it as the backend.  

  

How can I create explanatory math videos using a Python animation library?  

You can use a Python Animation library to make math videos that show concepts visually. You should follow the below steps:  

  • Choose a Python animation library  
  • Plan your content  
  • Write the Python code  
  • Animate with time  
  • Narrate or annotate  
  • Export the video  
  • Edit and visualize  
  • Share your video  

  

What does the code for a basic Python animation look like?  

You can make a simple animation in Python with different libraries. Many people like using the matplotlib library. Matplotlib, a strong Python library, can make plots and do basic animations.   


Here's an example of a basic Python animation using matplotlib:   

import numpy as np   

import matplotlib.pyplot as plt   

from matplotlib.animation import FuncAnimation   

# Function to update the plot in each animation frame   

def update(frame):   

   # Clear the previous plot   

   plt.cla()   

   # Generate some data points for the animation   

   x = np.linspace(0, 2*np.pi, 100)   

   y = np.sin(x + 2*np.pi*frame/100)   

   # Plot the data   

   plt.plot(x, y)   

   plt.xlabel('X')   

   plt.ylabel('Y')   

   plt.title('Basic Python Animation')   

   plt.grid(True)   

# Create a blank figure   

fig, ax = plt.subplots()   

# Create the animation with the update function, 100 frames, and 100ms delay between frames   

animation = FuncAnimation(fig, update, frames=100, interval=100)    

# If you want to save the animation as a video file, you can use the following line:   

animation.save('basic_animation.mp4', writer='ffmpeg', fps=30)   

 # Display the animation   

plt.show()   

  

This code creates a simple animation that displays a sine wave. The update function makes new data points and updates the plot in each animation frame. The FuncAnimation class controls the animation. It calls the update function many times with different frame values.  

In this example, the animation has 100 frames with a delay of 100 milliseconds between frames.


To save the animation as a video file: 

  1. Remove the comment from the animation. 
  2. Save line. 
  3. Make sure you have ffmpeg installed. 
  4. Before running the code, ensure you have installed matplotlib in your Python setup. You can install it using pip install matplotlib.  

 

Using an animation library, how can you make line charts with various colors in Python?  

You can use different libraries in Python to make line charts with colors and animations. I will teach you how to use Matplotlib's FuncAnimation to animate graphs.   

  

Here's a step-by-step guide:   

#Install the required libraries (if you haven't already)   

pip install matplotlib   

# Import the necessary modules   

import numpy as np   

import matplotlib.pyplot as plt   

from matplotlib.animation import FuncAnimation   

# Generate your data: Create multiple datasets with different colors. For this example, let's consider two datasets, data1 and data2   

x = np.linspace(0, 10, 100)   

data1 = np.sin(x)   

data2 = np.cos(x)   

# Create a figure and an axis to plot the data   

fig, ax = plt.subplots()   

# Define the line objects for each dataset and set their properties   

line1, = ax.plot([], [], color='red', label='Data 1')   

line2, = ax.plot([], [], color='blue', label='Data 2')   

# Define the initialization function for the animation   

def init():   

   line1.set_data([], [])   

   line2.set_data([], [])   

   return line1, line2   

# Define the update function for the animation   

def update(frame):   

   line1.set_data(x[:frame], data1[:frame])   

   line2.set_data(x[:frame], data2[:frame])   

   return line1, line2   

# Create the animation using FuncAnimation   

frames = len(x)   

animation = FuncAnimation(fig, update, frames=frames, init_func=init, blit=True)   

# Display the animation or save it to a file (optional)   

plt.legend()   

plt.xlabel('X-axis')   

plt.ylabel('Y-axis')   

plt.title('Animated Line Chart with Different Colors')   

plt.show()   

   

This code makes a line chart that shows two datasets using different colors. You can customize the colors, data, and other properties per your requirements. To add more datasets, make new line objects and update their data in the update function.   

  

Can FuncAnimation be used to animate 3D objects and 2D shapes in Python?  

Yes, 'FuncAnimation' can animate both 3D objects and 2D shapes. But 'FuncAnimation' is a part of the Matplotlib library. It is primarily known for 2D plotting. Matplotlib's 3D plotting toolkit makes 3D objects, and visualizations come to life.  

  

Are there any tips or tricks to improve creating animations with Python libraries?  

To improve your animations, follow these helpful tips and tricks for efficient engineering. Here are some valuable tips to help you with it:  

  • Plan your animation  
  • Keep it simple  
  • Use subplots  
  • Choose the right library  
  • Optimize data processing  
  • Minimize redrawing  
  • Control animation speed  
  • Add labels and annotations  
  • User color thoughtfully  
  • Consider interactivity  
  • Test on a smaller subset  

  

Can I find open-source projects to practice coding with a Python animation library?  

Yes, there are many open-source projects available that use Python animation libraries. These resources help you practice animation libraries before starting your own project. Here are some places where you can find such projects:  

  • Matplotlib Examples Gallery  
  • GitHub Repositories  
  • Plotly Examples Gallery  
  • Kaggle Notebooks  
  • Bokeh Examples Gallery  
  • Data Science Blogs  
  • YouTube Tutorials 

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 contains 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.

Python accounting provides software components. It enables powerful features like invoice generation, tax management, tax reminders, and risk management. 


Python development is ideal for analytics tools because of its gentle learning curve, flexibility, and open-sourced environment. It helps you build applications of many specializations, like machine learning, data analysis, financials, and cloud computing. Accountants can perform financial modeling in quantitative finance and tax solutions. A Python package enables the effective analysis of big data sets, large lists of numbers, and major financial data. You can also use these accounting libraries to simplify data visualization and statistical calculations. It makes working with invoices and structured data easier.


Below are our 16 best Python accounting open-source libraries in 2021. InvoiceNet is a deep neural network that can view PDF, JPG, and PNG invoices and extract intelligent information from them. You can train custom models, add or remove fields, and save the extracted information to your system. Another library, Rotki, is a portfolio tracking, analytics, accounting, and tax reporting application that works in the crypto and financial sectors and protects your privacy. On the other hand, LNbits is a free and open-source wallet or accounts system that has unique API keys for each wallet. It has a lightning-network functionality via LNbits extension framework.

erpnext  

  • Integrated Enterprise Resource Planning (ERP) system with modules for various business functions.  
  • Supports multi-currency and multi-language capabilities.  
  • Offers features for managing accounts, inventory, sales, and more.  

InvoiceNet  

  • Utilizes deep learning to extract structured information from invoices.  
  • Can handle invoices in various languages and formats.  
  • Provides a pre-trained model for invoice data extraction.  

beancount  

  • A double-entry accounting tool that uses plain text files for data entry.  
  • Provides powerful support for handling complex financial transactions.  
  • Offers extensibility through plugins and scripting.  

timestrap  

  • Specialized time tracking and invoicing system.  
  • Allows for flexible project and task management.  
  • Generates invoices directly from time entries.  

rotki  

  • Cryptocurrency portfolio tracker with support for many exchanges and wallets.  
  • Provides tax reporting and accounting features for crypto assets.  
  • Offers real-time price data and portfolio performance metrics.  

django-userena  

  • A customizable user management system for Django web applications.  
  • Supports user profiles, account activation, and more.  
  • Provides an extensible framework for authentication and user registration.  

fava  

  • A web interface for Beancount, designed for easy financial data visualization.  
  • Offers interactive charts and graphs for financial analysis.  
  • Supports custom reporting and budget tracking.  

invoice2data  

  • A Python library for extracting structured data from invoices.  
  • Supports many invoice formats and templates.  
  • Can output data in various formats, including JSON and CSV.  

QRLJacking  

  • A security tool for testing QR code-based attacks.  
  • Demonstrates vulnerabilities related to QR code authentication.  
  • Raises awareness about the potential risks of QR code usage.  

receipt-parser  

  • A Python library for parsing receipt data from images or scanned documents.  
  • Extracts key information such as dates, items, prices, and taxes.  
  • Can use it for expense tracking and accounting.  

django-ledger  

  • A Django-based double-entry accounting system.  
  • Provides a user-friendly web interface for managing financial data.  
  • Supports many currencies and account types.  

koalixcrm  

  • A CRM (Customer Relationship Management) system tailored for small and medium-sized businesses.  
  • Offers features for managing contacts, sales, and projects.  
  • Provides a customizable workflow engine.  

lnbits  

  • A Lightning Network wallet and application platform for Bitcoin.  
  • Supports Lightning Network payments and microtransactions.  
  • Offers a user-friendly interface for managing Lightning wallets.  

django-hordak  

  • A double-entry accounting library for Django web applications.  
  • Provides a Django-friendly API for managing financial data.  
  • Supports ledger-style accounting and reconciliation.  

bookkeeper  

  • A financial ledger and accounting tool.  
  • Offers double-entry bookkeeping capabilities.  
  • Supports importing data from various formats, including CSV and QIF.  

django-invoice  

  • A Django app for creating and managing invoices.  
  • Provides features for invoice generation, tracking, and payment.  
  • Offers customizable invoice templates and PDF generation.  

FAQ:  

1. Which data sources can data scientists use in Python accounting libraries?  

Data scientists who use accounting libraries can access many data sources in Python. You can find information in files, databases, web scraping, and market data providers. Data scientists study financial data from different sources to fully understand it.  


2. Which Python Libraries are most commonly used when working with financial data?  

The most used Python libraries for financial data are Pandas and NumPy. Pandas are great for manipulating and analyzing data, especially financial data. It helps clean, transform, and organize the data. NumPy is great for financial numerical computations. It supports operations on arrays, matrices, and multidimensional data. Together, Pandas and NumPy form a powerful duo for financial data analysis.  


3. What data types can the Python Library Numpy import and manipulate?  

Financial data scientists find NumPy invaluable because it can handle all data types. This software works with numbers and helps with organizing and changing data sets. You can easily import financial data into NumPy arrays for analysis and computation.  


4. How can a Data Scientist best use financial market datasets?  

Data scientists should employ a multifaceted approach to harness financial market datasets. To understand data, we clean and structure it. We analyze time series to find trends. We use machine learning for forecasting and risk assessment. We use data visualization to show insights. These methods help data scientists make smart decisions and achieve financial success.  


5. Can people use Python in an open source project to make their accounting apps?  

Users can create their accounting apps with Python using open-source projects. Notable examples include "Ledger" and "Beancount." These libraries form a base for double-entry accounting and financial management. You can adjust them to fit specific accounting requirements. You can customize your accounting solutions and enjoy the open-source community's contributions.  


6. Is Django better than other frameworks for creating Accounting Apps with Python?  

Django is a web framework that helps with developing accounting applications. It has advantages and can integrate Python libraries. It excels in providing a robust and secure foundation for web-based financial tools. Django offers built-in features for user authentication, data security, and efficient database management. You can use Python libraries to create secure and user-friendly accounting applications. They are scalable, modular, and great for financial data analysis and management. 

Python is an indispensable tool for many programmers. With it, you can do away with all the repetitive and tedious work involved with other scripting languages.

For a technical process like form validation, with Python, you can ensure that the input text is in the correct format (including both after submitting and inline validation). Hence, when you build an application that accepts user input, you can verify that the data that enters your application is valid, consistent, and secure with various open-source Python libraries.


Here we list down some of those libraries which are useful for form validation. Say, with pydantic, you can define custom data types, parse input data, and then validate it. Using type hints, the library can even coerce input data to the declared types and accumulate errors using ValidationError. pydantic is also easily discoverable given how well it has been documented. Another application, Django-crispy-forms helps you manage Django forms by allowing you to adjust their properties (say, CSS classes, send button, etc.) on the backend. This means you no longer have to rewrite anything in the template. We also have Formspree, which is a backend, API, and email service for HTML and JavaScript forms. It is secure with a honeypot to prevent spam and is the simplest way to embed customized order forms, “Contact Us” forms, and dialogue boxes meant to capture email.

pydantic:  

  • It is a popular Python library for data validation and parsing.  
  • It allows you to define the expected types of data for each field in your form.   
  • It ensures that the data you receive conforms to your expectations.  

marshmallow:  

  • It is a library used for data serialization and deserialization. It can also handle form validation.  
  • It provides a way to define data schemas and confirm input data against those schemas.  
  • Offers features for input validation, data normalization, and data serialization/deserialization. 

django-crispy-forms:  

  • It is a popular Python library. It helps in form rendering and form management in Django web applications.   
  • It provides a cleaner and more elegant way to render forms in HTML.  
  • It helps ensure that forms in Django app. It has a consistent and professional appearance. 

connexion:  

  • This can be crucial for various reasons, particularly when developing web applications.   
  • It allows you to enforce specific business rules and logic.  
  • It ensures that data conforms to the requirements of your application.

formspree:  

  • It allows you to create and manage web forms for your website.  
  • It takes security and provides features to help protect against spam and abuse. It includes CAPTCHA support.  
  • It allows you to collect and store data from your forms.  

sqlparse:  

  • It provides parsing and formatting capabilities for SQL statements.  
  • It can format SQL queries to make them more readable.  
  • It helps in analyzing the structure of SQL queries.  

cerberus:  

  • It is a lightweight and extensible data validation library for Python.  
  • It confirms data structures, including data submitted via forms.  
  • It allows you to define validation rules using a simple and flexible schema.

schema:  

  • It defines the structure and constraints of the data that your forms should accept.  
  • It helps in detecting and reporting errors in user-submitted data.  
  • This makes it easier to maintain and update your form validation rules.  

SublimePrettyJson:  

  • It is a Sublime Text plugin designed to format and prettify JSON data.  
  • It makes JSON data more human-readable. It does so by organizing it in a structured and indented format.  
  • It can improve a developer's productivity by automating the formatting process.  

django-widget-tweaks:  

  • It simplifies the rendering and customization of form widgets.  
  • It allows you to customize the rendering of form widgets in your HTML templates.  
  • It simplifies the template code required to render form elements. This makes it more readable and maintainable.  

pandera:  

  • It helps ensure the quality and integrity of your data.  
  • Ensure data by specifying validation rules and constraints on your datasets. 
  • Use it alongside other data libraries and tools like pandas.

wtforms:  

  • WTForms is a form validation library used for Flask web applications.  
  • It provides a simple and flexible way to define forms as Python classes and confirm them.  
  • Supports various field types and allows you to define custom validation functions.  
  • Offers CSRF protection and integration with popular web frameworks.

ohmyform:  

  • It simplifies the process of validating user input in web applications.  
  • It aims to be a lightweight and straightforward library.  
  • It allows you to define your custom validation rules and error messages.  

django-simple-captcha:  

  • It is a third-party library for Django, a popular Python web framework.  
  • It provides a simple and effective way to add CAPTCHA protection to your web forms.  
  • It is customizable and integrated into your Django forms.  

django-phonenumber-field:  

  • It is a useful library in Python for form validation.   
  • It is especially used when dealing with phone numbers in Django web applications.  
  • It is a valuable library for managing and validating phone numbers in Django apps.  

brigadier:  

  • It is a Python library. The brigadier has no bugs or vulnerabilities.  
  • It has a Permissive License, and it has a medium support.  
  • It fetches and installs Boot Camp ESDs with ease.  

django-money:  

  • It helps to manage money-related fields and calculations in Django apps.  
  • It provides tools for handling currency and monetary values.  
  • It supports Decimal-based arithmetic, which is crucial for accurate financial calculations.  

django-smart-selects:  

  • It provides an enhancement to form validation.  
  • It enables you to create dynamic select fields in your forms.  
  • It is open-source and has an active community.

awesome-fraud-detection-papers:  

  • It is a curated list of research papers and resources related to fraud detection.  
  • In the context of Python, form validation libraries would depend on the specific use case.  
  • They help prevent common issues. Those issues are SQL injection, cross-site scripting, and other security vulnerabilities.

django-recaptcha:  

  • It is an important library for form validation in Python, particularly in Django web apps.  
  • It helps protect your web forms from automated bots and spam by adding a CAPTCHA challenge.  
  • It works with Django forms, making it easy to integrate and use in your web applications.  

data-validation:  

  • It is a crucial aspect of form validation in Python libraries.  
  • It helps protect your application from various security vulnerabilities. Those are such as SQL injection and XSS attacks.  
  • Validating user input at the form level provides a better user experience.   

pyforms:  

  • It is a Python framework for developing desktop applications and GUIs.  
  • It simplifies the creation of GUI applications by providing a high-level, Pythonic interface.  
  • It works on many platforms, including Windows, macOS, and Linux.

enforce:  

  • It contains pre-written code, functions, and modules.  
  • Using libraries can speed up development, as you don't need to reinvent the wheel for common tasks.  
  • It can help standardize practices and promote best practices in software development.

UhOh365:  

  • It is a Python library used in Utilities applications.  
  • UhOh365 has a low active ecosystem.  
  • A script that can see if an email address is valid in Office365. 

ystockquote:  

  • ystockquote is a Python library used in Web Site, Business applications.  
  • You can install using 'pip install ystockquote' or download it from GitHub, PyPI.  
  • It fetches stock quote data from Yahoo Finance. 

django-formtools:  

  • It includes a Form Wizard, which is a powerful tool for handling multi-step forms.  
  • It provides more control over the form-handling process.  
  • The above process enables custom logic to insert between form steps.  

validate_email:  

  • It helps in form validation libraries to ensure that an email address entered by a user is valid.  
  • Validating email addresses helps maintain the integrity of the data collected through forms.  
  • It is a crucial step in preventing common security vulnerabilities. 

typesystem:  

  • Type systems help ensure that data is in the expected format and adheres to specific data types.  
  • Type hints make the code more readable.  
  • It can be especially beneficial when working on a team or maintaining code over time.  

FAQ 

1: What is a Python form validation library?  

A Python form validation library is a tool that helps developers confirm user input in web forms. It ensures that the data entered by users to specified rules and constraints. Implementing validation rules and constraints actively prevents the application from processing malicious data. 

   

2: Why should I use a form validation library in Python?  

Using a form validation library is important to maintain data integrity and security. It helps prevent common issues. Those are like data type mismatches, SQL injection, and XSS attacks. This ensures that user input is safe and valid.  

   

3: Which Python form validation libraries are used?  

There are several popular Python form validation libraries, including:  

  • WTForms: A used library for form validation and rendering in Flask. It is also used in other Python web frameworks.  
  • Django Forms: Built-in form handling in the Django web framework.  
  • Marshmallow: It is a library for object serialization and deserialization. It is often used for form validation in web APIs.  
  • FormEncode: A library for validating and converting form data.  
  • Validictory: A lightweight JSON validation library that helps with form validation.  

4: How do I install a Python form validation library?  

You can usually install Python form validation libraries using package managers like pip. For example, you can install WTForms with the command pip install WTForms.  

   

5: How do I use a Python form validation library in my web application?  

Each library has its own documentation and usage guidelines. Generally, you'll define a form class with fields and validation rules. Then render the form in your template, and then confirm user input using the library's methods.  

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.

Add functionalities such as building tables, data grids, and interactive data visualizations into your application easily and in a visually appealing way with the Python table libraries.


Python table libraries are highly useful in advanced applications with data management functions such as analytics, data science, and machine learning. Using these libraries, you can represent data in an organized manner while controlling and customizing various aspects of a table. These include:

  • width and column padding
  • text alignment
  • data sorting
  • table borders, and more.


These libraries also provide a large number of predefined formats that allows you to publish tables in different ways. Also, you can format the tables to publish on popular project management software such as Jira and GitHub.


Explore the top and trending Python table libraries to add table formatting features in your applications:

prettytable  

  • Supports custom table formatting and styling.  
  • Allows adding, deleting, and rearranging columns easily.  
  • Provides a simple way to display tabular data in a text-based interface.  

pytablewriter  

  • Supports various file formats for table export (CSV, Excel, JSON, etc.).  
  • Allows fine-grained control over cell alignment and formatting.  
  • Offers an intuitive and extensible API for creating and writing tables.  

python-tabulate  

  • Provides multiple table styles and formatting options.  
  • Supports data alignment, numbering, and various output formats.  
  • Can render tables as plain text or HTML for different use cases.  

dataset  

  • Offers a simplified interface for working with databases.  
  • Supports data loading, querying, and manipulation with minimal code.  
  • Provides a consistent API across different database backends.  

camelot  

  • Specialized for extracting tables from PDF documents.  
  • Supports both text-based and image-based table extraction.  
  • Offers advanced table configuration options for precise extraction.  

pdftabextract  

  • Designed for OCR-based table extraction from scanned PDFs.  
  • Provides tools for layout analysis and structured table data extraction.  
  • Useful for digitizing tabular information from documents.  

django-tables2  

  • Integrates seamlessly with Django web applications.  
  • Offers a declarative syntax for defining table structures.  
  • Supports sorting, pagination, and customization of table rendering.  

django-watson  

  • A full-text search library for Django applications.  
  • Provides efficient search functionality across multiple models.  
  • Supports stemming, ranking, and result highlighting.  

petl  

  • A powerful library for ETL (Extract, Transform, Load) operations on tabular data.  
  • Offers a wide range of data manipulation functions.  
  • Integrates well with other data processing libraries like pandas.  

csvtotable  

  • Converts CSV data into an interactive HTML table.  
  • Supports data sorting, filtering, and pagination in the web interface.  
  • Suitable for quickly visualizing and exploring CSV data.  

textfsm  

  • A template-based text parsing library.  
  • Used for extracting structured data from unstructured text.  
  • Commonly used for parsing network device configuration files.  

rows  

  • A minimalistic library for working with tabular data.  
  • Provides basic data manipulation and serialization capabilities.  
  • Lightweight and easy to use for simple table operations.  

image2csv  

  • Converts images containing tabular data into CSV format.  
  • Useful for digitizing data from scanned documents or images.  
  • Supports customization of image preprocessing and OCR options.  

csvtomd  

  • Converts CSV data into Markdown tables for documentation.  
  • Supports alignment and column formatting in Markdown.  
  • Useful for generating human-readable documentation from CSV data.  

Pylsy  

  • Creates pretty ASCII tables with cell alignment.  
  • Offers easy customization of table styling and formatting.  
  • Suitable for displaying tabular data in console applications.  

jupyter_pivottablejs  

  • Integrates with Jupyter Notebook for interactive pivot table creation.  
  • Allows users to explore and analyze data with a graphical interface.  
  • Supports aggregation, filtering, and dynamic table manipulation within Jupyter notebooks.  

FAQ 

1. What Python libraries are available for data visualization?  

Python boasts a plethora of libraries for data visualization. Some popular ones include Matplotlib, Seaborn, Plotly, and Bokeh. Each tool has different features and abilities. Analysts and scientists use this to make charts and graphs and study data better.  

  

2. How can a Python data visualization library help someone in a Data Science Career?  

Employing a Python data visualization library is instrumental in a Data Science career. It enables professionals to convey complex data findings in a visually comprehensible manner. This helps with decision-making using data and sharing insights to improve business results.  

  

3. Which software do you need to run the PrettyTable library?  

You do not need additional software to use the PrettyTable library in Python. This Python library can be easily added to Python scripts or projects. It doesn't require any external dependencies.  

  

4. Is there a machine learning library available for Python?  

Python has many machine learning libraries, and scikit-learn is a popular one. Python is a flexible platform for machine learning. It has powerful libraries like TensorFlow, PyTorch, and Keras. These libraries cater to deep learning and neural networks.  

  

5. How does one learn Python, and which libraries should they focus on first?  

Learning Python begins with grasping the fundamentals of the language. To become a programmer, start by learning libraries like NumPy and Pandas. These will help you manipulate data. Once you feel comfortable, you can use Matplotlib and Seaborn to visualize data. To delve into machine learning, starting with scikit-learn is advisable. Online tutorials, courses, and hands-on projects help you learn Python and its libraries. 

DESCRIPTION:


Language Translation with T5 Transformer


The Language Translation endeavor involves a natural language processing challenge focused on utilizing the T5 Transformer model to achieve text translation between different languages. Developed by Google Research, T5 (Text-to-Text Transfer Transformer) is a highly adaptable model that proves valuable across a range of text-based tasks, including language translation.


To accomplish this project, the Hugging Face's transformers library is harnessed, offering pre-trained transformer models, tokenizers, and utilities essential for seamless natural language processing tasks. Within this particular implementation, the T5 model takes center stage, demonstrating its prowess in the art of translation.

DEPENDEND LIBRARIES USED:


Install transformers using pip:


transformers: Developed by Hugging Face, this library offers pre-trained models designed for Natural Language Processing tasks, such as translation. It also comes equipped with tokenizers and utilities to facilitate seamless interaction with these models.

Solution Screenshot:

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.


Precision and recall are two commonly used metrics for evaluating the performance of a classification model. Precision measures the accuracy of the positive predictions, while recall measures the ability of the model to identify all relevant positive samples. y_true is the list of true labels and y_pred is the list of predicted labels. The precision_score and recall_score functions calculate the precision and recall, respectively


Precision is the fraction of true positive predictions out of all positive predictions made. It Measures the accuracy of the positive predictions 

recall is the fraction of true positive predictions out of all actual positive cases. It measures the completeness of the positive predictions 


  • Confusion_matrix: This function generates a confusion matrix given true labels and predicted labels.
  • precision_score: This function calculates the precision score of a classification model given true labels and predicted labels.
  • recall_score: This function calculates the recall score of a classification model given true labels and predicted labels.
  • These libraries and functions can be used to evaluate the performance of a classification model.


Here is the example of how we can find the Precision score and recall score using Sk-learn.

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

Code

In this solution we have used Scikit-Learn

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


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


I found this code snippet by searching for "Need help finding the precision and recall for a confusion matrix" in kandi. You can try any such use case!

Dependent Library

Environment Tested

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


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


Using this solution, we are able going to learn how to Finding the precision and recall for a confusion matrix in python using Scikit learn library in Python with simple steps. This process also facilities an easy to use, hassle free method to create a hands-on working version of code which would help Finding the precision and recall for a confusion matrix in Python.

If you do not have Scikit-learn 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 Scikit-learn page in kandi.

You can search for any dependent library on kandi like Scikit-learn. 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.


In Python text can be represented using many colors. we have some Python libraries for colors and formatting in the terminal. The programmer gets better by printing colored texts. Colorama is a Python library that makes it easy to add color to your text in the terminal. 


Colorama is designed to work on Windows, macOS, and Linux, and provides a simple and consistent interface for adding color to your text output. With Colorama, you can add ANSI escape sequences to your text to specify its color, background, and formatting, making it easier to create colorful and attractive terminal-based applications. The library provides several modules, such as Fore, Back, and Style, which allow you to specify the text color, background color, and formatting, respectively. Some of the formatting options supported by Colorama include bright, dim, normal, bold, and underlined. Colorama also supports 256-color mode, which provides a wider range of colors compared to the basic 8-color mode.


termcolor supports a range of colors, including red, green, yellow, blue, magenta, cyan, and white, as well as a number of formatting options, such as bold, dim, and underlined. The library is easy to use and provides a simple and intuitive interface for adding color to your text in the terminal.


Here are examples for printing color in a terminal.

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

Code

In this solution we have used Colorama library from python

  1. Copy this code using "Copy "button above and paste it in your python file IDE
  2. Add Colorama Library to run this code
  3. Run the code to get the texts coloured.


I hope you found this useful i have added the Dependent libraries , versions in the following sections


I have searched using "Add text Color while print" in Kandi. you can try any use case

Dependent Library

If you don't have this colorama and termcolor Library that required to run this code. You can install by clicking the above link and copying the pip install command from the Colorama page in Kandi. You can search any Library Like colorama and termcolor in kandi

Environment Test

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


  1. This solution is created and executed in Python 3.7.15 version
  2. This solution is tested on Colorama 0.4.6 version
  3. This solution is tested on termcolor 2.1.1 version


Using this solution we able to change the style , color, Brightness of the Text in Terminal using Colorama 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 color the text 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.

Converting RGB to YCbCr can provide better results for image and video compression, color space conversions, and HDR processing.  There are several reasons why we might need to convert RGB to YCbCr


Compression efficiency: YCbCr provides better compression results compared to RGB, especially in preserving image quality after compression. This is because the human visual system is more sensitive to changes in brightness (luma, Y) than to changes in color (chroma, Cb and Cr). Color space conversion: Some image processing tasks, such as color correction and color space conversion, may require transforming the image from one color space to another. For example, many image sensors capture the image in the YCbCr color space, and it may be necessary to convert it to RGB for display purposes. 


OpenCV (Open Source Computer Vision Library) is an open-source and machine-learning software library. OpenCV is a computer vision library written in C++ and widely used for image and video processing. OpenCV provides a vast array of image and video processing functions that can be used in various domains such as:


  • Object detection and recognition
  • Image and video segmentation
  • Face and feature detection
  • Object tracking
  • Image restoration and enhancement
  • Stereoscopic vision
  • Motion analysis and object tracking
  • 3D reconstruction


RGB and YCbCr are color spaces used in digital image processing.


RGB stands for Blue, Green, Red, and is an encoding of the RGB (Red, Green, Blue) color space. BGR is used in computer vision and image processing applications and is the default color format for the OpenCV library in Python.


YCbCr, on the other hand, stands for Luma (Y) and Chrominance (Cb, Cr), and is a color space used in digital video processing. YCbCr separates the brightness information (luma) from the color information (chroma), which allows for more efficient compression. YCbCr is used in many image and video compression standards, such as JPEG and MPEG. In summary, BGR is used in computer vision and image processing, while YCbCr is used in video processing and compression.


In this solution, we are going to learn how to convert the RGB image to YcbCr 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. Import open Cv library and numpy library
  3. Modify the name, and location of the image in the code.
  4. Run the file to get the Output


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


i found this code snippet by searching for "OpenCV Python converting color-space image to YCbCr" in kandi. You can try any such use case!


Note:-


If the user wants to Display the output use this command

cv2.imshow('after', YCrbCrImage)

cv2.waitkey(0)

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 going to convert BGR image to YCBCR 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 convert BGR to YCBCR 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.

In Python, the "where" condition is used in conjunction with Boolean indexing to filter the elements of an array, list, or DataFrame based on a specific condition. The condition is specified as a Boolean expression, and the elements that satisfy the condition are kept while the elements that do not are removed. 


You can fetch the value of a particular column with a WHERE condition using a “SQL SELECT” statement. 

  • SQL SELECT: Using the SQL SELECT command, you may query a database and get specified data from one or more of its tables. 

In the WHERE clause, you may also include several criteria by using logical operators like "AND," "OR," etc.  

  • AND: In a WHERE clause, several criteria can be combined using the SQL AND statement. When all criteria are true, rows from a table are returned using the AND statement. 
  • OR: In a WHERE clause, multiple conditions can be combined using the SQL OR statement. When at least one of the requirements is true, the OR statement is used to get rows from a table. 


For better knowledge of fetching the value of a particular column with where condition, you may have a look at the code below. 

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

Code

In this solution we're using Pandas and NumPy libraries.

Instructions

Follow the steps carefully to get the output easily.

  1. Install pandas on your IDE(Any of your favorite IDE).
  2. Copy the snippet using the 'copy' and paste it in your IDE.
  3. Add required dependencies and import them in Python file.
  4. Run the file to generate the output.


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


I found this code snippet by searching for 'How to fetch value of particular column with where condition in pandas' 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 PyCharm 2021.3.
  2. The solution is tested on Python 3.9.7.
  3. Pandas version-v1.5.2.
  4. NumPy version-v1.24.0.


Using this solution, we are able to fetch value of particular column with where condition in pandas 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 fetch value of particular column with where condition in pandas.

Dependent Libraries

You can also search for any dependent libraries on kandi like 'pandas' 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.


We will locate a specific group of words in a text using the SpaCy library, then replace those words with an empty string to remove them from the text.  


Using SpaCy, it is possible to exclude words within a specific span from a text in the following ways:  

  • Text pre-processing: Removing specific words or phrases from text can be a useful step in pre-processing text data for NLP tasks such as text classification, sentiment analysis, and language translation.  
  • Document summarization: Maintaining only the most crucial information, specific words or phrases will serve to construct a summary of a lengthy text.  
  • Data cleaning: Anonymization and data cleaning can both benefit from removing sensitive or useless text information, such as names and addresses.  
  • Text generation: Adding context or meaning to the generated content might help create new text by deleting specific words or phrases.  
  • Text augmentation: Text can be used for text augmentation techniques in NLP by removing specific words or phrases and replacing them with new text variations.  


Here is how you can remove words in span using SpaCy:  

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

Code

In this solution we have used spacy library of python

  1. Copy the code using the "Copy" button above, and paste it in a Python file in your IDE.
  2. Enter the Text
  3. Run the code that Remove Specific words in the text


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 "Remove words in span from spacy" in kandi. You can try any such use case!


Note


In this snippet we are using a Language model (en_core_web_sm)

  1. Download the model using the command python -m spacy download en_core_web_sm .
  2. paste it in your terminal and download it.


Check the user's spacy version using pip show spacy command in users terminal.

  1. if its version 3.0, you will need to load it using nlp = spacy.load("en_core_web_sm")
  2. if its version is less than 3.0 you will need to load it using nlp = spacy.load("en")

Environment Tested

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


  1. The solution is created in Python 3.7.15 Version
  2. The solution is tested on Spacy 3.4.3 Version


Using this solution, we can collect nouns that ends with s-t-l with the help of function in spacy . This process also facilities an easy to use, hassle free method to create a hands-on working version of code which would help us use full stop whenever the user needs in the sentence in python.

Dependent Library

If you do not have SpaCy 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 Spacy page in kandi.

You can search for any dependent library on kandi like SpaCy 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

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