sublimelsp / lsp_utils

Module with LSP-related utilities for Sublime Text
https://sublimelsp.github.io/lsp_utils/
MIT License
16 stars 6 forks source link

Update local node runtime to version 14 #79

Closed rchl closed 3 years ago

rchl commented 3 years ago

For Windows 7 and lower set the NODE_SKIP_PLATFORM_CHECK=1 to allow it to work.

Fixes #78

rchl commented 3 years ago

I haven't tried it on Windows 7. Are you able to test it @jfcherng ?

jfcherng commented 3 years ago
This has been fixed in a later comment After fixing `IS_WINDOWS_7_OR_LOWER`, I have ``` LSP-json: The system Node.js does not meet the requirements: NodeRuntimePATH(node: None, npm: None, version: None) [lsp_utils] START output of command: "C:\Users\Tester\Desktop\sublime_text_build_4113_x64\Data\Package Storage\lsp_utils\node-runtime\14.17.6\node\node.exeC:\Users\Tester\Desktop\sublime_text_build_4113_x64\Data\Package Storage\lsp_utils\node-runtime\14.17.6\node\node_modules\npm\bin\npm-cli.jsci--scripts-prepend-node-path=true--verbose--production" [lsp_utils] Command output END Unable to start subprocess for LSP-json Traceback (most recent call last): File "C:\Users\Tester\Desktop\SUBLIM~1\Data\Packages\LSP_UT~1\st3\lsp_utils\server_npm_resource.py", line 99, in install_or_update self._node_runtime.npm_install(self._server_dest) File "C:\Users\Tester\Desktop\SUBLIM~1\Data\Packages\LSP_UT~1\st3\lsp_utils\node_runtime.py", line 153, in npm_install raise Exception('Failed to run npm command "{}":\n{}'.format(' '.join(args), error)) Exception: Failed to run npm command "C:\Users\Tester\Desktop\sublime_text_build_4113_x64\Data\Package Storage\lsp_utils\node-runtime\14.17.6\node\node.exe C:\Users\Tester\Desktop\sublime_text_build_4113_x64\Data\Package Storage\lsp_utils\node-runtime\14.17.6\node\node_modules\npm\bin\npm-cli.js ci --scripts-prepend-node-path=true --verbose --production": npm info it worked if it ends with ok npm verb cli [ npm verb cli 'C:\\Users\\Tester\\Desktop\\sublime_text_build_4113_x64\\Data\\Package Storage\\lsp_utils\\node-runtime\\14.17.6\\node\\node.exe', npm verb cli 'C:\\Users\\Tester\\Desktop\\sublime_text_build_4113_x64\\Data\\Package Storage\\lsp_utils\\node-runtime\\14.17.6\\node\\node_modules\\npm\\bin\\npm-cli.js', npm verb cli 'ci', npm verb cli '--scripts-prepend-node-path=true', npm verb cli '--verbose', npm verb cli '--production' npm verb cli ] npm info using npm@6.14.15 npm info using node@v14.17.6 npm verb npm-session e1c361eaca15bbb2 npm info prepare initializing installer npm verb prepare starting workers npm verb prepare installation prefix: C:\Users\Tester\Desktop\sublime_text_build_4113_x64\Data\Package Storage\LSP-json\14.17.6\language-server npm verb prepare using package-lock.json npm verb checkLock verifying package-lock data npm info prepare Done in 0.029s npm verb extractTree extracting dependencies to node_modules/ npm verb teardown shutting down workers. npm info teardown Done in 0.001s npm verb type system npm verb stack FetchError: request to https://registry.npmjs.org/vscode-json-languageserver/-/vscode-json-languageserver-1.3.4.tgz failed, reason: getaddrinfo EAI_FAIL registry.npmjs.org npm verb stack at ClientRequest. (C:\Users\Tester\Desktop\sublime_text_build_4113_x64\Data\Package Storage\lsp_utils\node-runtime\14.17.6\node\node_modules\npm\node_modules\node-fetch-npm\src\index.js:68:14) npm verb stack at ClientRequest.emit (events.js:400:28) npm verb stack at TLSSocket.socketErrorListener (_http_client.js:475:9) npm verb stack at TLSSocket.emit (events.js:400:28) npm verb stack at emitErrorNT (internal/streams/destroy.js:106:8) npm verb stack at emitErrorCloseNT (internal/streams/destroy.js:74:3) npm verb stack at processTicksAndRejections (internal/process/task_queues.js:82:21) npm verb cwd C:\Users\Tester\Desktop\sublime_text_build_4113_x64\Data\Package Storage\LSP-json\14.17.6\language-server npm verb Windows_NT 6.1.7601 npm verb argv "C:\\Users\\Tester\\Desktop\\sublime_text_build_4113_x64\\Data\\Package Storage\\lsp_utils\\node-runtime\\14.17.6\\node\\node.exe" "C:\\Users\\Tester\\Desktop\\sublime_text_build_4113_x64\\Data\\Package Storage\\lsp_utils\\node-runtime\\14.17.6\\node\\node_modules\\npm\\bin\\npm-cli.js" "ci" "--scripts-prepend-node-path=true" "--verbose" "--production" npm verb node v14.17.6 npm verb npm v6.14.15 npm ERR! code EAI_FAIL npm ERR! errno EAI_FAIL npm ERR! network request to https://registry.npmjs.org/vscode-json-languageserver/-/vscode-json-languageserver-1.3.4.tgz failed, reason: getaddrinfo EAI_FAIL registry.npmjs.org npm ERR! network This is a problem related to network connectivity. npm ERR! network In most cases you are behind a proxy or have bad network settings. npm ERR! network npm ERR! network If you are behind a proxy, please make sure that the npm ERR! network 'proxy' config is set properly. See: 'npm help config' npm verb exit [ 1, true ] npm timing npm Completed in 1543ms npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Tester\npm-cache\_logs\2021-09-02T02_57_45_343Z-debug.log During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\Tester\Desktop\sublime_text_build_4113_x64\Data\Installed Packages\LSP.sublime-package\plugin/core/windows.py", line 337, in start_async plugin_class.install_or_update() File "C:\Users\Tester\Desktop\SUBLIM~1\Data\Packages\LSP_UT~1\st3\lsp_utils\_client_handler\abstract_plugin.py", line 109, in install_or_update server.install_or_update() File "C:\Users\Tester\Desktop\SUBLIM~1\Data\Packages\LSP_UT~1\st3\lsp_utils\server_npm_resource.py", line 103, in install_or_update raise Exception('Error installing the server:\n{}'.format(error)) Exception: Error installing the server: Failed to run npm command "C:\Users\Tester\Desktop\sublime_text_build_4113_x64\Data\Package Storage\lsp_utils\node-runtime\14.17.6\node\node.exe C:\Users\Tester\Desktop\sublime_text_build_4113_x64\Data\Package Storage\lsp_utils\node-runtime\14.17.6\node\node_modules\npm\bin\npm-cli.js ci --scripts-prepend-node-path=true --verbose --production": npm info it worked if it ends with ok npm verb cli [ npm verb cli 'C:\\Users\\Tester\\Desktop\\sublime_text_build_4113_x64\\Data\\Package Storage\\lsp_utils\\node-runtime\\14.17.6\\node\\node.exe', npm verb cli 'C:\\Users\\Tester\\Desktop\\sublime_text_build_4113_x64\\Data\\Package Storage\\lsp_utils\\node-runtime\\14.17.6\\node\\node_modules\\npm\\bin\\npm-cli.js', npm verb cli 'ci', npm verb cli '--scripts-prepend-node-path=true', npm verb cli '--verbose', npm verb cli '--production' npm verb cli ] npm info using npm@6.14.15 npm info using node@v14.17.6 npm verb npm-session e1c361eaca15bbb2 npm info prepare initializing installer npm verb prepare starting workers npm verb prepare installation prefix: C:\Users\Tester\Desktop\sublime_text_build_4113_x64\Data\Package Storage\LSP-json\14.17.6\language-server npm verb prepare using package-lock.json npm verb checkLock verifying package-lock data npm info prepare Done in 0.029s npm verb extractTree extracting dependencies to node_modules/ npm verb teardown shutting down workers. npm info teardown Done in 0.001s npm verb type system npm verb stack FetchError: request to https://registry.npmjs.org/vscode-json-languageserver/-/vscode-json-languageserver-1.3.4.tgz failed, reason: getaddrinfo EAI_FAIL registry.npmjs.org npm verb stack at ClientRequest. (C:\Users\Tester\Desktop\sublime_text_build_4113_x64\Data\Package Storage\lsp_utils\node-runtime\14.17.6\node\node_modules\npm\node_modules\node-fetch-npm\src\index.js:68:14) npm verb stack at ClientRequest.emit (events.js:400:28) npm verb stack at TLSSocket.socketErrorListener (_http_client.js:475:9) npm verb stack at TLSSocket.emit (events.js:400:28) npm verb stack at emitErrorNT (internal/streams/destroy.js:106:8) npm verb stack at emitErrorCloseNT (internal/streams/destroy.js:74:3) npm verb stack at processTicksAndRejections (internal/process/task_queues.js:82:21) npm verb cwd C:\Users\Tester\Desktop\sublime_text_build_4113_x64\Data\Package Storage\LSP-json\14.17.6\language-server npm verb Windows_NT 6.1.7601 npm verb argv "C:\\Users\\Tester\\Desktop\\sublime_text_build_4113_x64\\Data\\Package Storage\\lsp_utils\\node-runtime\\14.17.6\\node\\node.exe" "C:\\Users\\Tester\\Desktop\\sublime_text_build_4113_x64\\Data\\Package Storage\\lsp_utils\\node-runtime\\14.17.6\\node\\node_modules\\npm\\bin\\npm-cli.js" "ci" "--scripts-prepend-node-path=true" "--verbose" "--production" npm verb node v14.17.6 npm verb npm v6.14.15 npm ERR! code EAI_FAIL npm ERR! errno EAI_FAIL npm ERR! network request to https://registry.npmjs.org/vscode-json-languageserver/-/vscode-json-languageserver-1.3.4.tgz failed, reason: getaddrinfo EAI_FAIL registry.npmjs.org npm ERR! network This is a problem related to network connectivity. npm ERR! network In most cases you are behind a proxy or have bad network settings. npm ERR! network npm ERR! network If you are behind a proxy, please make sure that the npm ERR! network 'proxy' config is set properly. See: 'npm help config' npm verb exit [ 1, true ] npm timing npm Completed in 1543ms npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Tester\npm-cache\_logs\2021-09-02T02_57_45_343Z-debug.log ``` which is said "network connectivity" problem... weird. I am able to download the same file https://registry.npmjs.org/vscode-json-languageserver/-/vscode-json-languageserver-1.3.4.tgz from MS Edge in that Win7 VM. ## C:\Users\Tester\npm-cache\_logs\2021-09-02T02_57_45_343Z-debug.log ``` 0 info it worked if it ends with ok 1 verbose cli [ 1 verbose cli 'C:\\Users\\Tester\\Desktop\\sublime_text_build_4113_x64\\Data\\Package Storage\\lsp_utils\\node-runtime\\14.17.6\\node\\node.exe', 1 verbose cli 'C:\\Users\\Tester\\Desktop\\sublime_text_build_4113_x64\\Data\\Package Storage\\lsp_utils\\node-runtime\\14.17.6\\node\\node_modules\\npm\\bin\\npm-cli.js', 1 verbose cli 'ci', 1 verbose cli '--scripts-prepend-node-path=true', 1 verbose cli '--verbose', 1 verbose cli '--production' 1 verbose cli ] 2 info using npm@6.14.15 3 info using node@v14.17.6 4 verbose npm-session 3366c6a0006801e7 5 info prepare initializing installer 6 verbose prepare starting workers 7 verbose prepare installation prefix: C:\Users\Tester\Desktop\sublime_text_build_4113_x64\Data\Package Storage\LSP-json\14.17.6\language-server 8 verbose prepare using package-lock.json 9 verbose checkLock verifying package-lock data 10 silly tree LogicalTree { 10 silly tree name: undefined, 10 silly tree version: undefined, 10 silly tree address: '', 10 silly tree optional: false, 10 silly tree dev: false, 10 silly tree bundled: false, 10 silly tree resolved: undefined, 10 silly tree integrity: undefined, 10 silly tree dependencies: Map(1) { 10 silly tree 'vscode-json-languageserver' => LogicalTree { 10 silly tree name: 'vscode-json-languageserver', 10 silly tree version: '1.3.4', 10 silly tree address: 'vscode-json-languageserver', 10 silly tree optional: false, 10 silly tree dev: false, 10 silly tree bundled: false, 10 silly tree resolved: 'https://registry.npmjs.org/vscode-json-languageserver/-/vscode-json-languageserver-1.3.4.tgz', 10 silly tree integrity: 'sha512-+ghebnslXk6fVDySBrT0BVqozLDdmKY/qxgkDD4JtOQcU2vXc3e7jh7YyMxvuvE93E9OLvBqUrvajttj8xf3BA==', 10 silly tree dependencies: [Map], 10 silly tree requiredBy: [Set] 10 silly tree } 10 silly tree }, 10 silly tree requiredBy: Set(0) {} 10 silly tree } 11 info prepare Done in 0.028s 12 verbose extractTree extracting dependencies to node_modules/ 13 silly extractTree vscode-json-languageserver@1.3.4 -> C:\Users\Tester\Desktop\sublime_text_build_4113_x64\Data\Package Storage\LSP-json\14.17.6\language-server\node_modules\vscode-json-languageserver 14 silly tarball trying vscode-json-languageserver@1.3.4 by hash: sha512-+ghebnslXk6fVDySBrT0BVqozLDdmKY/qxgkDD4JtOQcU2vXc3e7jh7YyMxvuvE93E9OLvBqUrvajttj8xf3BA== 15 silly tarball no local data for vscode-json-languageserver@1.3.4. Extracting by manifest. 16 verbose teardown shutting down workers. 17 info teardown Done in 0s 18 verbose type system 19 verbose stack FetchError: request to https://registry.npmjs.org/vscode-json-languageserver/-/vscode-json-languageserver-1.3.4.tgz failed, reason: getaddrinfo EAI_FAIL registry.npmjs.org 19 verbose stack at ClientRequest. (C:\Users\Tester\Desktop\sublime_text_build_4113_x64\Data\Package Storage\lsp_utils\node-runtime\14.17.6\node\node_modules\npm\node_modules\node-fetch-npm\src\index.js:68:14) 19 verbose stack at ClientRequest.emit (events.js:400:28) 19 verbose stack at TLSSocket.socketErrorListener (_http_client.js:475:9) 19 verbose stack at TLSSocket.emit (events.js:400:28) 19 verbose stack at emitErrorNT (internal/streams/destroy.js:106:8) 19 verbose stack at emitErrorCloseNT (internal/streams/destroy.js:74:3) 19 verbose stack at processTicksAndRejections (internal/process/task_queues.js:82:21) 20 verbose cwd C:\Users\Tester\Desktop\sublime_text_build_4113_x64\Data\Package Storage\LSP-json\14.17.6\language-server 21 verbose Windows_NT 6.1.7601 22 verbose argv "C:\\Users\\Tester\\Desktop\\sublime_text_build_4113_x64\\Data\\Package Storage\\lsp_utils\\node-runtime\\14.17.6\\node\\node.exe" "C:\\Users\\Tester\\Desktop\\sublime_text_build_4113_x64\\Data\\Package Storage\\lsp_utils\\node-runtime\\14.17.6\\node\\node_modules\\npm\\bin\\npm-cli.js" "ci" "--scripts-prepend-node-path=true" "--verbose" "--production" 23 verbose node v14.17.6 24 verbose npm v6.14.15 25 error code EAI_FAIL 26 error errno EAI_FAIL 27 error network request to https://registry.npmjs.org/vscode-json-languageserver/-/vscode-json-languageserver-1.3.4.tgz failed, reason: getaddrinfo EAI_FAIL registry.npmjs.org 28 error network This is a problem related to network connectivity. 28 error network In most cases you are behind a proxy or have bad network settings. 28 error network 28 error network If you are behind a proxy, please make sure that the 28 error network 'proxy' config is set properly. See: 'npm help config' 29 verbose exit [ 1, true ] ``` --- But, if I manually run ``` set NODE_SKIP_PLATFORM_CHECK=1 "C:\Users\Tester\Desktop\sublime_text_build_4113_x64\Data\Package Storage\lsp_utils\node-runtime\14.17.6\node\node.exe" "C:\Users\Tester\Desktop\sublime_text_build_4113_x64\Data\Package Storage\lsp_utils\node-runtime\14.17.6\node\node_modules\npm\bin\npm-cli.js" "ci" "--scripts-prepend-node-path=true" "--verbose" "--production ``` in ``` C:\Users\Tester\Desktop\sublime_text_build_4113_x64\Data\Package Storage\LSP-json\14.17.6\language-server ``` in `cmd.exe` then it installs.
jfcherng commented 3 years ago

Update:

def node_env(self) -> Optional[Dict[str, str]]:
    if IS_WINDOWS_7_OR_LOWER:
        env = os.environ.copy()
        env.update({'NODE_SKIP_PLATFORM_CHECK': '1'})
        return env
    return None

fixes it. Now, LSP-json/css/html works on my clean Win7 VM. 🎆

jfcherng commented 3 years ago

Apart from that weird test fail, I am fine with the current state.