Reputation: 1929
I'm trying to debug my express application I have configured my IDE based on the intellij help documentation. But when I run the application, the process never stops at the break points.
Please find my configuration window details below:
Intellij version : 2017.1 The bellow is what I'm seeing in the debugger console:
/Users/xxxxx/.nvm/versions/node/v8.1.2/bin/node --inspect-
brk=64692 /Users/xxxxx/Documents/WORKSPACE/acme-
web/services/acme.js
Debugger listening on ws://127.0.0.1:64692/453107ba-002c-4066-9b4c-
531e111aec87
For help see https://nodejs.org/en/docs/inspector
Debugger attached.
Waiting for the debugger to disconnect...
My application runs on the port 8080.
Did I missed anything, any pointers would be helpful
Edit :
I have tried to use IJ-EAP-2017.2. This is giving me a new error in console while trying to debug.
/Users/user-xxxx/.nvm/versions/node/v8.1.2/bin/node --inspect-brk=55169 /Users/user-xxxx/Documents/WORK/acme-prj-web/src/common/pages/yyyyPage.js
Debugger listening on port 55169.
Debugger attached.
/Users/user-xxxx/Documents/WORK/acme-prj-web/src/common/pages/yyyyPage.js:1
(function (exports, require, module, __filename, __dirname) { import React, { Component, PropTypes } from "react";
^^^^^^
SyntaxError: Unexpected token import
at createScript (vm.js:53:10)
at Object.runInThisContext (vm.js:95:10)
at Module._compile (module.js:543:28)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:427:7)
at startup (bootstrap_node.js:151:9)
Waiting for the debugger to disconnect...
Process finished with exit code 1
I'm not sure why we are getting this error, still struggling to make the debugger work.
SyntaxError: Unexpected token import
at createScript (vm.js:53:10)
Upvotes: 3
Views: 1535
Reputation: 93728
From the error message is seems that you are trying to run your React component with Node.js. React applications are normally executed by browser, this is a client-side code, so you have to build your application, start the server it is hosted on, and then debug it in browser using JavaScript Debug run configuration.
Please see https://blog.jetbrains.com/webstorm/2017/01/debugging-react-apps/ for more information about debugging react apps
Upvotes: 0
Reputation: 5698
Here is the problem: import
& export
syntax of ES6 has still not yet been supported by Node.js. The current best proposal is still on draft
status unfortunately.
Some solutions you can use:
require & module.exports
(consider whether you really need import / export
). And wait until Node.js officially releases full support for ES6.Hope that this can help :)
Upvotes: 1
Reputation: 857
Please try 2017.2 EAP: https://www.jetbrains.com/idea/nextversion/. Some issues with Node 8 have been fixed since 2017.1.
Upvotes: 0