Source-map’ not found #2812

Here is the content of my yarn.lock file, where source-map appears.

  • User Avatar

    I have the same issue in other versions such as 5.1, 5.0

  • User Avatar

    Hi, I guess this problem is related to VS2021, if you use VS2021 as IDE can you try to run the project from CLI (dotnet run)?

  • User Avatar

    This is why source map was requested as a deep dependency of abp.aspnetcore.mvc.ui.theme.lepton theme

    I don’t know what is it in the build configuration that complains.

  • User Avatar

    As suggested here:
    https://developercommunity.visualstudio.com/t/ts6053-node-modulessource-mapsource-map-not-found/1412153

    I added bolded text below, closed the solution, opened and rebuild.

  • To solve the error “Could not resolve the path with the extensions ‘.ts’, ‘.tsx’” you can use the tsc –help command. After fix this error, it will help you understand more clearly about ts CLI and also provide you with some helpful commands. Let’s go into detail.

    The error happens when you write an invalid tsc command or write it incorrectly.

    Example of how the error happens:

    tsc .
    The error:
    error TS6231: Could not resolve the path" with the extensions: '.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts'.
      The file is in the program because:
        Root file specified for compilation
    
    
    Found 1 error.
    

    Here I get the error because I use the wrong syntax, I use “tsc . “instead of “tsc path”. This command will work:

    tsc index.ts

    Or I also get an error when using “tsc init “instead of “tsc –init”.

    tsc init
    The error:
    error TS6231: Could not resolve the path" with the extensions: '.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts'.
      The file is in the program because:
        Root file specified for compilation
    
    
    Found 1 error.
    

    This will work:

    tsc --init

    Issue

    So why this error?

    function processAmount(number: number, displayedInFeed: boolean): string {
            // turns "2707" -> "2,707" and "306438" -> "306k"
        const amtAsString: string = number.toString();
        if (amtAsString.length <= 3) {
            // handles values like "123" and other 3 digit nums
            return amtAsString.toString();
        } else if (amtAsString.length === 4) {
            // converts "1234" -> "1,234"
            return amtAsString[0] + "," + amtAsString.slice(1);
        } else if (amtAsString.length > 4 && amtAsString.length <= 6) {
            // "306903" -> "306k"
            return amtAsString.slice(0, 3) + "k";
        } else if (amtAsString.length > 6) {
            // "65,730,395" -> "65.7m"
            let mil: string = " million";
            if (displayedInFeed) {
                mil = "m";
            }
            let millionLvlString: string = amtAsString.substring(0, amtAsString.length - 6) +
            "." +
            amtAsString[amtAsString.length - 6] +
            mil
            return millionLvlString
        }
    }
    
    export default processAmount;
    
    TypeScript error in C:/Users/path/to/file/ProcessAmount.ts(12,82):
    Function lacks ending return statement and return type does not include 'undefined'.  TS2366
    
        10 |  * Purpose of function is to convert 10,000 => 11.3k, 101,000 => 101k, 1,000k => 1.00m, and beyond.       
        11 |  */
      > 12 | export default function processAmount(number: number, displayedInFeed: boolean): string {
           |                                                                                  ^
        13 |
        14 |         // turns "2707" -> "2,707" and "306438" -> "306k"
        15 |     // console.log(number
    

    It may be something to do with not having a tsconfig file. I’m not sure though. Experts please!

    Please note, this did not help me understand my failure and neither is this. I’m just a bit too newb at TS.

    When I resolve the error I’m looking for tsc processAmount.ts to compile the program into js. However, that doesn’t work either, it says:

    error TS6053: File 'processAmount.ts' not found.
      The file is in the program because:
        Root file specified for compilation
    

    What to do?

    Solution

    Nitpick and slightly off topic: you don’t actually need :string in const amtAsString: string, TypeScript will infer the type automatically from the assigned value.

    Дополнительно:  В наушниках звук есть а в динамиках нет на ноутбуке: почему нет звука и что делать

    Answered By – paolostyle

    This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

    Summary

    In this article, I showed you how to solve the errorCould not resolve the path with the extensions’ .ts’, ‘.tsx’“. You should always read and know clearly about the command line before you use it. Thanks for reading!

    Maybe you are interested:

    Brent Johnson

    Hello, guys! I hope that my knowledge in HTML, CSS, JavaScript, TypeScript, NodeJS, ReactJS, MongoDB, Python, MySQL, and npm computer languages may be of use to you. I’m Brent Johnson, a software developer.


    Name of the university: HOU
    Major: IT
    Programming Languages: HTML, CSS, JavaScript, TypeScript, NodeJS, ReactJS, MongoDB, PyThon, MySQL, npm

    The solution for this error

    Beware with your command

    To solve the error, you should always control the command you use and make sure that the command is valid.

    Using tsc –help command

    If you want to know the valid command that you can use, you can use the “tsc –help” command to see all commands and flag to work with tsc CLI.

    tsc --help

    There are some common command lines you can use.

    tsc index.ts

    Emit the index.ts file with the compiler default.

    This command will help you convert the index.ts file to an index.js file with meaning.

    If you want to emit multiple file, you can separate files by space.

    tsc index.ts test.ts

    If you do not want to do it manually, you can use the –watch flag. It will watch the input file.

    tsc index.ts --watch

    Оцените статью
    Master Hi-technology
    Добавить комментарий