Tag Archives: report errors

[Solved] Docker Error: driver failed programming external connectivity on endpoint

1. Error information

Cannot start service nacos: driver failed programming external
connectivity on endpoint yingxue_nacos_1
(3e83b70dcd6ba020d1ee4cf61ffeac58dbf9aea3bbbdad69c7ed44f5cf40ad1a):
(iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0
–dport 8848 -j DNAT --to-destination 172.18.0.2:8848 ! -i br-2e393ccf4803: iptables: No chain/target/match by that name.

2. Solutions

The user-defined chain DOCKER is cleared for some reason when the docker service is started. Restart docker, and then restart naocs

systemctl restart docker
docker restart 540

[Solved] No ‘Access-Control-Allow-Origin‘ header is present on the requested resource.errError: Network Error

Console error message

Access to XMLHttpRequest at 'http://**/login' from origin 'http://**:9528' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
errError: Network Error

Cause analysis

According to Access-Control-Allow-Origin, it can be seen that it is a cross domain problem. If one address accesses another address, if any of the three places is different in this process, cross domain problems will occur.

1. Access agreement

HTTP, https

2. The port number is different

My error report here is to use 9528 to access 8001

3. Different IP addresses

Solution:

1. Add a comment on the back-end interface controller @CrossOrigin
2. Use the gateway to solve the problem

[Solved] IDEA jsp File Error: pageContext.setAttribute(“APP_PATH“,request.getContextPath());

IDEA jsp file report an error:

pageContext.setAttribute(“APP_PATH“,request.getContextPath())

 

Solution: import the jar package

<!-- https://mvnrepository.com/artifact/javax.servlet/jsp-api -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.0</version>
            <scope>provided</scope>
        </dependency>

[Solved] Vue eslint Error: Component name “*****“ should always be multi-word

Vue eslint Error: error “Component name “*****“ should always be multi-word”

Problems:

In the project created by Vue-cli, after the file is created and named, an error will be reported as “component name” ***** “should always be multi-word”;

The screenshot of error reporting is as follows:

Component name "******" should always be multi-word.eslintvue/multi-word-component-names

Reasons for error reporting:

The naming of components is not standardized. According to the official style guide of eslint, in addition to the root component (app.vue), the user-defined group

The part name should be composed of multiple words (using the naming method of big hump or connecting words with “-“) to prevent conflict with HTML tags;

 

The project created by the latest vue-cli uses the latest vue/cli-plugin-eslint plugin, which references the vue/multi-word-component-names rule after vue/cli-plugin-eslint v7.20.0.

The vue/multi-word-component-names rule has been referenced since vue/cli-plugin-eslint v7.20.0, so this error was determined at compile time.

Solution:

Scheme 1: Rename (valid for personal test)

Rename the name of the file

Modify the component name to multiple words, use hump naming method or connect words with “-“.

So the problem is solved~~~~

Examples are as follows:

Scheme 2: configure Vue config.js file (online method, invalid for my use)

Find vue.com in the root directory config. JS file (if not, create a new one), and add the following code in Vue config. JS file, add the following code

lintOnSave: false // Close eslint verification

Examples are as follows:

This scheme only does not report errors during compilation. If vscode + eslint is used, a red prompt will be marked in the file header, and the official does not recommend turning off the verification directly;

Configure Vue config. The method of JS file (scheme 2) generally can not solve the problem, so it is not recommended to use it

If you find that you haven’t solved the problem, you might as well try other solutions

Method 3: configuration eslintrc.js file (valid for personal test)

1. Turn off naming rules

Find it eslintrc.js file and adds such a sentence in rules

'vue/multi-word-component-names': "off" // Close name verification

It is suggested to use this method, which is more correct and reasonable;

Examples are as follows:

It is found that there is no error, and it can run normally ~ ~ ~

The above is to close the naming rules, and the component name will not be verified. The official recommended setting is to ignore the component name

2. Ignore individual component names

// Add component naming ignore rule
    "vue/multi-word-component-names": ["error",{
       "ignores": ["Home", "User"]//Component names to ignore
    }]

Recommended scheme 3, highly recommended!!!

For example:

Scheme 4:

The third scheme is to close and ignore the rule of component name; Ignore by component name

The fourth scheme is the closing rule according to the file.

Close a file naming rule verification

Found in the root directory eslintrc. JS file, (if not, create a new one (note that there is a point in front of the file))

Add the following code to the overrides of the file:

{  
 files: ['src/views/index.vue','src/views/**/index.vue'],   // Match index.vue in views and secondary directories
 rules: {
 'vue/multi-word-component-names': "off",
 } // assign rules to the files matched above
}

Where files: [] is used to match files, and the * sign represents all files. index. Vue can also be changed to * Vue, which is all Vue files in the matching directory

Document content:

module.exports = {
  root: true,
  env: {
    node: true
  },
  'extends': [
    'plugin:vue/essential',
    'eslint:recommended'
  ],
  parserOptions: {
    parser: '@babel/eslint-parser'
  },
  rules: {
    'no-console': process.env.NODE_ENV === 'production' ?'warn' : 'off',
    'no-debugger': process.env.NODE_ENV === 'production' ?'warn' : 'off',
  },
  overrides: [
        //Here is the code added
        { 
          files: ['src/views/index.vue','src/views/**/index.vue'], // match index.vue in views and secondary directories
          rules: {
          'vue/multi-word-component-names': "off",
          } // Assign rules to the files matched above
        },
    {
      files: [
        '**/__tests__/*.{j,t}s?(x)',
        '**/tests/unit/**/*.spec.{j,t}s?(x)'
      ],
      env: {
        jest: true
      }
    }
  ]
}

Four schemes I suggest using scheme 3 and scheme 4. I don’t recommend using the method of scheme 2, which is common on the Internet. It’s not easy to use!

Very important notes: (the configuration file will take effect only after the project is restarted)

In a running project, to modify the configuration file, you must first delete the project in the terminal and click Ctrl + C twice to terminate the project, and then NPM run serve to re run the project. The modified configuration file can take effect

Springboot integrates Redis annotation and access error: java.io.NotSerializableException: com.demo.entity.MemberEntity

Problem Description.
SpringBoot integration with Redis annotations, requesting an error:

java.io.NotSerializableException: com.demo.entity.MemberEntity at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
~[na:1.8.0_191] at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
~[na:1.8.0_191] at
java.util.ArrayList.writeObject(ArrayList.java:766) ~[na:1.8.0_191]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
~[na:1.8.0_191] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
~[na:1.8.0_191] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
~[na:1.8.0_191] at java.lang.reflect.Method.invoke(Method.java:498)
~[na:1.8.0_191] at
java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1140)
~[na:1.8.0_191] at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
~[na:1.8.0_191] at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
~[na:1.8.0_191] at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
~[na:1.8.0_191] at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
~[na:1.8.0_191]

Problem: Serialization is not performed in the entity class
Solution: Serializable interface is implemented in the entity class

SpringBoot IntegratenRedis Annotations and access error: EL1008E: Property or field ‘getListMember‘ cannot be found on object of type

Problem Description.
Springboot integration redis annotations, request access with the following error:

org.springframework.expression.spel.SpelEvaluationException: EL1008E:
Property or field ‘getListMember’ cannot be found on object of type
‘org.springframework.cache.interceptor.CacheExpressionRootObject’ –
maybe not public or not valid?



Reason: missing single quotes in redis tag

Solution:
Add single quotes to the redis tag

[Solved] Errors: 1 http://eslint.org/docs/rules/quotes…elementUI Import Error

Introduction of elementui

Add the following in main.js of src:

import Element from 'element-ui'
import "element-ui/lib/theme-chalk/index.css"
Vue.use(Element)

Introduce error reporting

Errors:
  1  http://eslint.org/docs/rules/quotes

You may use special comments to disable some warnings.
Use // eslint-disable-next-line to ignore the next line.
Use /* eslint-disable */ to ignore all warnings in a file.

Solution:

In the build/webpack.base.conf.js file, comment out or remove the rule about eslint in: module->rules

Then re-execute the command: npm run dev

It’s normal

[Solved] pytorc Error: RuntimeError: one of the variables needed for gradient computation has been modified by an

Error reported by
pytroch when modifying the network:

RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [1600, 16, 256]], which is output 0 of CudnnConvolutionBackward, is at version 1; expected version 0 instead

 

Solution 1:

Check all operations of the tensor that is reported as an error. If there is an addition or subtraction operation of x + = m, x = x + m, all operations shall be changed to the following format:

x = x.clone() + m

[Solved] torchvision Error: UserWarning: Failed to load image Python extension: Could not find module

Tochvision error: userwarning: failed to load image Python extension: could not find module

One reason is that the version of torchvision is too high. It is suspected that the new version of torchvision has its own pot. At first, according to the official website

pip3 install torch==1.10.1+cu102 torchvision==0.11.2+cu102 torchaudio===0.10.1+cu102 -f https://download.pytorch.org/whl/cu102/torch_stable.html

After that, the error of image will be reported. You only need to reduce the version of torch vision. For example, you can enter it in your Anaconda prompt

conda activate ltorch # ltorch is the name of the virtual environment I created
pip install torchvision==0.10.1+cu102 -f https://download.pytorch.org/whl/cu102/torch_stable.html

It was 0.11.2, but I reduced it to 0.10.1. Import without error:

Of course, you can change the version according to the following link

https://download.pytorch.org/whl/cu102/torch_stable.html