Tag Archives: View – cli3

[Solved] Vue-cli3 running or packaging error: JS memory overflow

Error Messages: FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed – JavaScript heap out of memory
Solution:
Step 1.
Install the npm packages increase-memory-limit and cross-env
npm install increase-memory-limit cross-env -g
Step 2.
Add to package.json.
“fix-memory-limit”: “cross-env LIMIT=4096 increase-memory-limit”

"scripts": {
	"serve": "vue-cli-service serve",
	"build": "vue-cli-service build",
	"fix-memory-limit": "cross-env LIMIT=10000 increase-memory-limit"
},

Step 3:

Execute fix memory limit:

npm run fix-memory-limit

Step 4:

Error message: node — Max old space size = 4096 is not an internal or external command

Solution: on node_modules/.Modify “% _prog%” under bin to%_prog%

After the replacement, restart NPM run serve to execute successfully. If the error is still reported and the memory overflows, you can try to increase the 4096

Eslint error “no undef” and eslint rule configuration in Vue cli3

1. The no undef error occurs because there cannot be undefined variables in the syntax detection of eslint. Add them to the rules {} of. Eslintrc.js in the root directory   ‘ no-undef’: 0

Then restart the editor.

2. Rule configuration of eslint

In. Eslintrc.js, the rules of rules are as follows:

rules: {
    "RuleName": [RuleValue, RuleConfig]
}
Rule value:
"off" or 0 // turn off detection rules
"warn" or 1 // turn on and treat the open detection rule as a warning (does not affect the exit code)
"error" or 2 // turn on and treat the detection rule as an error (1 when the exit code is triggered)

The eslint rules are as follows:

"no-alert": 0,//prohibit the use of alert confirm prompt
"no-array-constructor": 2,//prohibit the use of array constructors
"no-bitwise": 0,//prohibit the use of bitwise operators
"no-caller": 1,//prohibit the use of arguments.caller or arguments.callee
"no-catch-shadow": 2,//prohibit the use of catch clause arguments with the same name as external scope variables
"no-class-assign": 2,//forbid to assign a value to a class
"no-cond-assign": 2,//prohibit the use of assignment statements in conditional expressions
"no-console": 2,//Disable the use of consoles
"no-const-assign": 2,//forbid to modify variables declared by const
"no-constant-condition": 2,//prohibit the use of constant expressions in conditions if(true) if(1)
"no-continue": 0,//prohibit the use of continue
"no-control-regex": 2,//prohibit the use of control characters in regular expressions
"no-debugger": 2,//Debugger is forbidden
"no-delete-var": 2,//do not use the delete operator for variables declared by var
"no-div-regex": 1,//can't use regular expressions that look like division /=foo/
"no-dupe-keys": 2,// do not allow duplicate keys when creating object literals {a:1,a:1}
"no-dupe-args": 2,// function arguments cannot be duplicated
"no-duplicate-case": 2,//Switch case tags cannot be duplicated
"no-else-return": 2,//If there is a return in the if statement, it can't be followed by an else statement
"no-empty": 2,//Block statement can not be empty
"no-empty-character-class": 2,//the content of [] in a regular expression cannot be empty
"no-empty-label": 2,//prohibit the use of empty labels
"no-eq-null": 2,//Disable the use of == or ! = operator
"no-eval": 1,//forbid the use of eval
"no-ex-assign": 2,//forbid to assign values to exception parameters in catch statements
"no-extend-native": 2,//prohibit extending native objects
"no-extra-bind": 2,//Disable unnecessary function binding
"no-extra-boolean-cast": 2,//Disable unnecessary bool conversions
"no-extra-parens": 2,//prohibit unnecessary parentheses
"no-extra-semi": 2,//prohibit superfluous colons
"no-fallthrough": 1,//prohibit switch pass-through
"no-floating-decimal": 2,//Disable omitting 0 .5 in floating point numbers 3.
"no-func-assign": 2,//Disable duplicate function declarations
"no-implicit-coercion": 1,//prohibit implicit conversions
"no-implied-eval": 2,//prohibit the use of implicit eval
"no-inline-comments": 0,//prohibit inline comments
"no-inline-declarations": [2, "functions"],//prohibit the use of declarations (variables or functions) in block statements
"no-invalid-regexp": 2,//Disable invalid regular expressions
"no-invalid-this": 2,//prohibit invalid this, only for constructors, classes, object literals
"no-irregular-whitespace": 2,//no irregular spaces
"no-iterator": 2,//prohibit the use of __iterator__ attribute
"no-label-var": 2,// the name of a label cannot be the same as the name of a variable declared by var
"no-labels": 2,//prohibit label declarations
"no-lone-blocks": 2,//Disable unnecessary nested blocks
"no-lonely-if": 2,//prohibit only if statements inside an else statement
"no-loop-func": 1,//prohibit the use of functions in loops (if they do not refer to external variables and do not form closures)
"no-mixed-requires": [0, false],//No mixed declaration types when declaring
"no-mixed-spaces-and-tabs": [2, false],//prohibit mixing tabs and spaces
"linebreak-style": [0, "windows"],//line break style
"no-multi-spaces": 1,//no extra spaces
"no-multi-str": 2,//Strings can't use \ newlines
"no-multiple-empty-lines": [1, {"max": 2}],//no more than 2 empty lines
"no-native-reassign": 2,//no native objects can be rewritten
"no-negated-in-lhs": 2,// the left side of the in operator cannot have !
"no-nested-ternary": 0,//Nested trinomials are forbidden
"no-new": 1,//forbid to construct an instance using new without assigning a value
"no-new-func": 1,//Disable the use of new Function
"no-new-object": 2,//Disable the use of new Object()
"no-new-require": 2,//prohibit the use of new require
"no-new-wrappers": 2,//prohibit the use of new to create wrapper instances, new String new Boolean new Number
"no-obj-calls": 2,//can't call built-in global objects, such as Math() JSON()
"no-octal": 2,//forbid the use of octal numbers
"no-octal-escape": 2,//forbid the use of octal escape sequences
"no-param-reassign": 2,//Disable reassigning parameters
"no-path-concat": 0,//do not use __dirname or __filename for path concatenation in node
"no-plusplus": 0,//Prohibit the use of ++, --
"no-process-env": 0,//prohibit the use of process.env
"no-process-exit": 0,//prohibit the use of process.exit()
"no-proto": 2,//prohibit the use of __proto__ attribute
"no-redeclare": 2,//prohibit repeated declaration of variables
"no-regex-spaces": 2,//prohibit the use of multiple spaces in regular expression literals /foo bar/
"no-restricted-modules": 0,//If the specified module is disabled, an error will be reported if it is used
"no-return-assign": 1,//return statements cannot have assignment expressions in them
"no-script-url": 0,//prohibit the use of javascript:void(0)
"no-self-compare": 2,//can't compare itself
"no-sequences": 0,//forbid the use of comma operators
"no-shadow": 2,//Variables in external scopes cannot have the same name as variables or arguments in the scope they are contained in
"no-shadow-restricted-names": 2,//restricted identifiers specified in strict mode cannot be used as variable names at declaration time
"no-spaced-func": 2,//Function call with no spaces between function name and ()
"no-sparse-arrays": 2,//Sparse arrays are forbidden, [1,,2]
"no-sync": 0,//nodejs disables sync methods
"no-ternary": 0,//prohibit the trinomial operator
"no-tiling-spaces": 1,//don't have spaces after the end of a line
"no-this-before-super": 0,//no use of this or super before calling super()
"no-throw-literal": 2,//Disable throwing literal errors throw "error";
"no-undef": 1,//no undefined variables
"no-undef-init": 2,//variables can't be assigned to undefined when initialized
"no-undefined": 2,//can't use undefined
"no-unexpected-multiline": 2,//Avoid multi-line expressions
"no-underscore-dangle": 1,//Identifiers cannot start or end with _
"no-unneeded-ternary": 2,//prohibit unnecessary nesting var isYes = answer === 1 ?true : false;
"no-unreachable": 2,//no unexecutable code
"no-unused-expressions": 2,//prohibit unused expressions
"no-unused-vars": [2, {"vars": "all", "args": "after-used"}],//no variables or arguments that are declared and not used
"no-use-before-define": 2,//no-use-before-define
"no-useless-call": 2,//prohibit unnecessary calls and applies
"no-void": 2,//Disable void operator
"no-var": 0,//disable var and replace it with let and const
"no-warning-comments": [1, { "terms": ["todo", "fixme", "xxx"], "location": "start" }],//can't have warning comments
"no-with": 2,//disable with

"array-bracket-spacing": [2, "never"],//Whether to allow non-empty arrays with extra spaces inside
"arrow-parens": 0,//arrow function enclosed in parentheses
"arrow-spacing": 0,//=>s pre/post brackets
"accessor-pairs": 0,//use getter/setter in objects
"block-scoped-var": 0,//use var in block statements
"brace-style": [1, "1tbs"],//brace style
"callback-return": 1,//avoid multiple calls to callbacks and stuff
"camelcase": 2,//force camelcase naming
"comma-dangle": [2, "never"],//no comma at the end of object literals
"comma-spacing": 0,//space before and after the comma
"comma-style": [2, "last"],//comma style, at the beginning or at the end of a line when a line break occurs
"complexity": [0, 11],//complexity of the loop
"computed-property-spacing": [0, "never"],//whether to allow computed key names or whatever
"consistent-return": 0,//whether to allow omission after return
"consistent-this": [2, "that"],//this alias
"constructor-super": 0,//non-derived class cannot call super, derived class must call super
"curly": [2, "all"],//must use {} in if(){}
"default-case": 2,//switch statement must have default at the end
"dot-location": 0,//the location of the object accessor, whether it is at the beginning or the end of the line when a line break occurs
"dot-notation": [0, { "allowKeywords": true }],//avoid unnecessary square brackets
"eol-last": 0,//file ends with a single newline character
"eqeqeq": 2,//must use all-equal
"func-names": 0,//Function expressions must have names
"func-style": [0, "declaration"],//function style, specifying that only function declarations/function expressions can be used
"generator-star-spacing": 0,// the space before and after the generator function*
"guard-for-in": 0,//for in loop to be filtered with if statement
"handle-callback-err": 0,//nodejs handles errors
"id-length": 0,//the length of the variable name
"indent": [2, 4],//indent style
"init-declarations": 0,//must assign initial values when declaring
"key-spacing": [0, { "beforeColon": false, "afterColon": true }],//space before and after the colon in the object literal
"lines-around-comment": 0, // before/ after line comment
"max-depth": [0, 4],// depth of nested blocks
"max-len": [0, 80, 4],//maximum length of string
"max-nested-callbacks": [0, 2],//Nesting depth of callbacks
"max-params": [0, 3],//the maximum number of parameters a function can have is 3
"max-statements": [0, 10],//the maximum number of statements within the function
"new-cap": 2,//the first line of the function name must be called in upper case using new, the first line must be called in lower case without new
"new-parens": 2,//new must be called with parentheses
"newline-after-var": 2,//whether a blank line is required after variable declaration
"object-curly-spacing": [0, "never"],//whether unnecessary spaces are allowed inside curly brackets
"object-shorthand": 0,// force object literal abbreviation syntax
"one-var": 1,//continuous declaration
"operator-assignment": [0, "always"],//assignment operator += -= or something
"operator-linebreak": [2, "after"],//whether the operator is at the end or the beginning of a line when a line break occurs
"padded-blocks": 0,//whether to have empty lines at the beginning and end of a block statement
"prefer-const": 0,//prefer-const
"prefer-spread": 0,//prefer spread
"prefer-reflect": 0,//prefer the method of reflect
"quotes": [1, "single"],//quote type `` "" ''
"quote-props":[2, "always"],// whether to force double quotes for property names in object literals
"radix": 2,//parseInt must specify the second parameter
"id-match": 0,//name detection
"require-yield": 0,//generator function must have yield
"semi": [2, "always"],//statement forced to end with a semicolon
"semi-spacing": [0, {"before": false, "after": true}],//spaces before and after the semicolon
"sort-vars": 0,//variable declaration sorting
"space-after-keywords": [0, "always"],//whether to leave a space after the keyword
"space-before-blocks": [0, "always"],//whether to have a space before blocks that do not start with a new line
"space-before-function-parents": [0, "always"],//space before parentheses for function definitions
"space-in-parents": [0, "never"],//space inside parentheses
"space-infix-ops": 0,//whether there should be spaces around the midfix operator
"space-return-throw-case": 2,//would you like a space after the return throw case
"space-unary-ops": [0, { "words": true, "nonwords": false }],//spaces before/after unary operators
"spaced-comment": 0,//comment style should have spaces or something
"strict": 2,//use strict mode
"use-isnan": 2,//forbid to use NaN when comparing, only use isNaN()
"valid-jsdoc": 0,//jsdoc rule
"valid-typeof": 2,//must use legal typeof value
"vars-on-top": 2,//var must be placed at the top of the scope
"wrap-iife": [2, "inside"],//immediately execute the parenthesis style of the function expression
"wrap-regex": 0,// regular expression literals wrapped in parentheses
"yoda": [2, "never"]//prohibit yoda conditions