Tag Archives: node.js

[Solved] Failed to load config “react-app“ to extend from.

When learning Redux, the code cloned from the official GitHub runs with errors
failed to load config “react app” to extend from.
referenced from: F:\web\react\Redux\examples\Redux master\redux.Eslintrc.JS
when checking the data, it is found that most of the problems are caused by the lack of eslint, However, for the official demo, the problem is that the version of eslint conflicts with the version you downloaded, and the method of configuring. Env also fails
the solution is to comment out the configuration content in.Eslintrc.js directly.

[Solved] NPM Error: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed

This error is reported when NPM run build is executed to package Vue project, because the maximum value of node file set is not enough and the file after project packaging is too large.

Solution: install increase memory limit globally

Command line CMD, DOS window running: cnpm install – G increase memory limit,

Enter the project folder and run: increase memory limit

If NPM run build reports an error ‘node — Max old space size = 10240’ after executing increase memory limit after entering the project file, it is neither an internal or external command nor a runnable program ‘

You can create the following JS file contents in the project root directory, execute the file with node, and then run NPM run build to package successfully. This is to replace the public function of the string in the file corresponding to the. Bin file under the node_mosules file.

// Execute this script via node the first time you run the project
const fs = require('fs')
const path = require('path')
const wfPath =  path.resolve(__dirname, './node_modules/.bin')

fs.readdir(wfPath, (err, files)=>{
   if (err) {
    console.log(err);
   } else {
      if(files.length != 0 ) {
        files.forEach((item)=>{
           if(item.split('.')[1] === 'cmd') {
              replaceStr(`${wfPath}/${item}`, /"%_prog%"/, '%_prog%')
           }
        })
     }
   }
 })

// Parameters: [file path, string to be modified, modified string] (public function to replace the string in the corresponding file)
function replaceStr(filePath, sourceRegx, targetSrt) {
  fs.readFile(filePath, (err, data)=>{
     if(err) {
     console.log(err)
     } else {
       let str = data.toString();
      str= str.replace(sourceRegx, targetSrt);
       fs.writeFile(filePath, str, (err)=> { console.log(err) })
     }
  })
}

NPM publish an angular library Error [How to Solve]

Error Messages:

ERROR: Trying to publish a package that has been compiled by Ivy in full compilation mode. This is not allowed.
Please delete and rebuild the package with Ivy partial compilation mode, before attempting to publish.


This is because I was previously building my Angular library in development mode: the

Replace with the following production model.

ng build my-lib –configuration production

After that the error disappears.

Webpack Upgrade Error: webpack.NamedModulesPlugin is not a constructor

Use [email protected] time: wrong type: webpack.namedmodulesplugin is not a constructor

Next, webpack.config.js:

const webpack = require('webpack');
const { merge } = require('webpack-merge');

const baseConfig = require('./webpack.config.base');

module.exports = merge(baseConfig, {
  mode: process.env.NODE_ENV,
  entry: {
    index: './app/index.ts',
  },
  plugins: [
    new webpack.NamedModulesPlugin(),
    new webpack.EnvironmentPlugin({
      NODE_ENV: 'development',
    }),
  ],
});

Cause of problem: in 5.0, namedmodules plugin has been removed

Refer to upgrading obsolete configuration items

NamedModulesPlugin → optimization.moduleIds: ‘named’

optimization: {
 moduleIds: 'named'
}

Modify configuration:

const webpack = require('webpack');
const { merge } = require('webpack-merge');

const baseConfig = require('./webpack.config.base');

module.exports = merge(baseConfig, {
  mode: process.env.NODE_ENV,
  entry: {
    index: './app/index.ts',
  },
  optimization: {
    moduleIds: 'named'
  },
  plugins: [
    new webpack.EnvironmentPlugin({
      NODE_ENV: 'development',
    }),
  ],
});

PS. moduleid it seems that the default value is named?Just remove namedmodules plugin.

Video player plays flv with error flv: Unsupported audio codec IDX: 7

1、 Detailed error reporting information is as follows:

[TransmuxingController] > DemuxException: type = CodecUnsupported, info = Flv: Unsupported audio codec idx: 7
Uncaught (in promise) Error: Unhandled error. (undefined)
    at EventEmitter.emit (events.js:135)
    at EventEmitter.eval (flv-player.js:453)
    at EventEmitter.emit (events.js:144)
    at eval (transmuxer.js:729)

Flv: Unsupported audio codec.

2、 Solution

Analysis: there is no error in the front end
reason: Google does not prohibit video, but audio, but the video contains audio information, so it depends on whether the playback stream contains audio operations

Here, modify the streaming command to solve the problem:
Original:

ffmpeg -i rtsppath -vcodec copy -s 704x576 -acodec copy -f flv rtmp:/****/rtmplive/test

After modification:

ffmpeg -i rtsppath -vcodec copy -an -s 704x576 -acodec copy -f flv rtmp:/****/rtmplive/test

3、 Summary

when ffmpeg streaming is used, the audio coding is forced to AAC format.

Vue install reports an error operation not allowed

Solution:

1. Permission problem
you can run CMD as an administrator or open CMD by pressing Win + x .

2. Dependency package error
generally, in this case, we need to focus on the directory after operation not allowed . Through the error prompt, the problem can be solved by correctly installing the required dependent packages globally.

3. NPM version problem
this is also similar to the previous one, because different versions sometimes have problems with dependent packages. For example, the version is too high and there is no corresponding dependent package, so it is OK to change the NPM version.

error cb() never called! error This is an error with npm itself

Various methods have been tried on the Internet, but they haven’t been solved. Finally, the latest version of nodejs is installed manually and normal (you can directly overwrite and install it to the original path)

Attached information:
gnvm is a simple node.js multi version manager under windows, similar to NVM nvmw nodist
https://github.com/Kenshin/gnvm

NPM replace with a different version

#npm install -g [email protected]
npm install -g [email protected]

Nodejs comes with NPM

[Solved] Wepy build watch Error: ERR! Parse WePY config failed. Are you trying to use

The specific error is
[22:54:56] err! Parse WePY config failed. Are you trying to use WePY 2 to build WePY 1 project?
[22:54:56] ERR! Unexpected type: plugins expect a Array

This is because
the version of wepy used in the current project is 1. X, while the version of wepy on the computer is 2, X

NPM install wepy cli – G command installs version 1. X
NPM install @wepy cli – G command installs version 2. X
the difference [email protected]

Solution:

Locate C:\users\XX\appdata\roaming\NPM\node_Modules folder
delete the @wepy folder, and then execute NPM install wepy cli – G

How to Solve Nodejs error: cannot find module ‘. /application’

Open the terminal and enter nodemon./index.js. The following error messages appear:

Solution:

After entering the directory where index.js is located
delete node_ Module folder and package lock.json file open the terminal, type NPM clean cache , clear the cache, type NPM I , and type nodemon index. JS  for installation dependency
Run nodemon./index.js again

Perfect solution~

Error when Python executes JavaScript statement

‘gbk’ codec can’t encode character ‘\u20ac’ in position 62114: illegal multibyte sequence
find this line in the JS files:

e = "a€|",

It should be this symbol that reports an error. How to solve it

with open('./encryp_js/eventid_encryp.js', 'r', encoding='utf-8') as f:
    content = f.read()
jsdata = execjs.compile(content)