error in ./resources/assets/sass/app.scss

If you are getting this error (error in ./resources/assets/sass/app.scss) in Node module please follow some steps which is have mentioned in the following

Error:-

Many of you get this error when you did not change anything in app.scss, but when I run npm run watch I get the following errors:

 error  in ./resources/sass/app.scss                                                                      

Module build failed (from ./node_modules/sass-loader/lib/loader.js):                                      
Unsupported operation: Cannot extract a file path from a URI with a fragment component                    

@ ./resources/sass/app.scss 2:14-254                                                                     

    Asset      Size   Chunks             Chunk Names                                                     
/js/app.js  2.46 MiB  /js/app  [emitted]  /js/app                                                         

ERROR in ./resources/sass/app.scss                                                                        
Module build failed (from ./node_modules/css-loader/index.js):                                            
ModuleBuildError: Module build failed (from ./node_modules/sass-loader/lib/loader.js):                    

undefined                                                                                                 
      ^                                                                                                  
      Join(null, "variables"): part 0 was null, but part 1 was not.                                       
@import 'variables';                                                                                      
        ^^^^^^^^^^^                                                                                       
  stdin 2:9  root stylesheet                                                                              
      in C:\Users\TAQI VAHEED\Desktop\#Coding\resPro\resources\sass\app.scss (line 2, column 9)           
    at runLoaders (C:\Users\TAQI VAHEED\Desktop\#Coding\resPro\node_modules\webpack\lib\NormalModule.js:30
    at C:\Users\TAQI VAHEED\Desktop\#Coding\resPro\node_modules\loader-runner\lib\LoaderRunner.js:364:11  
    at C:\Users\TAQI VAHEED\Desktop\#Coding\resPro\node_modules\loader-runner\lib\LoaderRunner.js:230:18  
    at context.callback (C:\Users\TAQI VAHEED\Desktop\#Coding\resPro\node_modules\loader-runner\lib\Loader
13)

Solution:-

The main issue which we have found that is related to dart-sass being used instead of node-sass with laravel

You have to just follow one step:-

Step 1:- You have to run this Command and all the things will solve .

npm install node-sass

Tagged : / / / / / / / / / /

‘cross-env’ is not recognized as an internal or external command, operable program or batch file.

Hey if you are getting some error like (‘cross-env’ is not recognized as an internal or external command, operable program or batch file.) in your Node please follow the steps which i have mentioned in following:-

You need to make cross-env working globally instead of having it in the project.

Step 1:- remove node_modules folder

Step 2:-  run this Command so that you cross-env work globally.

npm install --global cross-env

Step 3:- Remove “cross-env”: “5.0.1” from the devDependencies section of the package.json file. You may actually skip this step and keep package.json. If you’d want.

Step 4:- Then run this command.

npm install --no-bin-links

Step 5:- After this finally you can run your main command

npm run dev

Tagged : / / / / / / /

Insert( ) Method in JavaScript

The insertBefore() method is used to insert a node before the reference node as a child of a specified parent node. If the given child is a reference to an existing node in the document, insertBefore( ) moves it from its current position to the new position.

If referenceNode is null, the newNode is inserted at the end of the list of child nodes.

Syntax: –

parentNode.insertBefore(newNode, referenceNode);

insertAdjacentElement ( ) Method

The insertAdjacentElement() method inserts the specified element into a given specified position. It returns the element that was inserted, or null if the insertion failed.

Syntax:-

element – The element to be inserted into the tree.
The beforebegin and afterend positions work only if the node is in a tree and has an element parent.

insertAdjacentHTML ( ) Method

The insertAdjacentHTML() method is used to insert a text as HTML (parses the specified text as HTML or XML) into a specified position.

Syntax:-

text – The string to be parsed as HTML or XML and inserted into the tree.
It is recommended you not use insertAdjacentHTML when inserting plain text instead, use the node.textContent property

insertAdjacentText ( ) Method

The insertAdjacentText() method inserts the specified element into a specified position.

Syntax:-

text – The text which is about to insert.
The beforebegin and afterend positions work only if the node is in a tree and has an element parent.

Tagged : / / / /

How is Node.js created with JavaScript?

Creating Nodes

  • createElement(element_name)
  • createTextNode(string)
  • createComment(string)
  • createDocumentFragment( )

Create Element Node

The createElement(element_name) method is used to create the HTML element specified by tagName, or an HTMLUnknownElement if tagName isn’t recognized. It returns the New Element.

Syntax:-
createElement(element_name)

Create Text Node

The createTextNode(string) method is used to create the Text Node with the specified text (string).

Syntax:-
createTextNode(string)

Create Comment Node

The createComment(string) method is used to create the Comment Node with the specified string and returns it.

Syntax:-
createComment (string)

Document Fragment

  • The DocumentFragment interface represents a minimal document object that has no parent.
  • A common use for Document Fragment is to create one, assemble a DOM subtree within it, then append or insert the fragment into the DOM using Node interface methods such as appendChild( ) or insertBefore( ).
  • Document fragment isn’t part of the active document tree structure, changes made to the fragment don’t affect the document.
  • Doing this moves the fragment’s nodes into the DOM, leaving behind an empty Document Fragment.
  • An empty Document Fragment can be created using the document.createDocumentFragment() method.

Create Document Fragment

The createDocumentFragment() method creates a imaginary Node object, with all the properties and methods of the Node object.

Tagged : / / / /

How To Traverse The DOM In JavaScript?

DOM Traversal

  • parentNode – Returns parent node
  • parentElement – Returns parent element node
  • childNodes – Returns collection of an element’s child nodes (including text and comment nodes)
  • children – Returns a collection of an element’s child element node (do not include text and comment nodes)
  • firstChild – Returns first child node of an element (it can be text or comment node)
  • firstElementChild – Returns first child element node of an element
  • lastChild – Returns last child node of an element (it can be text or comment node)
  • lastElementChild – Returns last child element node of an element
  • previousSibling – Returns previous node of the same level (it can be text or comment node)
  • previousElementSibling – Returns previous element node of the same level
  • nextSibling – Returns next node of same level (it can be text or comment node)
  • nextElementSibling – Returns next element of same level

parentNode and parentElement

The parentNode read-only property returns the parent of the specified node in the DOM tree.

The parentElement property returns the parent element of the specified element. If the parent node is not an element node, it returns null.

childNodes

The childNodes read-only property returns a live NodeList of child nodes of the given element where the first child node is assigned index 0. childNodes includes all child nodes, including non-element nodes like text and comment nodes.

  • Whitespace inside elements is considered as text, and text is considered as nodes.
  • Any whitespace will create a #text node, from a single space to multiple spaces, returns, tabs, and so on.
  • You can use the length property of the NodeList object to determine the number of child nodes, then you can loop through all child nodes and extract the other info.

children

The children property returns collection of child elements of the given element where the first child is assigned index 0. children include only element nodes (no whitespace, text node, and comment node).

  • You can use the length property of the NodeList object to determine the number of child nodes, then you can loop through all child nodes and extract the other info.

firstChild

The firstChild property returns the node’s first child in the tree, or null if the node has no children. If the node is a Document, it returns the first node in the list of its direct children. It includes a text node and a comment node.

  • Whitespace inside elements is considered as text, and text is considered as nodes.
  • Any whitespace will create a #text node, from a single space to multiple spaces, returns, tabs, and so on.

firstElementChild

The firstElementChild property returns the element’s first child element node in the tree, or null if the node has no children element. It ignores text node and comment node or any whitespaces.

lastChild

The lastChild read-only property returns the last child of the node. If its parent is an element, then the child is generally an element node, a text node, or a comment node. It returns null if there are no child elements.

  • Whitespace inside elements is considered as text, and text is considered as nodes.
  • Any whitespace will create a #text node, from a single space to multiple spaces, returns, tabs, and so on.

lastElementChild

The lastElementChild property returns the element’s last child element node in the tree, or null if the node has no children element. It ignores text node and comment node or any whitespaces.

previousSibling

The previousSibling read-only property returns the node immediately preceding the specified one in its parent’s childNodes list, or null if the specified node is the first in that list. It includes text node and comment node or any whitespace.

previousElementSibling

The previousElementSibling property returns the element node immediately preceding the specified one in its parent’s node list, or null if the specified node is the first in that list. It ignores the text node and comment node or any whitespace.

nextSibling

The nextSibling read-only property returns the node immediately following the specified one in its parent’s childNodes list, or null if the specified node is the last node in that list. It includes text node and comment node or any whitespace.

nextElementSibling

The nextElementSibling read-only property returns the element node immediately following the specified one in its parent’s node list, or null if the specified node is the last node in that list. It ignores the text node and comment node or any whitespace.

ownerDocument

The ownerDocument read-only property returns the top-level document object for this node. In HTML, the HTML document itself is always the ownerDocument of an element.

Tagged : / / /

How to Use CSS Selector in javascript?

querySelector(“CSS Selector”)

The method querySelector() returns the first Element match of the specified selector or group of selectors. If no matches are found, null is returned.

querySelectorAll(“CSS Selector”)

The method querySelectorAll() returns a static (not live) NodeList representing a list of the document’s elements that match the specified group of selectors.

  • The NodeList object represents a collection of nodes. The nodes can be accessed by index numbers. The index starts at 0.
  • You can use the length property of the NodeList object to determine the number of elements that matches the specified selector, then you can loop through all elements and extract the info you want.
  • If the specified selectors include a CSS pseudo-element, the returned list is always empty.

querySelectorAll(“CSS Selector”)

querySelectorAll(“CSS Selector”)

More specific

querySelectorAll(“CSS Selector”)

  • Length Property
  • Loop

innerHTML

The innerHTML property defines the HTML content.

Tagged : / / /

What is the Purpose of the Node Object Property in JavaScript

Properties of Node Object

The Node object represents a single node in the document tree.

  • nodeName
  • nodeValue
  • nodeType
  • textContent
  • parentNode
  • childNodes
  • firstChild
  • lastChild
  • previousSibling
  • nextSibling

nodeName

The nodeName read-only property returns the name of the current node as a string.

  • CDATASection “#cdata-section”
  • Comment “#comment”
  • Document “#document”
  • DocumentFragment “#document-fragment”
  • DocumentType The value of DocumentType.name
  • Element The value of Element.tagName
  • Entity The entity name
  • EntityReference The name of entity reference
  • Notation The notation name
  • ProcessingInstruction The value of ProcessingInstruction.target
  • Text “#text”

nodeValue

The nodeValue property returns or sets the value of the current node.

  • CDATASection content of the CDATA Section
  • Comment content of the comment
  • Document null
  • DocumentFragment null
  • DocumentType null
  • Element null
  • NamedNodeMap null
  • EntityReference null
  • Notation null
  • ProcessingInstruction entire content excluding the target
  • Text content of the text node

nodeType

The read-only Node.nodeType property represents the type of the node.

ConstantNode TypeDescription
Node.ELEMENT_NODE1An element such as <h1> or <div>
Node.TEXT_NODE3The actual Text of Element or Attribute ex: – “Hello”
Node.PROCESSING_INSTRUCTION_NODE7An instruction to a parser on aspect of the document <?xml version=“1.0”?>
Node.COMMENT_NODE8A comment such as < – – Something – – >
Node.DOCUMENT_NODE9A Document Node
Node.DOCUMENT_TYPE_NODE10A doctype statement <!DOCTYPE html>
Node.DOCUMENT_FRAGMENT_NODE11A document fragment, which represents a lightweight structure to hold a collection of DOM nodes for manipulation or insertion.

Tagged : / / / / /

How to Access an Element in HTML DOM using JavaScript?

Element Access Methods

MethodDescription
document.getElementById(“ID”)Get the element with the specified ID
document.getElementsByTagName(“Tag_Name”);Get all the specified element by the Tag Name
document.getElementsByClassName(“Class_Name”);Get all the specified element by the Class Name
document.querySelector(“CSS_Selector”);It returns the first match of the passed selector string
document.querySelectorAll(“CSS_Selector”);It returns a node list of DOM elements that match the query

getElementById(“ID_Name”)

The method getElementById(“ID_Name”) returns an Element object representing the element whose id property matches the specified string. Since element IDs are required to be unique if specified, they’re a useful way to get access to a specific element quickly.

getElementsByTagName(“Tag_Name”)

The method getElementsByTagName(“Tag_Name”) returns a live node list meaning that it updates itself with the DOM tree automatically, so modification of the DOM tree will be reflected in the returned collection. The returned Node List or Collection of Nodes can be accessed by index numbers starting with index 0.

  • This method accepts a string indicating the type of elements that be retrieved, a special value “ * ” returns all elements in the documents.
  • You can use the length property of the NodeList object to determine the number of elements with the specified tag name, then you can loop through all elements and extract the info you want.

getElementsByTagName(“Tag_Name”)

getElementsByTagName(“Tag_Name”)

More specific

getElementsByTagName(“Tag_Name”)

  • Length Property
  • Loop

getElementsByClassName(“Class_Name”)

The Method getElementsByClassName() returns a live node list meaning that it updates itself with the DOM tree automatically, so modification of the DOM tree will be reflected in the returned collection. The returned Node List or Collection of Nodes can be accessed by index numbers starting with index 0.

•This method accepts string indicating the class name of elements that be retrieved •

We can also pass multiple class name. For matching, all the class names should match. •You can use the length property of the NodeList object to determine the number of elements with the specified class name, then you can loop through all elements and extract the info you want.

  • This method accepts string indicating the class name of elements that be retrieved
  • We can also pass multiple class name. For matching, all the class name should match.
  • You can use the length property of the NodeList object to determine the number of elements with the specified class name, then you can loop through all elements and extract the info you want.

getElementsByClassName(“Class_Name”)

getElementsByClassName(“Class_Name”)

More specific

getElementsByClassName(“Class_Name”)

  • Length Property
  • Loop
Tagged : / / /

What is the use of the document object model in JavaScript?

Document Object Model

  • The Document Object Model (DOM) is an Application Programming Interface (API) for HTML and XML documents.
  • With the Document Object Model, programmers can create and build documents, navigate their structure, and add, modify, or delete elements and content.
  • The DOM is an object-oriented representation of the web page, which can be modified with a scripting language such as JavaScript.
  • The DOM model represents a document with a logical tree.
  • According to Document Object Model (DOM), every HTML-tag is an object. Nested tags are called “children” of the enclosing one. All operations on the DOM start with the document object. From it, we can access any node.
  • The Document Object Model can be used with any programming language.

DOM Levels

  • DOM Level 0 – This level supports the common document object collections – form[ ], image[ ], anchors[ ], links[ ] and applets[ ]. This is also known as classic or traditional JavaScript Object Model. •
  • DOM Level 1- It provides the ability to manipulate all elements in a document through a common set of functions. In this level, all elements are exposed and parts of the page can be read and written to at all times.
  • DOM Level 2 – It provides further access to page elements primarily related to CSS and focuses on combining Level 0 and Level 1 while adding improved support for working with XML documents.

DOM Levels

  • DOM Level 3 – Enhanced Level of Level 1 and Level 2 and added support for XPath and keyboard event handling.
  • DOM Level 4 – Enhanced  year 2015

Categories of DOM

  • DOM Core – It specifies a generic model for viewing and manipulating a marked-up document as a tree structure.
  • DOM HTML – It specifies an extension to the core DOM for use with HTML. This represents DOM Level 0 with capabilities for manipulating all of the HTML element objects.
  • DOM CSS – It specifies the interfaces necessary to manipulate CSS rules programmatically.
  • DOM Events – It adds event handling to the DOM.
  • DOM XML – It specifies an extension to the Core Dom for use with XML.

Document Tree

DOM Node Types

ConstantNode TypeDescription
Node.ELEMENT_NODE1An element such as <h1> or <div>
Node.TEXT_NODE3The actual Text of Element or Attribute ex: – “Hello”
Node.PROCESSING_INSTRUCTION_NODE7An instruction to a parser on aspect of the document <?xml version=“1.0”?>
Node.COMMENT_NODE8A comment such as < – – Something – – >
Node.DOCUMENT_NODE9A Document Node
Node.DOCUMENT_TYPE_NODE10A doctype statement <!DOCTYPE html>
Node.DOCUMENT_FRAGMENT_NODE11A document fragment, which represents a lightweight structure to hold a collection of DOM nodes for manipulation or insertion.

Node Relationship

  • Parent
  • Children
  • First Child
  • Previous Sibling
  • Next Sibling
  • Last child

DOM Node Properties

PropertiesDescription
nodeNameContains the name of the node
nodeValueContains the value within the node; generally only applicable to text nodes
nodeTypeHolds a number corresponding to the type of node
parentNodeReference to the parent node of the element, if one exists
childNodesAccess to the list of child nodes
firstChildReference to the first child node of the element, if one exists
lastChildPoints to the last child node of the element, if one exists
previousSiblingReference to the previous sibling of the node; for example, if its parent node has multiple children
nextSiblingReference to the next sibling of the node; for example, if its parent node has multiple children
attributesThe list of the attributes for the element
ownerDocumentPoints to the HTML Document object in which the element is contained

Tagged : / / /

Bootstrap a Microsoft Windows node using Chef

Bootstrap a Microsoft Windows node, the “knife windows” plugin is required, 

More info about knife window tool, http://docs.chef.io/plugin_knife_windows.html

knife bootstrap windows winrm uvo1eak9a5geec05f7z.vm.cld.sr –winrm-user administrator –winrm-password ‘Rx4m7W4PQu’ –node-name firefox_win –run-list ‘recipe[snc_firefox]’

nife bootstrap windows winrm uvo1eak9a5geec05f7z.vm.cld.sr -x administrator -P Rx4m7W4PQu

Tagged : / / / / / / / /