【问题标题】:VSCode: Can't start node javascript project in debugger on mac OSXVSCode:无法在 Mac OSX 上的调试器中启动节点 javascript 项目
【发布时间】:2016-01-24 14:25:57
【问题描述】:

在尝试从 VSCode 调试启动 angular-phonecat 教程项目时出现以下错误 程序 '/Users/xxxx/src/node/angular-phonecat/8000' 不存在

项目克隆如下 git clone --depth=14 https://github.com/angular/angular-phonecat.git

这是生成的配置

    {
    "version": "0.1.0",
    // List of configurations. Add new configurations or edit existing ones.
    "configurations": [
        {
            // Name of configuration; appears in the launch configuration drop down menu.
            "name": "Launch 8000",
            // Type of configuration.
            "type": "node",
            // Workspace relative or absolute path to the program.
            "program": "8000",
            // Automatically stop program after launch.
            "stopOnEntry": false,
            // Command line arguments passed to the program.
            "args": [],
            // Workspace relative or absolute path to the working directory of the program being debugged. Default is the current workspace.
            "cwd": ".",
            // Workspace relative or absolute path to the runtime executable to be used. Default is the runtime executable on the PATH.
            "runtimeExecutable": null,
            // Optional arguments passed to the runtime executable.
            "runtimeArgs": ["--nolazy"],
            // Environment variables passed to the program.
            "env": {
                "NODE_ENV": "development"
            },
            // Use JavaScript source maps (if they exist).
            "sourceMaps": false,
            // If JavaScript source maps are enabled, the generated code is expected in this directory.
            "outDir": null
        },
        {
            "name": "Attach",
            "type": "node",
            // TCP/IP address. Default is "localhost".
            "address": "localhost",
            // Port to attach to.
            "port": 5858,
            "sourceMaps": false
        }
    ]
}

package.json如下

{
  "version": "0.0.0",
  "private": true,
  "name": "angular-phonecat",
  "description": "A tutorial application for AngularJS",
  "repository": "https://github.com/angular/angular-phonecat",
  "license": "MIT",
  "devDependencies": {
    "karma": "^0.12.16",
    "karma-chrome-launcher": "^0.1.4",
    "karma-firefox-launcher": "^0.1.3",
    "karma-jasmine": "~0.1.0",
    "protractor": "^2.1.0",
    "http-server": "^0.6.1",
    "tmp": "0.0.23",
    "bower": "^1.3.1",
    "shelljs": "^0.2.6"
  },
  "scripts": {
    "postinstall": "bower install",

    "prestart": "npm install",
    "start": "http-server -a 0.0.0.0 -p 8000",

    "pretest": "npm install",
    "test": "node node_modules/karma/bin/karma start test/karma.conf.js",
    "test-single-run": "node node_modules/karma/bin/karma start test/karma.conf.js  --single-run",

    "preupdate-webdriver": "npm install",
    "update-webdriver": "webdriver-manager update",

    "preprotractor": "npm run update-webdriver",
    "protractor": "protractor test/protractor-conf.js",

    "update-index-async": "node -e \"require('shelljs/global'); sed('-i', /\\/\\/@@NG_LOADER_START@@[\\s\\S]*\\/\\/@@NG_LOADER_END@@/, '//@@NG_LOADER_START@@\\n' + cat('bower_components/angular-loader/angular-loader.min.js') + '\\n//@@NG_LOADER_END@@', 'app/index-async.html');\""
  }
}

【问题讨论】:

    标签: angularjs node.js macos debugging visual-studio-code


    【解决方案1】:

    在使用“Launch Localhost with sourcemaps”调试选项之前,您需要从控制台运行“npm start”。

    配置将类似于 { "name": "使用源映射启动 localhost", “类型”:“铬”, “请求”:“启动”, "url": "http://localhost:8000/app", “sourceMaps”:是的, "webRoot": "${workspaceRoot}" }

    顺便说一句,我使用的是 0.2.0 版本的 launch.json。

    【讨论】:

      猜你喜欢
      • 2018-01-10
      • 2019-08-15
      • 2017-12-03
      • 2019-12-16
      • 1970-01-01
      • 2019-03-15
      • 2020-02-04
      • 2018-02-22
      • 1970-01-01
      相关资源
      最近更新 更多