node | Node.js JavaScript runtime sparkles turtle rocket | Runtime Evironment library

 by   nodejs JavaScript Version: v19.8.1 License: Non-SPDX

kandi X-RAY | node Summary

node is a JavaScript library typically used in Server, Runtime Evironment, Nodejs applications. node has no bugs, it has no vulnerabilities and it has medium support. However node has a Non-SPDX License. You can install using 'npm i ericapi' or download it from GitHub, npm.
Node.js is an open-source, cross-platform, JavaScript runtime environment. For information on using Node.js, see the Node.js website. The Node.js project uses an open governance model. The OpenJS Foundation provides support for the project.
    Support
      Quality
        Security
          License
            Reuse
            Support
              Quality
                Security
                  License
                    Reuse

                      kandi-support Support

                        summary
                        node has a medium active ecosystem.
                        summary
                        It has 94027 star(s) with 25507 fork(s). There are 2899 watchers for this library.
                        summary
                        There were 10 major release(s) in the last 6 months.
                        summary
                        There are 1299 open issues and 14411 have been closed. On average issues are closed in 197 days. There are 424 open pull requests and 0 closed requests.
                        summary
                        It has a neutral sentiment in the developer community.
                        summary
                        The latest version of node is v19.8.1
                        node Support
                          Best in #Runtime Evironment
                            Average in #Runtime Evironment
                            node Support
                              Best in #Runtime Evironment
                                Average in #Runtime Evironment

                                  kandi-Quality Quality

                                    summary
                                    node has 0 bugs and 0 code smells.
                                    node Quality
                                      Best in #Runtime Evironment
                                        Average in #Runtime Evironment
                                        node Quality
                                          Best in #Runtime Evironment
                                            Average in #Runtime Evironment

                                              kandi-Security Security

                                                summary
                                                node has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
                                                summary
                                                node code analysis shows 0 unresolved vulnerabilities.
                                                summary
                                                There are 0 security hotspots that need review.
                                                node Security
                                                  Best in #Runtime Evironment
                                                    Average in #Runtime Evironment
                                                    node Security
                                                      Best in #Runtime Evironment
                                                        Average in #Runtime Evironment

                                                          kandi-License License

                                                            summary
                                                            node has a Non-SPDX License.
                                                            summary
                                                            Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.
                                                            node License
                                                              Best in #Runtime Evironment
                                                                Average in #Runtime Evironment
                                                                node License
                                                                  Best in #Runtime Evironment
                                                                    Average in #Runtime Evironment

                                                                      kandi-Reuse Reuse

                                                                        summary
                                                                        node releases are available to install and integrate.
                                                                        summary
                                                                        Deployable package is available in npm.
                                                                        summary
                                                                        Installation instructions, examples and code snippets are available.
                                                                        node Reuse
                                                                          Best in #Runtime Evironment
                                                                            Average in #Runtime Evironment
                                                                            node Reuse
                                                                              Best in #Runtime Evironment
                                                                                Average in #Runtime Evironment
                                                                                  Top functions reviewed by kandi - BETA
                                                                                  kandi has reviewed node and discovered the below as its top functions. This is intended to give you an instant insight into node implemented functionality, and help decide if they suit your requirements.
                                                                                  • Represents a REPL server .
                                                                                    • Create a new ChannelManager .
                                                                                      • Sets preview position
                                                                                        • Parses a line string .
                                                                                          • Returns a formatted string representation of the given value .
                                                                                            • Set debug mode
                                                                                              • A web network request
                                                                                                • Create a diff between two objects .
                                                                                                  • Default evaluation handler
                                                                                                    • Run the reverse search .
                                                                                                      Get all kandi verified functions for this library.
                                                                                                      Get all kandi verified functions for this library.

                                                                                                      node Key Features

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

                                                                                                      node Examples and Code Snippets

                                                                                                      Get node names .
                                                                                                      pythondot imgLines of Code : 27dot imgLicense : Non-SPDX (Apache License 2.0)
                                                                                                      copy iconCopy
                                                                                                      
                                                                                                                                          def node_names(self): """Lazily creates a mapping from node id to ("path", "to", "root").""" if self._node_name_cache is not None: return self._node_name_cache path_to_root = {} path_to_root[0] = ("(root)",) to_visit = collections.deque([0]) while to_visit: node_id = to_visit.popleft() obj = self._object_graph_proto.nodes[node_id] for child in obj.children: if child.node_id not in path_to_root: path_to_root[child.node_id] = ( path_to_root[node_id] + (child.local_name,)) to_visit.append(child.node_id) node_names = {} for node_id, path_to_root in path_to_root.items(): node_names[node_id] = ".".join(path_to_root) for node_id, node in enumerate(self._object_graph_proto.nodes): for slot_reference in node.slot_variables: node_names[slot_reference.slot_variable_node_id] = ( f"{node_names[node_id]}'s state '{slot_reference.slot_name}' for " f"{node_names[slot_reference.original_variable_node_id]}") self._node_name_cache = node_names return node_names
                                                                                                      Returns the device associated with a node .
                                                                                                      pythondot imgLines of Code : 26dot imgLicense : Non-SPDX (Apache License 2.0)
                                                                                                      copy iconCopy
                                                                                                      
                                                                                                                                          def node_device(self, node_name): """Get the names of the devices that has nodes of the specified name. Args: node_name: (`str`) name of the node. Returns: (`str` or `list` of `str`) name of the device(s) on which the node of the given name is found. Returns a `str` if there is only one such device, otherwise return a `list` of `str`. Raises: LookupError: If node inputs and control inputs have not been loaded from partition graphs yet. ValueError: If the node does not exist in partition graphs. """ if not self._debug_graphs: raise LookupError( "Node devices are not loaded from partition graphs yet.") if node_name not in self._node_devices: raise ValueError("Node '%s' does not exist in partition graphs." % node_name) output = list(self._node_devices[node_name]) return output[0] if len(output) == 1 else output
                                                                                                      Return a list of child node IDs .
                                                                                                      pythondot imgLines of Code : 23dot imgLicense : Non-SPDX (Apache License 2.0)
                                                                                                      copy iconCopy
                                                                                                      
                                                                                                                                          def _get_child_layer_node_ids(self, node_id): """Returns the node ids of each layer in a Sequential/Functional model.""" # Sequential and Functional track layers with names following the format # "layer-N". Use this to generate the list of layers. num_layers = 0 child_layers = {} pattern = re.compile('layer-(\\d+)') for child in self._proto.nodes[node_id].children: m = pattern.match(child.local_name) if m is None: continue layer_n = int(m.group(1)) num_layers = max(layer_n + 1, num_layers) child_layers[layer_n] = child.node_id ordered = [] for n in range(num_layers): child = child_layers.get(n) if child is None: break ordered.append(child) return ordered
                                                                                                      Community Discussions

                                                                                                      Trending Discussions on node

                                                                                                      Instead change the require of index.js, to a dynamic import() which is available in all CommonJS modules
                                                                                                      chevron right
                                                                                                      Error while creating new React app ("You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0)")
                                                                                                      chevron right
                                                                                                      Error message "error:0308010C:digital envelope routines::unsupported"
                                                                                                      chevron right
                                                                                                      AngularFireModule and AngularFireDatabaseModule not being found in @angular/fire
                                                                                                      chevron right
                                                                                                      Cannot read properties of undefined (reading 'transformFile') at Bundler.transformFile
                                                                                                      chevron right
                                                                                                      Error: require() of ES modules is not supported when importing node-fetch
                                                                                                      chevron right
                                                                                                      The unauthenticated git protocol on port 9418 is no longer supported
                                                                                                      chevron right
                                                                                                      ESlint - Error: Must use import to load ES Module
                                                                                                      chevron right
                                                                                                      require('node-fetch') gives ERR_REQUIRE_ESM
                                                                                                      chevron right
                                                                                                      Error when trying to run my React Native app on Android
                                                                                                      chevron right

                                                                                                      QUESTION

                                                                                                      Instead change the require of index.js, to a dynamic import() which is available in all CommonJS modules
                                                                                                      Asked 2022-Apr-05 at 06:25

                                                                                                      Trying to work with node/javascript/nfts, I am a noob and followed along a tutorial, but I get this error:

                                                                                                      error [ERR_REQUIRE_ESM]: require() of ES Module [...] is not supported. Instead change the require of index.js [ in my file...]  to a dynamic import() which is available in all CommonJS modules
                                                                                                      

                                                                                                      My understanding is that they've updated the node file, so i need a different code than that in the tutorial, but i don't know which one I'm supposed to change, where and to what. Please be as specific as you can

                                                                                                      const FormData = require('form-data');
                                                                                                      const fetch = require('node-fetch');
                                                                                                      const path = require("path")
                                                                                                      const basePath = process.cwd();
                                                                                                      const fs = require("fs");
                                                                                                      
                                                                                                      fs.readdirSync(`${basePath}/build/images`).foreach(file).forEach(file => {
                                                                                                          const formData = new FormData();
                                                                                                          const fileStream = fs.createReadStream(`${basePath}/build/images/${file}`);
                                                                                                          formData.append('file',fileStream);
                                                                                                      
                                                                                                          let url = 'https://api.nftport.xyz/v0/files';
                                                                                                      
                                                                                                          let options = {
                                                                                                            method: 'POST',
                                                                                                            headers: {
                                                                                                              Authorization: '[...]',
                                                                                                            },
                                                                                                            body: formData
                                                                                                          };
                                                                                                          
                                                                                                          fetch(url, options)
                                                                                                            .then(res => res.json())
                                                                                                            .then(json => {
                                                                                                             const fileName = path.parse(json.file_name).name;
                                                                                                             let rawdata = fs.readFileSync(`${basePath}/build/json/${fileName}.json`);
                                                                                                             let metaData = JSON.parse(rawdata);
                                                                                                      
                                                                                                             metaData.file_url = json.ipfs_url;
                                                                                                      
                                                                                                             fs.writeFileSync(`${basePath}/build/json${fileName}.json`, JSON.stringify(metaData, null, 2));
                                                                                                      
                                                                                                             console.log(`${json.file_name} uploaded & ${fileName}.json updated!`);
                                                                                                            })
                                                                                                            .catch(err => console.error('error:' + err));
                                                                                                      })
                                                                                                      
                                                                                                      

                                                                                                      ANSWER

                                                                                                      Answered 2021-Dec-31 at 10:07

                                                                                                      It is because of the node-fetch package. As recent versions of this package only support ESM, you have to downgrade it to an older version node-fetch@2.6.1 or lower.

                                                                                                      npm i node-fetch@2.6.1

                                                                                                      This should solve the issue.

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

                                                                                                      QUESTION

                                                                                                      Error while creating new React app ("You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0)")
                                                                                                      Asked 2022-Apr-04 at 11:58

                                                                                                      I am getting this create React app error again and again even after doing the uninstall part.

                                                                                                      npm uninstall -g create-react-app

                                                                                                      up to date, audited 1 package in 570ms

                                                                                                      found 0 vulnerabilities

                                                                                                      npx create-react-app test-app

                                                                                                      Need to install the following packages: create-react-app Ok to proceed? (y) y

                                                                                                      You are running create-react-app 4.0.3, which is behind the latest release (5.0.0).

                                                                                                      We no longer support global installation of Create React App.

                                                                                                      Please remove any global installs with one of the following commands:

                                                                                                      • npm uninstall -g create-react-app
                                                                                                      • yarn global remove create-react-app

                                                                                                      The latest instructions for creating a new app can be found here: https://create-react-app.dev/docs/getting-started/

                                                                                                      C:\>npm --version
                                                                                                      8.3.0
                                                                                                      C:\>node --version
                                                                                                      v16.13.0
                                                                                                      

                                                                                                      How can I fix this?

                                                                                                      ANSWER

                                                                                                      Answered 2022-Jan-01 at 22:34

                                                                                                      You will have to clear the npx cache to make it work.

                                                                                                      You can locate the location of the folder where create-react-app is installed using npm ls -g create-react-app.

                                                                                                      Also, to clear the cache, refer to this answer in How can I clear the central cache for `npx`?

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

                                                                                                      QUESTION

                                                                                                      Error message "error:0308010C:digital envelope routines::unsupported"
                                                                                                      Asked 2022-Apr-03 at 10:57

                                                                                                      I created the default IntelliJ IDEA React project and got this:

                                                                                                      Error: error:0308010C:digital envelope routines::unsupported
                                                                                                          at new Hash (node:internal/crypto/hash:67:19)
                                                                                                          at Object.createHash (node:crypto:130:10)
                                                                                                          at module.exports (/Users/user/Programming Documents/WebServer/untitled/node_modules/webpack/lib/util/createHash.js:135:53)
                                                                                                          at NormalModule._initBuildHash (/Users/user/Programming Documents/WebServer/untitled/node_modules/webpack/lib/NormalModule.js:417:16)
                                                                                                          at handleParseError (/Users/user/Programming Documents/WebServer/untitled/node_modules/webpack/lib/NormalModule.js:471:10)
                                                                                                          at /Users/user/Programming Documents/WebServer/untitled/node_modules/webpack/lib/NormalModule.js:503:5
                                                                                                          at /Users/user/Programming Documents/WebServer/untitled/node_modules/webpack/lib/NormalModule.js:358:12
                                                                                                          at /Users/user/Programming Documents/WebServer/untitled/node_modules/loader-runner/lib/LoaderRunner.js:373:3
                                                                                                          at iterateNormalLoaders (/Users/user/Programming Documents/WebServer/untitled/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
                                                                                                          at iterateNormalLoaders (/Users/user/Programming Documents/WebServer/untitled/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
                                                                                                      /Users/user/Programming Documents/WebServer/untitled/node_modules/react-scripts/scripts/start.js:19
                                                                                                        throw err;
                                                                                                        ^
                                                                                                      

                                                                                                      ANSWER

                                                                                                      Answered 2021-Nov-15 at 00:32

                                                                                                      Failed to construct transformer: Error: error:0308010C:digital envelope routines::unsupported

                                                                                                      The simplest and easiest solution to solve the above error is to downgrade Node.js to v14.18.1. And then just delete folder node_modules and try to rebuild your project and your error must be solved.

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

                                                                                                      QUESTION

                                                                                                      AngularFireModule and AngularFireDatabaseModule not being found in @angular/fire
                                                                                                      Asked 2022-Apr-01 at 12:56

                                                                                                      I am trying to implement Firebase Realtime Database into a angular project and Im getting stuck at one of the very first steps. Importing AngularFireModule and AngularFireDatabaseModule. It gives me the following error:

                                                                                                      Module '"@angular/fire"' has no exported member 'AngularFireModule'.ts(2305)
                                                                                                      
                                                                                                      Module '"@angular/fire/database"' has no exported member 'AngularFireDatabaseModule'.
                                                                                                      

                                                                                                      And here is how I am importing them:

                                                                                                      import {AngularFireModule } from '@angular/fire';
                                                                                                      import {AngularFireDatabaseModule} from '@angular/fire/database'
                                                                                                      

                                                                                                      Am I missing something here? I have installed @angular/fire via the command

                                                                                                      npm i firebase @angular/fire
                                                                                                      

                                                                                                      and have also installed firebase tools. Here is a list of the Angular packages I currently have installed and their versions:

                                                                                                      Angular CLI: 12.2.2
                                                                                                      Node: 14.17.4
                                                                                                      Package Manager: npm 6.14.14
                                                                                                      OS: win32 x64
                                                                                                      
                                                                                                      Angular: 12.2.3
                                                                                                      ... animations, common, compiler, compiler-cli, core, forms
                                                                                                      ... platform-browser, platform-browser-dynamic, router
                                                                                                      
                                                                                                      Package                         Version
                                                                                                      ---------------------------------------------------------
                                                                                                      @angular-devkit/architect       0.1202.2
                                                                                                      @angular-devkit/build-angular   12.2.2
                                                                                                      @angular-devkit/core            12.2.2
                                                                                                      @angular-devkit/schematics      12.2.2
                                                                                                      @angular/cli                    12.2.2
                                                                                                      @angular/fire                   7.0.0
                                                                                                      @schematics/angular             12.2.2
                                                                                                      rxjs                            6.6.7
                                                                                                      typescript                      4.3.5
                                                                                                      

                                                                                                      I do apologise if this is all excessive information but I am completely stuck as to what the issue is. Any help would be GREATLY appreciated. Right now my suspicion is that its a compatibility issue or perhaps a feature that doesnt exist anymore on the latest versions but I really dont know.

                                                                                                      ANSWER

                                                                                                      Answered 2021-Aug-26 at 13:20

                                                                                                      AngularFire 7.0.0 was launched yesterday with a new API that has a lot of bundle size reduction benefits.

                                                                                                      Instead of top level classes like AngularFireDatabase, you can now import smaller independent functions.

                                                                                                      import { list } from '@angular/fire/database';
                                                                                                      

                                                                                                      The initialization process is a bit different too as it has a more flexible API for specifying configurations.

                                                                                                      @NgModule({
                                                                                                          imports: [
                                                                                                              provideFirebaseApp(() => initializeApp(config)),
                                                                                                              provideFirestore(() => {
                                                                                                                  const firestore = getFirestore();
                                                                                                                  connectEmulator(firestore, 'localhost', 8080);
                                                                                                                  enableIndexedDbPersistence(firestore);
                                                                                                                  return firestore;
                                                                                                              }),
                                                                                                              provideStorage(() => getStorage()),
                                                                                                          ],
                                                                                                      })
                                                                                                      

                                                                                                      If you want to proceed with the older API there's a compatibility layer.

                                                                                                      import { AngularFireModule} from '@angular/fire/compat'
                                                                                                      import { AngularFireDatabaseModule } from '@angular/fire/compat/database';
                                                                                                      

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

                                                                                                      QUESTION

                                                                                                      Cannot read properties of undefined (reading 'transformFile') at Bundler.transformFile
                                                                                                      Asked 2022-Mar-29 at 12:36

                                                                                                      I have updated node today and I'm getting this error:

                                                                                                      error: TypeError: Cannot read properties of undefined (reading 'transformFile')
                                                                                                          at Bundler.transformFile (/Users/.../node_modules/metro/src/Bundler.js:48:30)
                                                                                                          at runMicrotasks ()
                                                                                                          at processTicksAndRejections (node:internal/process/task_queues:96:5)
                                                                                                          at async Object.transform (/Users/.../node_modules/metro/src/lib/transformHelpers.js:101:12)
                                                                                                          at async processModule (/Users/.../node_modules/metro/src/DeltaBundler/traverseDependencies.js:137:18)
                                                                                                          at async traverseDependenciesForSingleFile (/Users/.../node_modules/metro/src/DeltaBundler/traverseDependencies.js:131:3)
                                                                                                          at async Promise.all (index 0)
                                                                                                          at async initialTraverseDependencies (/Users/.../node_modules/metro/src/DeltaBundler/traverseDependencies.js:114:3)
                                                                                                          at async DeltaCalculator._getChangedDependencies (/Users/.../node_modules/metro/src/DeltaBundler/DeltaCalculator.js:164:25)
                                                                                                          at async DeltaCalculator.getDelta (/Users/.../node_modules/metro/src/DeltaBundler/DeltaCalculator.js:94:16)
                                                                                                      

                                                                                                      Other than that I haven't done anything unusual, so I'm not sure what to share. If I'm missing any info please comment and I'll add it.

                                                                                                      While building the terminal also throws this error:

                                                                                                      Failed to construct transformer:  Error: error:0308010C:digital envelope routines::unsupported
                                                                                                          at new Hash (node:internal/crypto/hash:67:19)
                                                                                                          at Object.createHash (node:crypto:130:10)
                                                                                                          at stableHash (/Users/.../node_modules/metro-cache/src/stableHash.js:19:8)
                                                                                                          at Object.getCacheKey (/Users/.../node_modules/metro-transform-worker/src/index.js:593:7)
                                                                                                          at getTransformCacheKey (/Users/.../node_modules/metro/src/DeltaBundler/getTransformCacheKey.js:24:19)
                                                                                                          at new Transformer (/Users/.../node_modules/metro/src/DeltaBundler/Transformer.js:48:9)
                                                                                                          at /Users/.../node_modules/metro/src/Bundler.js:22:29
                                                                                                          at processTicksAndRejections (node:internal/process/task_queues:96:5) {
                                                                                                        opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
                                                                                                        library: 'digital envelope routines',
                                                                                                        reason: 'unsupported',
                                                                                                        code: 'ERR_OSSL_EVP_UNSUPPORTED'
                                                                                                      }
                                                                                                      

                                                                                                      My node, npx and react-native versions are:

                                                                                                      • node: 17.0.0
                                                                                                      • npx: 8.1.0
                                                                                                      • react-native-cli: 2.0.1

                                                                                                      ANSWER

                                                                                                      Answered 2021-Oct-27 at 17:19

                                                                                                      Ran into the same issue with Node.js 17.0.0. To solve it, I downgraded to version 14.18.1, deleted node_modules and reinstalled.

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

                                                                                                      QUESTION

                                                                                                      Error: require() of ES modules is not supported when importing node-fetch
                                                                                                      Asked 2022-Mar-28 at 07:04

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

                                                                                                      Running Ubuntu 20.04.2 LTS in Windows Subsystem for Linux.

                                                                                                      Node version:

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

                                                                                                      node-fetch package version:

                                                                                                      user@MYLLYTIN:~/CAMSERVER$ npm v node-fetch
                                                                                                      
                                                                                                      node-fetch@3.0.0 | MIT | deps: 2 | versions: 63
                                                                                                      A light-weight module that brings Fetch API to node.js
                                                                                                      https://github.com/node-fetch/node-fetch
                                                                                                      
                                                                                                      keywords: fetch, http, promise, request, curl, wget, xhr, whatwg
                                                                                                      
                                                                                                      dist
                                                                                                      .tarball: https://registry.npmjs.org/node-fetch/-/node-fetch-3.0.0.tgz
                                                                                                      .shasum: 79da7146a520036f2c5f644e4a26095f17e411ea
                                                                                                      .integrity: sha512-bKMI+C7/T/SPU1lKnbQbwxptpCrG9ashG+VkytmXCPZyuM9jB6VU+hY0oi4lC8LxTtAeWdckNCTa3nrGsAdA3Q==
                                                                                                      .unpackedSize: 75.9 kB
                                                                                                      
                                                                                                      dependencies:
                                                                                                      data-uri-to-buffer: ^3.0.1 fetch-blob: ^3.1.2         
                                                                                                      
                                                                                                      maintainers:
                                                                                                      - endless 
                                                                                                      - bitinn 
                                                                                                      - timothygu 
                                                                                                      - akepinski 
                                                                                                      
                                                                                                      dist-tags:
                                                                                                      latest: 3.0.0        next: 3.0.0-beta.10  
                                                                                                      
                                                                                                      published 3 days ago by endless 
                                                                                                      

                                                                                                      esm package version:

                                                                                                      user@MYLLYTIN:~/CAMSERVER$ npm v esm
                                                                                                      
                                                                                                      esm@3.2.25 | MIT | deps: none | versions: 140
                                                                                                      Tomorrow's ECMAScript modules today!
                                                                                                      https://github.com/standard-things/esm#readme
                                                                                                      
                                                                                                      keywords: commonjs, ecmascript, export, import, modules, node, require
                                                                                                      
                                                                                                      dist
                                                                                                      .tarball: https://registry.npmjs.org/esm/-/esm-3.2.25.tgz
                                                                                                      .shasum: 342c18c29d56157688ba5ce31f8431fbb795cc10
                                                                                                      .integrity: sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==
                                                                                                      .unpackedSize: 308.6 kB
                                                                                                      
                                                                                                      maintainers:
                                                                                                      - jdalton 
                                                                                                      
                                                                                                      dist-tags:
                                                                                                      latest: 3.2.25  
                                                                                                      
                                                                                                      published over a year ago by jdalton 
                                                                                                      

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

                                                                                                      user@MYLLYTIN:~/CAMSERVER$ cat server.js 
                                                                                                      import fetch from "node-fetch";
                                                                                                      

                                                                                                      Result:

                                                                                                      user@MYLLYTIN:~/CAMSERVER$ node -r esm server.js 
                                                                                                      /home/user/CAMSERVER/node_modules/node-fetch/src/index.js:1
                                                                                                      Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /home/user/CAMSERVER/node_modules/node-fetch/src/index.js
                                                                                                      require() of ES modules is not supported.
                                                                                                      require() of /home/user/CAMSERVER/node_modules/node-fetch/src/index.js from /home/user/CAMSERVER/server.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
                                                                                                      Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /home/user/CAMSERVER/node_modules/node-fetch/package.json.
                                                                                                      
                                                                                                          at Object.Module._extensions..js (internal/modules/cjs/loader.js:1089:13) {
                                                                                                        code: 'ERR_REQUIRE_ESM'
                                                                                                      }
                                                                                                      user@MYLLYTIN:~/CAMSERVER$ 
                                                                                                      

                                                                                                      ANSWER

                                                                                                      Answered 2022-Feb-25 at 00:00

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

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

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

                                                                                                      QUESTION

                                                                                                      The unauthenticated git protocol on port 9418 is no longer supported
                                                                                                      Asked 2022-Mar-27 at 13:23

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

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

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

                                                                                                          - name: Installing modules
                                                                                                            run: yarn install
                                                                                                      

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

                                                                                                      Additional Details: Server: EC2 Instance Github actions steps:

                                                                                                        steps:
                                                                                                        - name: Checkout
                                                                                                          uses: actions/checkout@v2
                                                                                                      
                                                                                                        - id: vars
                                                                                                          run: |
                                                                                                            if [ '${{ github.ref }}' == 'refs/heads/master' ]; then echo "::set-output name=environment::prod_stackstream" ; echo "::set-output name=api-url::api" ; elif [ '${{ github.ref }}' == 'refs/heads/staging' ]; then echo "::set-output name=environment::staging_stackstream"  ; echo "::set-output name=api-url::stagingapi" ; else echo "::set-output name=environment::dev_stackstream" ; echo "::set-output name=api-url::devapi" ; fi
                                                                                                      
                                                                                                        - uses: pCYSl5EDgo/cat@master
                                                                                                          id: slack
                                                                                                          with:
                                                                                                            path: .github/workflows/slack.txt
                                                                                                      
                                                                                                        - name: Slack Start Notification
                                                                                                          uses: 8398a7/action-slack@v3
                                                                                                          env:
                                                                                                            SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
                                                                                                            ENVIRONMENT: '`${{ steps.vars.outputs.environment }}`'
                                                                                                            COLOR: good
                                                                                                            STATUS: '`Started`'
                                                                                                          with:
                                                                                                            status: custom
                                                                                                            fields: workflow,job,commit,repo,ref,author,took
                                                                                                            custom_payload: |
                                                                                                              ${{ steps.slack.outputs.text }}
                                                                                                      
                                                                                                        - name: Installing modules
                                                                                                          env:
                                                                                                            REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'
                                                                                                          run: yarn install
                                                                                                      
                                                                                                        - name: Create Frontend Build
                                                                                                          env:
                                                                                                            REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'
                                                                                                          run: yarn build
                                                                                                      
                                                                                                        - name: Deploy to Frontend Server DEV
                                                                                                          if: ${{ contains(github.ref, 'dev') }}
                                                                                                          uses: easingthemes/ssh-deploy@v2.1.5
                                                                                                          env:
                                                                                                            SSH_PRIVATE_KEY: ${{ secrets.DEV_KEY }}
                                                                                                            ARGS: '-rltgoDzvO --delete'
                                                                                                            SOURCE: 'deploy/'
                                                                                                            REMOTE_HOST: ${{ secrets.DEV_HOST }}
                                                                                                            REMOTE_USER: plyfolio-dev
                                                                                                            TARGET: '/home/plyfolio-dev/${{ steps.vars.outputs.environment }}/fe/deploy'
                                                                                                      

                                                                                                      package.json file

                                                                                                         {
                                                                                                        "name": "stackstream-fe",
                                                                                                        "version": "1.0.0",
                                                                                                        "authors": [
                                                                                                          "fayyaznofal@gmail.com"
                                                                                                        ],
                                                                                                        "private": true,
                                                                                                        "dependencies": {
                                                                                                          "@fortawesome/fontawesome-svg-core": "^1.2.34",
                                                                                                          "@fortawesome/free-solid-svg-icons": "^5.15.2",
                                                                                                          "@fortawesome/react-fontawesome": "^0.1.14",
                                                                                                          "@fullcalendar/bootstrap": "^5.5.0",
                                                                                                          "@fullcalendar/core": "^5.5.0",
                                                                                                          "@fullcalendar/daygrid": "^5.5.0",
                                                                                                          "@fullcalendar/interaction": "^5.5.0",
                                                                                                          "@fullcalendar/react": "^5.5.0",
                                                                                                          "@lourenci/react-kanban": "^2.1.0",
                                                                                                          "@redux-saga/simple-saga-monitor": "^1.1.2",
                                                                                                          "@testing-library/jest-dom": "^5.11.9",
                                                                                                          "@testing-library/react": "^11.2.3",
                                                                                                          "@testing-library/user-event": "^12.6.0",
                                                                                                          "@toast-ui/react-chart": "^1.0.2",
                                                                                                          "@types/jest": "^26.0.14",
                                                                                                          "@types/node": "^14.10.3",
                                                                                                          "@types/react": "^16.9.49",
                                                                                                          "@types/react-dom": "^16.9.8",
                                                                                                          "@vtaits/react-color-picker": "^0.1.1",
                                                                                                          "apexcharts": "^3.23.1",
                                                                                                          "availity-reactstrap-validation": "^2.7.0",
                                                                                                          "axios": "^0.21.1",
                                                                                                          "axios-mock-adapter": "^1.19.0",
                                                                                                          "axios-progress-bar": "^1.2.0",
                                                                                                          "bootstrap": "^5.0.0-beta2",
                                                                                                          "chart.js": "^2.9.4",
                                                                                                          "chartist": "^0.11.4",
                                                                                                          "classnames": "^2.2.6",
                                                                                                          "components": "^0.1.0",
                                                                                                          "dotenv": "^8.2.0",
                                                                                                          "draft-js": "^0.11.7",
                                                                                                          "echarts": "^4.9.0",
                                                                                                          "echarts-for-react": "^2.0.16",
                                                                                                          "firebase": "^8.2.3",
                                                                                                          "google-maps-react": "^2.0.6",
                                                                                                          "history": "^4.10.1",
                                                                                                          "i": "^0.3.6",
                                                                                                          "i18next": "^19.8.4",
                                                                                                          "i18next-browser-languagedetector": "^6.0.1",
                                                                                                          "jsonwebtoken": "^8.5.1",
                                                                                                          "leaflet": "^1.7.1",
                                                                                                          "lodash": "^4.17.21",
                                                                                                          "lodash.clonedeep": "^4.5.0",
                                                                                                          "lodash.get": "^4.4.2",
                                                                                                          "metismenujs": "^1.2.1",
                                                                                                          "mkdirp": "^1.0.4",
                                                                                                          "moment": "2.29.1",
                                                                                                          "moment-timezone": "^0.5.32",
                                                                                                          "nouislider-react": "^3.3.9",
                                                                                                          "npm": "^7.6.3",
                                                                                                          "prop-types": "^15.7.2",
                                                                                                          "query-string": "^6.14.0",
                                                                                                          "react": "^16.13.1",
                                                                                                          "react-apexcharts": "^1.3.7",
                                                                                                          "react-auth-code-input": "^1.0.0",
                                                                                                          "react-avatar": "^3.10.0",
                                                                                                          "react-bootstrap": "^1.5.0",
                                                                                                          "react-bootstrap-editable": "^0.8.2",
                                                                                                          "react-bootstrap-sweetalert": "^5.2.0",
                                                                                                          "react-bootstrap-table-next": "^4.0.3",
                                                                                                          "react-bootstrap-table2-editor": "^1.4.0",
                                                                                                          "react-bootstrap-table2-paginator": "^2.1.2",
                                                                                                          "react-bootstrap-table2-toolkit": "^2.1.3",
                                                                                                          "react-chartist": "^0.14.3",
                                                                                                          "react-chartjs-2": "^2.11.1",
                                                                                                          "react-color": "^2.19.3",
                                                                                                          "react-confirm-alert": "^2.7.0",
                                                                                                          "react-content-loader": "^6.0.1",
                                                                                                          "react-countdown": "^2.3.1",
                                                                                                          "react-countup": "^4.3.3",
                                                                                                          "react-cropper": "^2.1.4",
                                                                                                          "react-data-table-component": "^6.11.8",
                                                                                                          "react-date-picker": "^8.0.6",
                                                                                                          "react-datepicker": "^3.4.1",
                                                                                                          "react-dom": "^16.13.1",
                                                                                                          "react-draft-wysiwyg": "^1.14.5",
                                                                                                          "react-drag-listview": "^0.1.8",
                                                                                                          "react-drawer": "^1.3.4",
                                                                                                          "react-dropzone": "^11.2.4",
                                                                                                          "react-dual-listbox": "^2.0.0",
                                                                                                          "react-facebook-login": "^4.1.1",
                                                                                                          "react-flatpickr": "^3.10.6",
                                                                                                          "react-google-login": "^5.2.2",
                                                                                                          "react-hook-form": "^7.15.2",
                                                                                                          "react-i18next": "^11.8.5",
                                                                                                          "react-icons": "^4.2.0",
                                                                                                          "react-image-lightbox": "^5.1.1",
                                                                                                          "react-input-mask": "^2.0.4",
                                                                                                          "react-jvectormap": "^0.0.16",
                                                                                                          "react-leaflet": "^3.0.5",
                                                                                                          "react-meta-tags": "^1.0.1",
                                                                                                          "react-modal-video": "^1.2.6",
                                                                                                          "react-notifications": "^1.7.2",
                                                                                                          "react-number-format": "^4.7.3",
                                                                                                          "react-perfect-scrollbar": "^1.5.8",
                                                                                                          "react-rangeslider": "^2.2.0",
                                                                                                          "react-rating": "^2.0.5",
                                                                                                          "react-rating-tooltip": "^1.1.6",
                                                                                                          "react-redux": "^7.2.1",
                                                                                                          "react-responsive-carousel": "^3.2.11",
                                                                                                          "react-router-dom": "^5.2.0",
                                                                                                          "react-script": "^2.0.5",
                                                                                                          "react-scripts": "3.4.3",
                                                                                                          "react-select": "^4.3.1",
                                                                                                          "react-sparklines": "^1.7.0",
                                                                                                          "react-star-ratings": "^2.3.0",
                                                                                                          "react-super-responsive-table": "^5.2.0",
                                                                                                          "react-switch": "^6.0.0",
                                                                                                          "react-table": "^7.6.3",
                                                                                                          "react-toastify": "^7.0.3",
                                                                                                          "react-toastr": "^3.0.0",
                                                                                                          "react-twitter-auth": "0.0.13",
                                                                                                          "reactstrap": "^8.8.1",
                                                                                                          "recharts": "^2.0.8",
                                                                                                          "redux": "^4.0.5",
                                                                                                          "redux-saga": "^1.1.3",
                                                                                                          "reselect": "^4.0.0",
                                                                                                          "sass": "^1.37.5",
                                                                                                          "simplebar-react": "^2.3.0",
                                                                                                          "styled": "^1.0.0",
                                                                                                          "styled-components": "^5.2.1",
                                                                                                          "toastr": "^2.1.4",
                                                                                                          "typescript": "^4.0.2",
                                                                                                          "universal-cookie": "^4.0.4"
                                                                                                        },
                                                                                                        "devDependencies": {
                                                                                                          "@typescript-eslint/eslint-plugin": "^2.27.0",
                                                                                                          "@typescript-eslint/parser": "^2.27.0",
                                                                                                          "@typescript-eslint/typescript-estree": "^4.15.2",
                                                                                                          "eslint-config-prettier": "^6.10.1",
                                                                                                          "eslint-plugin-prettier": "^3.1.2",
                                                                                                          "husky": "^4.2.5",
                                                                                                          "lint-staged": "^10.1.3",
                                                                                                          "prettier": "^1.19.1",
                                                                                                          "react-test-renderer": "^16.13.1",
                                                                                                          "redux-devtools-extension": "^2.13.8",
                                                                                                          "redux-mock-store": "^1.5.4"
                                                                                                        },
                                                                                                        "scripts": {
                                                                                                          "start": "react-scripts start",
                                                                                                          "build": "react-scripts build && mv build ./deploy/build",
                                                                                                          "build-local": "react-scripts build",
                                                                                                          "test": "react-scripts test",
                                                                                                          "eject": "react-scripts eject"
                                                                                                        },
                                                                                                        "eslintConfig": {
                                                                                                          "extends": "react-app"
                                                                                                        },
                                                                                                        "husky": {
                                                                                                          "hooks": {
                                                                                                            "pre-commit": "lint-staged"
                                                                                                          }
                                                                                                        },
                                                                                                        "lint-staged": {
                                                                                                          "*.{js,ts,tsx}": [
                                                                                                            "eslint --fix"
                                                                                                          ]
                                                                                                        },
                                                                                                        "browserslist": {
                                                                                                          "production": [
                                                                                                            ">0.2%",
                                                                                                            "not dead",
                                                                                                            "not op_mini all"
                                                                                                          ],
                                                                                                          "development": [
                                                                                                            "last 1 chrome version",
                                                                                                            "last 1 firefox version",
                                                                                                            "last 1 safari version"
                                                                                                          ]
                                                                                                        }
                                                                                                      }
                                                                                                      

                                                                                                      ANSWER

                                                                                                      Answered 2022-Mar-16 at 07:01

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

                                                                                                      January 11, 2022 Final brownout.

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

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

                                                                                                      As noted by Jörg W Mittag:

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

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

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

                                                                                                      The permanent shutdown is not until March 15th.

                                                                                                      For GitHub Actions:

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

                                                                                                          - name: Fix up git URLs
                                                                                                            run: echo -e '[url "https://github.com/"]\n  insteadOf = "git://github.com/"' >> ~/.gitconfig
                                                                                                      

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

                                                                                                      For local projects

                                                                                                      For all your repositories, you can set:

                                                                                                      git config --global url."https://github.com/".insteadOf git://github.com/
                                                                                                      

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

                                                                                                      So this (with the right key) would work:

                                                                                                      git config --global url."git@github.com:".insteadOf git://github.com/
                                                                                                      

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

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

                                                                                                      QUESTION

                                                                                                      ESlint - Error: Must use import to load ES Module
                                                                                                      Asked 2022-Mar-17 at 12:13

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

                                                                                                      Error: Must use import to load ES Module

                                                                                                      Here is a more verbose version of the error:

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

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

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

                                                                                                      {
                                                                                                        "name": "my-react-boilerplate",
                                                                                                        "version": "1.0.0",
                                                                                                        "description": "",
                                                                                                        "main": "index.tsx",
                                                                                                        "directories": {
                                                                                                          "test": "test"
                                                                                                        },
                                                                                                        "engines": {
                                                                                                          "node": ">=14.0.0"
                                                                                                        },
                                                                                                        "type": "module",
                                                                                                        "scripts": {
                                                                                                          "build": "webpack --config webpack.prod.js",
                                                                                                          "dev": "webpack serve --config webpack.dev.js",
                                                                                                          "lint": "npm run typecheck && npm run lint:css && npm run lint:eslint:quiet",
                                                                                                          "lint:css": "stylelint './src/**/*.{js,ts,tsx}'",
                                                                                                          "lint:eslint:quiet": "eslint --ext .ts,.tsx,.js,.jsx  ./src --no-error-on-unmatched-pattern --quiet",
                                                                                                          "lint:eslint": "eslint --ext .ts,.tsx,.js,.jsx  ./src --no-error-on-unmatched-pattern",
                                                                                                          "lint:eslint:fix": "eslint --ext .ts,.tsx,.js,.jsx  ./src --no-error-on-unmatched-pattern --quiet --fix",
                                                                                                          "test": "cross-env NODE_ENV=test jest --coverage",
                                                                                                          "test:watch": "cross-env NODE_ENV=test jest --watchAll",
                                                                                                          "typecheck": "tsc --noEmit",
                                                                                                          "precommit": "npm run lint"
                                                                                                        },
                                                                                                        "lint-staged": {
                                                                                                          "*.{ts,tsx,js,jsx}": [
                                                                                                            "npm run lint:eslint:fix",
                                                                                                            "git add --force"
                                                                                                          ],
                                                                                                          "*.{md,json}": [
                                                                                                            "prettier --write",
                                                                                                            "git add --force"
                                                                                                          ]
                                                                                                        },
                                                                                                        "husky": {
                                                                                                          "hooks": {
                                                                                                            "pre-commit": "npx lint-staged && npm run typecheck"
                                                                                                          }
                                                                                                        },
                                                                                                        "resolutions": {
                                                                                                          "styled-components": "^5"
                                                                                                        },
                                                                                                        "author": "",
                                                                                                        "license": "ISC",
                                                                                                        "devDependencies": {
                                                                                                          "@babel/core": "^7.5.4",
                                                                                                          "@babel/plugin-proposal-class-properties": "^7.5.0",
                                                                                                          "@babel/preset-env": "^7.5.4",
                                                                                                          "@babel/preset-react": "^7.0.0",
                                                                                                          "@types/history": "^4.7.6",
                                                                                                          "@types/react": "^17.0.29",
                                                                                                          "@types/react-dom": "^17.0.9",
                                                                                                          "@types/react-router": "^5.1.17",
                                                                                                          "@types/react-router-dom": "^5.1.5",
                                                                                                          "@types/styled-components": "^5.1.15",
                                                                                                          "@typescript-eslint/eslint-plugin": "^5.0.0",
                                                                                                          "babel-cli": "^6.26.0",
                                                                                                          "babel-eslint": "^10.0.2",
                                                                                                          "babel-loader": "^8.0.0-beta.6",
                                                                                                          "babel-polyfill": "^6.26.0",
                                                                                                          "babel-preset-env": "^1.7.0",
                                                                                                          "babel-preset-react": "^6.24.1",
                                                                                                          "babel-preset-stage-2": "^6.24.1",
                                                                                                          "clean-webpack-plugin": "^4.0.0",
                                                                                                          "dotenv-webpack": "^7.0.3",
                                                                                                          "error-overlay-webpack-plugin": "^1.0.0",
                                                                                                          "eslint": "^8.0.0",
                                                                                                          "eslint-config-airbnb": "^18.2.0",
                                                                                                          "eslint-config-prettier": "^8.3.0",
                                                                                                          "eslint-config-with-prettier": "^6.0.0",
                                                                                                          "eslint-plugin-compat": "^3.3.0",
                                                                                                          "eslint-plugin-import": "^2.25.2",
                                                                                                          "eslint-plugin-jsx-a11y": "^6.2.3",
                                                                                                          "eslint-plugin-prettier": "^4.0.0",
                                                                                                          "eslint-plugin-react": "^7.14.2",
                                                                                                          "eslint-plugin-react-hooks": "^4.2.0",
                                                                                                          "extract-text-webpack-plugin": "^3.0.2",
                                                                                                          "file-loader": "^6.2.0",
                                                                                                          "html-webpack-plugin": "^5.3.2",
                                                                                                          "husky": "^7.0.2",
                                                                                                          "prettier": "^2.4.1",
                                                                                                          "raw-loader": "^4.0.2",
                                                                                                          "style-loader": "^3.3.0",
                                                                                                          "stylelint": "^13.13.1",
                                                                                                          "stylelint-config-recommended": "^5.0.0",
                                                                                                          "stylelint-config-styled-components": "^0.1.1",
                                                                                                          "stylelint-processor-styled-components": "^1.10.0",
                                                                                                          "ts-loader": "^9.2.6",
                                                                                                          "tslint": "^6.1.3",
                                                                                                          "typescript": "^4.4.4",
                                                                                                          "url-loader": "^4.1.1",
                                                                                                          "webpack": "^5.58.2",
                                                                                                          "webpack-cli": "^4.2.0",
                                                                                                          "webpack-dev-server": "^4.3.1",
                                                                                                          "webpack-merge": "^5.3.0"
                                                                                                        },
                                                                                                        "dependencies": {
                                                                                                          "history": "^4.10.0",
                                                                                                          "process": "^0.11.10",
                                                                                                          "react": "^17.0.1",
                                                                                                          "react-dom": "^17.0.1",
                                                                                                          "react-router-dom": "^5.2.0",
                                                                                                          "styled-components": "^5.2.1"
                                                                                                        }
                                                                                                      }
                                                                                                      

                                                                                                      Here is my .eslintrc file:

                                                                                                      {
                                                                                                        "extends": ["airbnb", "prettier"],
                                                                                                        "parser": "babel-eslint",
                                                                                                        "plugins": ["prettier", "@typescript-eslint"],
                                                                                                        "parserOptions": {
                                                                                                          "ecmaVersion": 8,
                                                                                                          "ecmaFeatures": {
                                                                                                            "experimentalObjectRestSpread": true,
                                                                                                            "impliedStrict": true,
                                                                                                            "classes": true
                                                                                                          }
                                                                                                        },
                                                                                                        "env": {
                                                                                                          "browser": true,
                                                                                                          "node": true,
                                                                                                          "jest": true
                                                                                                        },
                                                                                                        "rules": {
                                                                                                          "arrow-body-style": ["error", "as-needed"],
                                                                                                          "class-methods-use-this": 0,
                                                                                                          "react/jsx-filename-extension": 0,
                                                                                                          "global-require": 0,
                                                                                                          "react/destructuring-assignment": 0,
                                                                                                          "import/named": 2,
                                                                                                          "linebreak-style": 0,
                                                                                                          "import/no-dynamic-require": 0,
                                                                                                          "import/no-named-as-default": 0,
                                                                                                          "import/no-unresolved": 2,
                                                                                                          "import/prefer-default-export": 0,
                                                                                                          "semi": [2, "always"],
                                                                                                          "max-len": [
                                                                                                            "error",
                                                                                                            {
                                                                                                              "code": 80,
                                                                                                              "ignoreUrls": true,
                                                                                                              "ignoreComments": true,
                                                                                                              "ignoreStrings": true,
                                                                                                              "ignoreTemplateLiterals": true
                                                                                                            }
                                                                                                          ],
                                                                                                          "new-cap": [
                                                                                                            2,
                                                                                                            {
                                                                                                              "capIsNew": false,
                                                                                                              "newIsCap": true
                                                                                                            }
                                                                                                          ],
                                                                                                          "no-param-reassign": 0,
                                                                                                          "no-shadow": 0,
                                                                                                          "no-tabs": 2,
                                                                                                          "no-underscore-dangle": 0,
                                                                                                          "react/forbid-prop-types": [
                                                                                                            "error",
                                                                                                            {
                                                                                                              "forbid": ["any"]
                                                                                                            }
                                                                                                          ],
                                                                                                          "import/no-extraneous-dependencies": ["error", { "devDependencies": true }],
                                                                                                          "react/jsx-no-bind": [
                                                                                                            "error",
                                                                                                            {
                                                                                                              "ignoreRefs": true,
                                                                                                              "allowArrowFunctions": true,
                                                                                                              "allowBind": false
                                                                                                            }
                                                                                                          ],
                                                                                                          "react/no-unknown-property": [
                                                                                                            2,
                                                                                                            {
                                                                                                              "ignore": ["itemscope", "itemtype", "itemprop"]
                                                                                                            }
                                                                                                          ]
                                                                                                        }
                                                                                                      }
                                                                                                      

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

                                                                                                      {
                                                                                                        "extends": "./tsconfig.json",
                                                                                                        "include": ["./src/**/*.ts", "./src/**/*.tsx", "./src/**/*.js"],
                                                                                                        "exclude": ["node_modules/**", "build/**", "coverage/**"]
                                                                                                      }
                                                                                                      

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

                                                                                                      ANSWER

                                                                                                      Answered 2022-Mar-15 at 16:08

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

                                                                                                      So, do this:

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

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

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

                                                                                                      QUESTION

                                                                                                      require('node-fetch') gives ERR_REQUIRE_ESM
                                                                                                      Asked 2022-Mar-16 at 11:46

                                                                                                      I just use

                                                                                                      const fetch = require('node-fetch')
                                                                                                      

                                                                                                      And I get

                                                                                                      Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Users\Alex\Desktop\rollbot\node_modules\node-fetch\src\index.js from C:\Users\Alex\Desktop\rollbot\index.js not supported.
                                                                                                      Instead change the require of C:\Users\Alex\Desktop\rollbot\node_modules\node-fetch\src\index.js in C:\Users\Alex\Desktop\rollbot\index.js to a 
                                                                                                      dynamic import() which is available in all CommonJS modules.
                                                                                                      {
                                                                                                        code: 'ERR_REQUIRE_ESM'
                                                                                                      }
                                                                                                      

                                                                                                      All my other packages work, just node-fetch does this. What should I do in order to use node-fetch?

                                                                                                      ANSWER

                                                                                                      Answered 2021-Sep-07 at 11:53

                                                                                                      From the node-fetch package readme:

                                                                                                      node-fetch is an ESM-only module - you are not able to import it with require. We recommend you stay on v2 which is built with CommonJS unless you use ESM yourself. We will continue to publish critical bug fixes for it.

                                                                                                      If you want to require it, then downgrade to v2.

                                                                                                      The other option you have is to use async import('node-fetch').then(...)

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

                                                                                                      QUESTION

                                                                                                      Error when trying to run my React Native app on Android
                                                                                                      Asked 2022-Mar-06 at 07:58

                                                                                                      I've built my React Native app and tested and troubleshooted with my iOS devices for months. Now I'm trying to built and test the app on Android for the first time. The thing is, that I keep getting errors trying to run the Android-version of my app. After hours of debugging and troubleshooting, I tried to create a new RN project and see if that could run on my emulator and device. I got that part working and then I wanted to copy/paste the files of my existing app project into the new project.

                                                                                                      I pasted my existing assets, styles, the source JS-files and the package.json file into the new project, ran npm install and then I ended up with the exact same error message as I had in the original project when I run react-native run-android.

                                                                                                      The full error message is here:

                                                                                                      error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
                                                                                                      Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
                                                                                                      Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
                                                                                                      Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
                                                                                                      Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
                                                                                                      Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
                                                                                                      Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
                                                                                                      
                                                                                                      FAILURE: Build failed with an exception.
                                                                                                      
                                                                                                      * What went wrong:
                                                                                                      Execution failed for task ':app:mergeDebugAssets'.
                                                                                                      > Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
                                                                                                         > Could not find com.facebook.yoga:proguard-annotations:1.14.1.
                                                                                                           Searched in the following locations:
                                                                                                             - https://dl.google.com/dl/android/maven2/com/facebook/yoga/proguard-annotations/1.14.1/proguard-annotations-1.14.1.pom
                                                                                                             - https://repo.maven.apache.org/maven2/com/facebook/yoga/proguard-annotations/1.14.1/proguard-annotations-1.14.1.pom
                                                                                                             - file:/Users/MyUser/.m2/repository/com/facebook/yoga/proguard-annotations/1.14.1/proguard-annotations-1.14.1.pom
                                                                                                             - file:/Users/MyUser/MyAppFolder/MyApp/node_modules/react-native/android/com/facebook/yoga/proguard-annotations/1.14.1/proguard-annotations-1.14.1.pom
                                                                                                             - file:/Users/MyUser/MyAppFolder/MyApp/node_modules/jsc-android/dist/com/facebook/yoga/proguard-annotations/1.14.1/proguard-annotations-1.14.1.pom
                                                                                                             - https://www.jitpack.io/com/facebook/yoga/proguard-annotations/1.14.1/proguard-annotations-1.14.1.pom
                                                                                                           Required by:
                                                                                                               project :app > com.facebook.react:react-native:0.64.2
                                                                                                         > Could not find com.facebook.fbjni:fbjni-java-only:0.0.3.
                                                                                                           Searched in the following locations:
                                                                                                             - https://dl.google.com/dl/android/maven2/com/facebook/fbjni/fbjni-java-only/0.0.3/fbjni-java-only-0.0.3.pom
                                                                                                             - https://repo.maven.apache.org/maven2/com/facebook/fbjni/fbjni-java-only/0.0.3/fbjni-java-only-0.0.3.pom
                                                                                                             - file:/Users/MyUser/.m2/repository/com/facebook/fbjni/fbjni-java-only/0.0.3/fbjni-java-only-0.0.3.pom
                                                                                                             - file:/Users/MyUser/MyAppFolder/MyApp/node_modules/react-native/android/com/facebook/fbjni/fbjni-java-only/0.0.3/fbjni-java-only-0.0.3.pom
                                                                                                             - file:/Users/MyUser/MyAppFolder/MyApp/node_modules/jsc-android/dist/com/facebook/fbjni/fbjni-java-only/0.0.3/fbjni-java-only-0.0.3.pom
                                                                                                             - https://www.jitpack.io/com/facebook/fbjni/fbjni-java-only/0.0.3/fbjni-java-only-0.0.3.pom
                                                                                                           Required by:
                                                                                                               project :app > com.facebook.react:react-native:0.64.2
                                                                                                         > Could not find com.yqritc:android-scalablevideoview:1.0.4.
                                                                                                           Searched in the following locations:
                                                                                                             - https://dl.google.com/dl/android/maven2/com/yqritc/android-scalablevideoview/1.0.4/android-scalablevideoview-1.0.4.pom
                                                                                                             - https://repo.maven.apache.org/maven2/com/yqritc/android-scalablevideoview/1.0.4/android-scalablevideoview-1.0.4.pom
                                                                                                             - file:/Users/MyUser/.m2/repository/com/yqritc/android-scalablevideoview/1.0.4/android-scalablevideoview-1.0.4.pom
                                                                                                             - file:/Users/MyUser/MyAppFolder/MyApp/node_modules/react-native/android/com/yqritc/android-scalablevideoview/1.0.4/android-scalablevideoview-1.0.4.pom
                                                                                                             - file:/Users/MyUser/MyAppFolder/MyApp/node_modules/jsc-android/dist/com/yqritc/android-scalablevideoview/1.0.4/android-scalablevideoview-1.0.4.pom
                                                                                                             - https://www.jitpack.io/com/yqritc/android-scalablevideoview/1.0.4/android-scalablevideoview-1.0.4.pom
                                                                                                           Required by:
                                                                                                               project :app > project :react-native-video
                                                                                                      
                                                                                                      * Try:
                                                                                                      Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
                                                                                                      
                                                                                                      * Get more help at https://help.gradle.org
                                                                                                      
                                                                                                      BUILD FAILED in 10s
                                                                                                      
                                                                                                          at makeError (/Users/MyUser/MyAppFolder/MyApp/node_modules/execa/index.js:174:9)
                                                                                                          at /Users/MyUser/MyAppFolder/MyApp/node_modules/execa/index.js:278:16
                                                                                                          at processTicksAndRejections (node:internal/process/task_queues:96:5)
                                                                                                          at async runOnAllDevices (/Users/MyUser/MyAppFolder/MyApp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:5)
                                                                                                          at async Command.handleAction (/Users/MyUser/MyAppFolder/MyApp/node_modules/react-native/node_modules/@react-native-community/cli/build/index.js:186:9)
                                                                                                      

                                                                                                      I've tried to run ./gradlew clean in the android-folder without any luck. My build.gradle-file looks like this:

                                                                                                      // Top-level build file where you can add configuration options common to all sub-projects/modules.
                                                                                                      
                                                                                                      buildscript {
                                                                                                          ext {
                                                                                                              buildToolsVersion = "30.0.2"
                                                                                                              minSdkVersion = 21
                                                                                                              compileSdkVersion = 30
                                                                                                              targetSdkVersion = 30
                                                                                                              ndkVersion = "20.1.5948944"
                                                                                                              kotlinVersion = "1.3.72"
                                                                                                          }
                                                                                                          repositories {
                                                                                                              repositories {
                                                                                                                  google()
                                                                                                                  maven { url 'https://maven.google.com' }
                                                                                                                  mavenLocal()
                                                                                                                  mavenCentral()
                                                                                                      
                                                                                                                 // jcenter()
                                                                                                                  maven {
                                                                                                                      // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
                                                                                                                      url "$rootDir/../node_modules/react-native/android"
                                                                                                                  }
                                                                                                              }
                                                                                                          }
                                                                                                          dependencies {
                                                                                                              classpath("com.android.tools.build:gradle:4.2.1")
                                                                                                              classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
                                                                                                              // NOTE: Do not place your application dependencies here; they belong
                                                                                                              // in the individual module build.gradle files
                                                                                                          }
                                                                                                      }
                                                                                                      
                                                                                                      allprojects {
                                                                                                          repositories {
                                                                                                              google()
                                                                                                              mavenCentral()
                                                                                                      
                                                                                                              mavenLocal()
                                                                                                              maven {
                                                                                                                  // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
                                                                                                                  url("$rootDir/../node_modules/react-native/android")
                                                                                                              }
                                                                                                              maven {
                                                                                                                  // Android JSC is installed from npm
                                                                                                                  url("$rootDir/../node_modules/jsc-android/dist")
                                                                                                              }
                                                                                                      
                                                                                                              maven { url 'https://www.jitpack.io' }
                                                                                                          }
                                                                                                      }
                                                                                                      

                                                                                                      Please let me know if you know what to do or if you have experienced a similar issue!

                                                                                                      ANSWER

                                                                                                      Answered 2021-Aug-21 at 13:43

                                                                                                      I've hit this same issue and have temporarily resolved it by uninstalling react-native-video (npm uninstall --save react-native-video). That's not a great answer as I need that component, but I don't have a full solution yet. I think somehow com.yqritc:android-scalablevideoview:1.0.4. is required by react-native-video but has gotten lost or removed. Other thoughts are welcome.

                                                                                                      UPDATE: Resolved! In your build.gradle in your Android folder you need to add the repository "jcenter()" in allprojects (not in build dependencies) like this...

                                                                                                      allprojects {
                                                                                                          repositories {
                                                                                                              mavenCentral()
                                                                                                              mavenLocal()
                                                                                                              jcenter()
                                                                                                      }
                                                                                                      

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

                                                                                                      Community Discussions, Code Snippets contain sources that include Stack Exchange Network

                                                                                                      Vulnerabilities

                                                                                                      No vulnerabilities reported

                                                                                                      Install node

                                                                                                      Binaries, installers, and source tarballs are available at https://nodejs.org/en/download/. The latest directory is an alias for the latest Current release. The latest-codename directory is an alias for the latest release from an LTS line. For example, the latest-fermium directory contains the latest Fermium (Node.js 14) release. Each directory name and filename contains a date (in UTC) and the commit SHA at the HEAD of the release. Documentation for the latest Current release is at https://nodejs.org/api/. Version-specific documentation is available in each release directory in the docs subdirectory. Version-specific documentation is also at https://nodejs.org/download/docs/.
                                                                                                      Download directories contain a SHASUMS256.txt file with SHA checksums for the files.

                                                                                                      Support

                                                                                                      Looking for help? Check out the instructions for getting support.
                                                                                                      Find more information at:
                                                                                                      Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
                                                                                                      Find more libraries
                                                                                                      Explore Kits - Develop, implement, customize Projects, Custom Functions and Applications with kandi kits​
                                                                                                      Save this library and start creating your kit

                                                                                                      Share this Page

                                                                                                      share link

                                                                                                      Explore Related Topics

                                                                                                      Consider Popular Runtime Evironment Libraries

                                                                                                      Try Top Libraries by nodejs

                                                                                                      node-gyp

                                                                                                      by nodejsPython

                                                                                                      http-parser

                                                                                                      by nodejsC

                                                                                                      undici

                                                                                                      by nodejsJavaScript

                                                                                                      nan

                                                                                                      by nodejsC++

                                                                                                      nodejs.org

                                                                                                      by nodejsJavaScript

                                                                                                      Compare Runtime Evironment Libraries with Highest Support

                                                                                                      node

                                                                                                      by nodejs

                                                                                                      electron

                                                                                                      by electron

                                                                                                      Rocket.Chat

                                                                                                      by RocketChat

                                                                                                      TypeScript

                                                                                                      by microsoft

                                                                                                      express

                                                                                                      by expressjs

                                                                                                      Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
                                                                                                      Find more libraries
                                                                                                      Explore Kits - Develop, implement, customize Projects, Custom Functions and Applications with kandi kits​
                                                                                                      Save this library and start creating your kit