s-a / sublime-text-refactor

A Sublime Text Refactor Plugin for Javascript Code
213 stars 12 forks source link

AttributeError: 'str' object has no attribute 'decode' #43

Open siemiatj opened 6 years ago

siemiatj commented 6 years ago

When trying to run any command, I'm getting this :

JavaScript Refactor.Refactor.sublime-settings
node
error: b'\nundefined:1534\n    throw new JS_Parse_Error(message, filename, line, col, pos);\n    ^\nError\n    at new JS_Parse_Error (eval at <anonymous> (/Users/sasklacz/Library/Application Support/Sublime Text 3/Packages/JavaScript Refactor/js/node_modules/uglify-js/tools/node.js:22:1), <anonymous>:1526:18)\n    at js_error (eval at <anonymous> (/Users/sasklacz/Library/Application Support/Sublime Text 3/Packages/JavaScript Refactor/js/node_modules/uglify-js/tools/node.js:22:1), <anonymous>:1534:11)\n    at croak (eval at <anonymous> (/Users/sasklacz/Library/Application Support/Sublime Text 3/Packages/JavaScript Refactor/js/node_modules/uglify-js/tools/node.js:22:1), <anonymous>:2026:9)\n    at token_error (eval at <anonymous> (/Users/sasklacz/Library/Application Support/Sublime Text 3/Packages/JavaScript Refactor/js/node_modules/uglify-js/tools/node.js:22:1), <anonymous>:2034:9)\n    at unexpected (eval at <anonymous> (/Users/sasklacz/Library/Application Support/Sublime Text 3/Packages/JavaScript Refactor/js/node_modules/uglify-js/tools/node.js:22:1), <anonymous>:2040:9)\n    at semicolon (eval at <anonymous> (/Users/sasklacz/Library/Application Support/Sublime Text 3/Packages/JavaScript Refactor/js/node_modules/uglify-js/tools/node.js:22:1), <anonymous>:2060:56)\n    at simple_statement (eval at <anonymous> (/Users/sasklacz/Library/Application Support/Sublime Text 3/Packages/JavaScript Refactor/js/node_modules/uglify-js/tools/node.js:22:1), <anonymous>:2240:73)\n    at eval (eval at <anonymous> (/Users/sasklacz/Library/Application Support/Sublime Text 3/Packages/JavaScript Refactor/js/node_modules/uglify-js/tools/node.js:22:1), <anonymous>:2113:19)\n    at eval (eval at <anonymous> (/Users/sasklacz/Library/Application Support/Sublime Text 3/Packages/JavaScript Refactor/js/node_modules/uglify-js/tools/node.js:22:1), <anonymous>:2073:24)\n    at eval (eval at <anonymous> (/Users/sasklacz/Library/Application Support/Sublime Text 3/Packages/JavaScript Refactor/js/node_modules/uglify-js/tools/node.js:22:1), <anonymous>:2827:23)\n'
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 1072, in run_
    return self.run(edit)
  File "/Users/sasklacz/Library/Application Support/Sublime Text 3/Packages/JavaScript Refactor/Refactor.py", line 171, in run
    self.RenamevariableCommand(edit)
  File "/Users/sasklacz/Library/Application Support/Sublime Text 3/Packages/JavaScript Refactor/Refactor.py", line 181, in RenamevariableCommand
    self.executeNodeJsShell(cmd)
  File "/Users/sasklacz/Library/Application Support/Sublime Text 3/Packages/JavaScript Refactor/Refactor.py", line 54, in executeNodeJsShell
    return result.decode('utf-8')
AttributeError: 'str' object has no attribute 'decode'

Sublime 3.1.1, build 3176, OSX El Capitan.

morissonmaciel commented 5 years ago

Same issue is happing when trying to refactor an JSX based Rect Component and trying to rename a simple constant as coded below:

export const CustomCellStyle = `
    border-bottom-color: rgb(192, 192, 192);
    border-bottom-style: solid;
    border-bottom-width: 1px;
    border-right-color: rgb(192, 192, 192);
    border-right-style: solid;
    border-right-width: 1px;
    color: rgb(0, 0, 0);
    display: table-cell;
    font-size: 12px;
    width: 141px;
`;

Sublime 3.2.1, Build 3207, OSX Mojave