Help Center/ CodeArts Build/ FAQs/ npm Builds/ Why Am I Seeing the Error Message "Module not found: Error: Can't resolve ..."?
Updated on 2024-10-10 GMT+08:00

Why Am I Seeing the Error Message "Module not found: Error: Can't resolve ..."?

Symptoms

When the npm build task is executed, the following error information is displayed in the log.

Cause Analysis

The required files failed to be found.

Error Module not found: Error: Can't resolve './App.Vue' in '/xxx/slave1/workspace/job_d5d70df6-9b64-4faa-ba67-93c06d4a1972_1545727944134/src' in line 6068 in the preceding figure indicates that the ./App.Vue file cannot be found in the src folder. Possible causes are as follows:

  • The required file does not exist in the corresponding folder.
  • The casing of the file path is incorrect. In the preceding figure, file name './App.vue' is misspelled as './App.Vue' in the code. As a result, this file cannot be found. The Windows OS is case insensitive, but the Linux OS is case sensitive. Therefore, the local build may be successful, but the build may fail in CodeArts Build.

Solution

  1. In the corresponding folder of the code project, add the missing files as indicated by the error.
  2. Modify the file path configured in the code.