node.js - How to debug via npm with a module CLI? -
i use npm scripts package.json file :
"scripts": { "build": "rollup --config", "build-debug": "node --nolazy --inspect-brk=5858 rollup --config" } rollup cli of rollup.js library installed locally , available in node_modules/.bin
when executenpm run build work perfectly. want execute command vscode debugger.
so created launch.json file configuration:
"configurations": [ { "type": "node", "request": "launch", "name": "build", "cwd": "${workspaceroot}", "runtimeexecutable": "npm", "windows": { "runtimeexecutable": "npm.cmd" }, "runtimeargs": [ "run", "build-debug" ], "port": 5858 } ] but debugger failed
debugging inspector protocol because runtime executable set.
npm.cmd run build-debug
debugger listening on ws://127.0.0.1:5858/e0210d85-ee1d-4895-a67f-a23581725b31
debugger attached.
module.js:487
throw err;error: cannot find module 'd:\temp\myproject\rollup'
if use rollup path, have syntaxerror :
"scripts": { "build-debug": "node --nolazy --inspect-brk=5858 node_modules/.bin/rollup --config" } debugging inspector protocol because runtime executable set.
npm.cmd run build-debug
debugger listening on ws://127.0.0.1:5858/c43fe903-b54d-4804-84d2-37d3c98b40e2
debugger attached.
d:\temp\myproject\node_modules\.bin\rollup:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\,/,g')")syntaxerror: missing ) after argument list
any ideas or suggestions?
Comments
Post a Comment