Tag Archives: angular.js

How to Solve Echarts Error: import echarts from ‘echarts‘

The following commands are required for normal angular installation of echarts

1 npm install echarts -S
2 npm install ngx-echarts -S

However, an error prompt is found after installation, and the type is marked in red in the file reference

1. The following commands need to be executed

1 npm install echarts -S
2 npm install ngx-echarts -S
3 npm install @types/echarts -D

2. Introduce modules into modules (such as app.Module.TS):

1 import { NgxEchartsModule } from 'ngx-echarts';
2 @NgModule({
3   imports: [
4     ...,
5     NgxEchartsModule
6   ],
7 })
8 export class AppModule { }

[Solved] Angular&CI/CD:Error: initial exceeded maximum budget

During CI/CD process of angular project, the following errors occur:

Warning: initial exceeded maximum budget. Budget 2.00 MB was not met by 3.01 MB with a total of 5.01 MB.
Error: initial exceeded maximum budget. Budget 5.00 MB was not met by 6.83 kB with a total of 5.01 MB.

The packed file is too large for the specified file size

Solution: modify the angular in the project JSON configuration file (memory parameters)

 "budgets": [{
                  "type": "initial",
                  "maximumWarning": "2mb",
                  "maximumError": "6mb"
                },
              ]

I originally set the maximum error to 5MB, but now I can set it to 6MB. The specific problem depends on the situation

How to Solve Node GYP Rebuild Error

Node gyp rebuild error handling

Error message:

node-gyp rebuild

  CXX(target) Release/obj.target/contextify/src/contextify.o
../src/contextify.cc:50:53: error: too few arguments to function call, single argument 'context' was not specified
        target->Set(className, ljsTmpl->GetFunction());
                               ~~~~~~~~~~~~~~~~~~~~ ^
/Users/xxx/Library/Caches/node-gyp/14.15.4/include/node/v8.h:6482:46: note: 'GetFunction' declared here
  V8_WARN_UNUSED_RESULT MaybeLocal<Function> GetFunction(
                                             ^
../src/contextify.cc:60:74: error: too few arguments to function call, single argument 'context' was not specified
        ContextifyContext* ctx = new ContextifyContext(info[0]->ToObject());
                                                       ~~~~~~~~~~~~~~~~~ ^
/Users/xxx/Library/Caches/node-gyp/14.15.4/include/node/v8.h:2822:44: note: 'ToObject' declared here
  V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
                                           ^
../src/contextify.cc:75:48: error: too few arguments to function call, single argument 'context' was not specified
        Local<String> code = info[0]->ToString();
                             ~~~~~~~~~~~~~~~~~ ^
/Users/xxx/Library/Caches/node-gyp/14.15.4/include/node/v8.h:2810:44: note: 'ToString' declared here
  V8_WARN_UNUSED_RESULT MaybeLocal<String> ToString(
                                           ^
../src/contextify.cc:81:51: error: too few arguments to function call, single argument 'context' was not specified
            ScriptOrigin origin(info[1]->ToString());
                                ~~~~~~~~~~~~~~~~~ ^
/Users/xxx/Library/Caches/node-gyp/14.15.4/include/node/v8.h:2810:44: note: 'ToString' declared here
  V8_WARN_UNUSED_RESULT MaybeLocal<String> ToString(
                                           ^
../src/contextify.cc:124:45: error: too few arguments to function call, single argument 'context' was not specified
        constructor.Reset(tmpl->GetFunction());

Solution: switch the node version to node 8.17.0 to solve the above error reports

Mac install to multi version node

1. Download and install
NPM install -g n
2. Download the specified version (followed by the version number)
sudo n 14.15.0
3. Display which versions have been installed
n LS
4. Switch the version used (followed by the version number)
sudo n
view the installed version and switch the version used up and down

Unable to read workspace file ‘D:\angular.json‘: Invalid JSON character: “ “ at

Question:

Unable to read workspace file 'D:\font-end\antd\angular.json': Invalid JSON character: " " at 36:71.`Insert code snippet here`

Step 1: introduce the notes of the angular ecarts.min.js
you have a problem with the angular ecarts.min.js, but if the notes are started, the following error will be reported:

Error: The target entry-point "ngx-echarts" has missing 

angular.js Error:[$ injector:modulerr ]Why

Error prompt is shown in the figure below:

What’s causing it: Punctuation errors. [note, the test in this paper is tested in the punctuation in the array, the errors caused by other parts of punctuation have not been sorted out]
Example:

As can be seen from the first picture above, two errors are reported. If there is a punctuation problem, the second error is exactly the same, but the first error may occur in the following ways :(may not be complete, please add in the comments below)

The above problem is basically concluded to be a punctuation problem, which can be checked globally for the presence of Chinese punctuation before other screening.
If There are any other reasons for me to comment below the article, I will put it in the article after confirmation, and indicate the information of the provider.