“node --debug” and “node --debug-brk” are invalid

前端 未结 6 1958
我在风中等你
我在风中等你 2021-02-14 02:21

I have updated the node (v8.1.2). When I want to debug my previous test project in nodejs using NTVS (in visual studio 2017) I\'ve gotten the following error:

6条回答
  •  不思量自难忘°
    2021-02-14 02:51

    I did this:
    1. mv /usr/local/bin/node /usr/local/bin/node_bin
    2. echo > /usr/local/bin/node
    3. editor /usr/local/bin/node
    insert script:

    #!/bin/bash
    ## the script converting parameters for nodejs new version
    ##
    new_name="node_bin";
    eval _options="(" $(echo -e $@) ")"
    _node=$(whereis -b $new_name|awk '/^'$new_name':/{print $2}');                                                                              
    eval _version="(" $(echo -e $($_node --version|sed 's/[^0-9]/ /g')) ")";                                                                    
    # local values                                                                                                                              
    old_options=( "--debug" "--debug-brk" );                                                                                                    
    new_options=( "--inspect" "--inspect-brk" );                                                                                                
    _opt=();                                                                                                                                    
    
    function filtr() {                                                                                                                          
        _opt=${_options[@]};                                                                                                                    
        for ((get_i=0; get_i != ${#old_options[@]}; get_i++))                                                                                   
            do                                                                                                                                  
            if [ ${new_options[$get_i]} = "" ];
                then
                    _opt=${_opt[@]};
                else
                    _opt=$( echo -e ${_opt[@]}|sed 's/'${old_options[$get_i]}'/'${new_options[$get_i]}'/g');
            fi
        done
    
    }
    
    function convert() {
    
    if [ $(echo -e ${#_options[@]}) = 0 ];
        then 
            $_node;
        else
         filtr;
    
            $_node $(echo -e ${_opt[@]})
    fi
    exit 0;
    }
    
    if (( ${_version[0]} >= 7 ));
     then
       convert;
    fi
    exit 0;
    
    1. chmod ugo+x /usr/local/bin/node
      I will not say that the decision is elegant, but it helped me.

提交回复
热议问题