Module not found: Error: Can't resolve “xxx” in “xxx” leads to the solution of this problem

Look at the error message first

 

 

 The response according to the error message is: Cannot find module: error: cannot be parsed

When encountering an error report, you should read the error message carefully, so that you will not be clueless when solving it

There are main reasons for this error under red occlusion

Here we talk about several ways to solve this type of error

1: The image path appears in the non-routing component, but the routing root component does not import the image

      The detailed error report is: Module not found: Error: Can't resolve './images/logo.png' in 'xxx'

Solution: Import the image under the non-routing component

2: The less style is adopted under the style in the non-routing component, and less related dependencies are not downloaded

        The detailed error report is: Module not found: Error: Can't resolve less-loder

Solution: Download less dependencies                

                1: Install wabpack wabpack-cli

                                      npm install webpack-cli -g

                                      npm install webpack -g

                2: Check whether wabpack and wabpack are installed successfully

                                      webpack-cli -v

                                      webpack -v

                  3: Install less and less-loader

                                    npm install less@4 --save-dev

                                    npm install less-loader@7 --save-dev

still can't solve

        You can delete node_modules and then npm install to re-download project dependencies and restart VS

 

Guess you like

Origin blog.csdn.net/qq_59389108/article/details/128593803