0

I am trying to create a smart contract and running a code. First it was giving an error with outfiles, so I copied a new code for launch.json file as seen in the screenshot. But now, it shows this error and I have tried everything but don't know what to do. Plz help

"configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Launch Program",
            "program": "${workspaceFolder}/app.js",
            "skipFiles": [
                "<node_internals>/**"
            ]
        },
        {

            "name": "Extension",
            "type": "extensionHost",
            "request": "launch",
            "preLaunchTask": "npm: compile",
            "runtimeExecutable": "${execPath}",
            "args": [
                "--extensionDevelopmentPath=${workspaceFolder}"
            ],
            "sourceMaps": true,
            "outFiles": [
                "${workspaceFolder}/out/src/**/*.js"
            ],        
        
            "stopOnEntry": false
        },
        {
            "type": "node",
            "request": "attach",
            "name": "Attach to Server",
            "port": 6009,
            "restart": true,
            "outFiles": [
                "${workspaceRoot}/out/src/**/*.js"
            ]

1 Answers1

2

Maybe your project misses a package.json file that defines "compile".

For example, if you’re trying to compile/build/transpile TypeScript into JavaScript (I cannot really tell what project you’re working on from what you’ve shared) then call the TypeScript compiler, tsc, in the package.json file’s "scripts" section (in your case you seem to try to call a script "compile"):

{
  ...
  "scripts": {
     "compile": "tsc"
     ...
  },
  ...
}

EDIT:

I tried preLaunchTask npm in google search. It gave a lot of results.

https://stackoverflow.com/a/51550043 seems to provide a better solution, there should be a tasks.json file that defines the task. (Note that your error messages contains the word “task” and so does “preLaunchTask“.) Visual Studio Code documentation about Tasks: https://code.visualstudio.com/docs/editor/tasks

SymboLinker
  • 884
  • 6
  • 15