叉子兄弟有钱吗买Iphone,么钱还我,我该怎么办

NodeJS在VS2015中Debug的一个BUG? - CNode技术社区
这家伙很懒,什么个性签名都没有留下。
当我的VS2015中调试一个变量的时候,这个变量是被require进来的,我活的一个undefined的错误。当我把这个变量保存在一个临时变量的时候,此时这个临时变量有期望的数据。
(第一次debug 未获得预期结果)
(第一次debug 正确)
这是什么问题呢?谢谢大家!
什么意思?
这个结果看起来是正常的啊?
调试器是执行到断点的行为止,当前被断点的行不会执行。
3ks,我之后发现了这个问题,是我对调试不太熟…
CNode 社区为国内最专业的 Node.js 开源技术社区,致力于 Node.js 的技术研究。
服务器赞助商为
,存储赞助商为
,由提供应用性能服务。
新手搭建 Node.js 服务器,推荐使用无需备案的一.node.js需要正确安装.
检测PATH环境变量是否配置了Node.js,点击开始=》运行=》输入&cmd& =& 输入命令&path&,输出如下结果:
PATH=C:\oraclexe\app\oracle\product\10.2.0\server\C:\Windows\system32;
C:\WC:\Windows\System32\WC:\Windows\System32\WindowsPowerShell\v1.0\;
c:\python32\C:\MinGW\C:\Program Files\GTK2-Runtime\
C:\Program Files\MySQL\MySQL Server 5.5\C:\Program Files\nodejs\;
C:\Users\rg\AppData\Roaming\npm
我们可以看到环境变量中已经包含了C:\Program Files\nodejs\
检查Node.js版本
&&相关文章推荐
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:20234次
排名:千里之外
转载:19篇
(1)(1)(3)(1)(1)(1)(3)(4)(1)(1)(1)(1)(2)(3)(3)(12)node.js - vscode debug ES6 application - Stack Overflow
Join the Stack Overflow Community
Stack Overflow is a community of 7.2 million programmers, just like you, helping each other.
J it only takes a minute:
I have VSCode 0.5.0. I set the compilerOptions flag to "ES6" and the editor started recognizing my ES6 code as correct.
I have babel installed.
My Mocha tests use the babel compilers and my tests pass.
My app runs from the command line with no problems when I launch it with babel-node .
When I debug the app from within VSCode, it starts up without the ES6 support, and the app fails for ES6 syntax issues.
Are there debug settings that I missed turning on?
25.8k56182
By default VSCode launches node just with a --debug-brk option. This is not enough to enable ES6 support. If you can find out what options 'babel-node' passes to node, you could specify the same options in the VSCode launch config (through the runtimeArgs attribute). But this does not solve the issue that babel-node transpiles your ES6 code before running it.
Alternatively you could try to set the 'runtimeExecutable' in your launch config to 'babel-node'. This approach works with other node wrappers, but I haven't verified that is works with babel-node.
A third option (which should work) is to use the attach mode of VSCode: for this launch babel-node from the command line with the '--debug' option. It should print a port number. Then create an 'attach' launch config in VSCode with that port.
Here's how to get VSCode debugger to work with Babel 6+:
First install dependencies locally:
$ npm install babel-cli --save
$ npm install babel-preset-es2015 --save
Then run babel-node:
$ node_modules/babel-cli/bin/babel-node.js --debug --presets es2015 -- server.js --debug
By default, the debugger will listen on port 5858, so make sure the port matches in launch.json for Attach configuration:
"name": "Attach",
"type": "node",
"request": "attach",
"port": 5858
Now attach the debugger in VSCode:
make sure debug configuration is set to Attach and not Launch
run with F5
Although not required, if you also want to use nodemon to pickup code changes without restarting the server, you can do this:
Make sure nodemon is installed:
$ npm install nodemon --save-dev
Run the server
$ node_modules/.bin/nodemon node_modules/babel-cli/bin/babel-node.js --debug --presets es2015 -- server.js --debug
Finally, attach the debugger as shown above.
25.3k19105171
Assuming you have babel-cli installed as a local module in your project the following should work.
launch.json
"version": "0.2.0",
"configurations": [
"name": "Launch",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/node_modules/babel-cli/bin/babel-node.js",
"stopOnEntry": false,
"${workspaceRoot}/server.js"
You can try babel-register (you'll also need other companion babel modules as req'd):
npm install --save-dev babel-register
with a launch.json configuration along these lines:
"version": "0.2.0",
"configurations": [
"name": "Launch",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/src/index.js",
"stopOnEntry": false,
"args": [],
"cwd": "${workspaceRoot}",
"preLaunchTask": null,
"runtimeExecutable": null,
"runtimeArgs": [
"--nolazy",
"--require",
"babel-register"
"NODE_ENV": "development"
"console": "internalConsole",
"sourceMaps": true,
"outFiles": [
"name": "Attach",
"type": "node",
"request": "attach",
"port": 5858,
"address": "localhost",
"restart": false,
"sourceMaps": false,
"outFiles": [],
"localRoot": "${workspaceRoot}",
"remoteRoot": null
"name": "Attach to Process",
"type": "node",
"request": "attach",
"processId": "${command.PickProcess}",
"port": 5858,
"sourceMaps": false,
"outFiles": []
This is loosely based on
with the addition of the babel-register runtime argument.
1,34411327
babel + nodemon
In the VS Code Terminal, launch your server with the --inspect argument:
nodemon --inspect --watch src --exec node_modules/.bin/babel-node --presets react,es2015 src/server.js
Among the other lines, one will show the port on which the debugger is listening:
Debugger listening on port 9229
Create the following debug configuration:
"type": "node",
"request": "attach",
"name": "Attach to Port",
"address": "localhost",
"port": 9229
Launch the debugger, and if everything went fine you will see in the output Terminal:
Debugger attached.
From now on, you can debug your application.
5,67332730
There are two ways of doing it:
First Option using npm command prompt
In package.json file create build command that will execute babel
"scripts": {
"build": "babel src --out-dir dist --watch --source-maps"
"devDependencies": {
"babel-cli": "^6.23.0",
"babel-preset-es2015-node6": "^0.4.0",
"eslint": "^3.16.0"
In launch.json Enter following code:
"configurations": [
"name": "Launch",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/src/index.js",
"stopOnEntry": false,
"args": [],
"cwd": "${workspaceRoot}",
"runtimeArgs": [
"--nolazy"
"sourceMaps": true,
"outFiles": [
"${workspaceRoot}/dist/**/*.js"
Open your cmd window, navigate to your package.json file and execute:
npm run build
Open your VS Code and run your code. It will run and it will stop at all your breakpoints. The reason it works because source maps are generated and VS knows how to map them to your code.
Second option using VS Code task:
In VS Code add following task (Ctrl + Shift + P) and type 'Tasks: Configure Task Runner':
Add following code to tasks.json file
"version": "0.1.0",
"command": "${workspaceRoot}/node_modules/.bin/babel",
"isShellCommand": true,
"tasks": [
"taskName": "watch",
"--out-dir",
"--watch",
"--source-maps"
"suppressTaskName": true,
"isBuildCommand": true
Now execute task, but pressing Ctrl + Shift + B (build command) and now you can run and debug your code. VS Code doing the same as what npm is doing in step one.
You will also need to configure babel in .babelrc (located in the root of the project) file like this:
"presets": [
"es2015-node6"
and jsconfig.json (located in the root of the project)
"compilerOptions": {
"target": "ES6"
"include": [
"src/**/*"
13.8k57584
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Post as a guest
By posting your answer, you agree to the
Not the answer you're looking for?
Browse other questions tagged
rev .25989
Stack Overflow works best with JavaScript enabled

我要回帖

更多关于 刘永行四兄弟谁最有钱 的文章

 

随机推荐