简体   繁体   English

VSCode:无法在Mac OSX上的调试器中启动节点javascript项目

[英]VSCode: Can't start node javascript project in debugger on mac OSX

在此处输入图片说明 While trying to start the angular-phonecat tutorial project from VSCode debug the following error appears program '/Users/xxxx/src/node/angular-phonecat/8000' does not exist 尝试从VSCode调试启动angular-phonecat教程项目时,出现以下错误,程序'/ Users / xxxx / src / node / angular-phonecat / 8000'不存在

The project was cloned as follows git clone --depth=14 https://github.com/angular/angular-phonecat.git 如下克隆了项目git clone --depth = 14 https://github.com/angular/angular-phonecat.git

Here is the generated configuration 这是生成的配置

    {
    "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
        }
    ]
}

The package.json is as follows 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');\""
  }
}

you need to run "npm start" from console, before using "Launch Localhost with sourcemaps" Debug options. 您需要先从控制台运行“ npm start”,然后再使用“使用Sourcemaps启动Localhost”调试选项。

configurations will be something like { "name": "Launch localhost with sourcemaps", "types": "chrome", "request": "launch", "url": " http://localhost:8000/app ", "sourceMaps": true, "webRoot": "${workspaceRoot}" } 配置将类似于{“ name”:“使用sourcemaps启动localhost”,“ types”:“ chrome”,“ request”:“启动”,“ url”:“ http:// localhost:8000 / app ”,“ sourceMaps“:true,” webRoot“:” $ {workspaceRoot}“}

BTW, I am using version 0.2.0 launch.json. 顺便说一句,我正在使用0.2.0版本launch.json。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 NPM Start无法正常运行(无法在Mac OS X Yosemite上运行Node) - NPM Start isn't working (Can't get Node working on Mac OS X Yosemite) 无法在Angular的示例应用程序中启动Node js服务器 - Can't start Node js server in the example application of Angular 无法获取JavaScript文件来加载node_modules依赖项 - Can't get javascript file to load node_modules dependencies JavaScript调试器; 语句即使启用了断点也不起作用 - JavaScript debugger; statement doesn't work even if breakpoints are enabled AngularJS教程无法在Chrome Mac中打开 - AngularJS tutorial can't open in Chrome Mac 在Mac OSX上将Yeoman与Angular一起使用时出错 - Error when using Yeoman with Angular on Mac OSX 第二个节点服务器(或端口)不会在生产中启动(Elastic Beanstalk) - A second node server (or port) won't start in production (Elastic Beanstalk) 无法以角度启动业力服务器 - Can't start the karma server in angular 在Eclipse中的Node Express Project的javascript文件中未定义“角度” - 'angular' is not defined in javascript file of Node Express Project in Eclipse 在VSCode中,如何为没有package.json的项目启用Angular / Backbone / jQuery intellisense? - In VSCode, How can I enable Angular/Backbone/jQuery intellisense for a project without a package.json?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM