juanfranblanco / vscode-solidity

Visual Studio Code language support extension for Solidity smart contracts in Ethereum https://marketplace.visualstudio.com/items?itemName=JuanBlanco.solidity
MIT License
892 stars 191 forks source link

Make npm package compatible with Windows #436

Open allisterb opened 9 months ago

allisterb commented 9 months ago

I'm able to compile and use this language server on Windows:

$ npm run build:cli

> solidity@0.0.165 build:cli
> tsup src/server.ts -d dist/cli && sh scripts/add_shebang.sh dist/cli/server.js

CLI Building entry: src/server.ts
CLI Using tsconfig: tsconfig.json
CLI tsup v7.1.0
CLI Using tsup config: c:\Projects\vscode-solidity\tsup.config.ts
CLI Target: es6
CLI Cleaning output folder
CJS Build start
CJS dist\cli\server.js 122.84 KB
CJS ⚡️ Build success in 1478ms
'sh' is not recognized as an internal or external command,
operable program or batch file.

Just the last step of running the sh script won't work in a Windows environment.

However I cannot install the npm package:

$ npm install @llllvvuu/vscode-solidity-langserver                                                             
npm ERR! code EBADPLATFORM                                                                                     
npm ERR! notsup Unsupported platform for n@9.2.0: wanted {"os":"!win32"} (current: {"os":"win32","arch":"x64"})
npm ERR! notsup Valid OS:    !win32                                                                            
npm ERR! notsup Valid Arch:  undefined                                                                         
npm ERR! notsup Actual OS:   win32                                                                             
npm ERR! notsup Actual Arch: x64                                                                               

npm ERR! A complete log of this run can be found in:                                                           
npm ERR!     C:\Users\Allister\AppData\Local\npm-cache\_logs\2023-12-28T15_29_28_234Z-debug-0.log              

Same thing if I pack and try to install locally from the vscode-solidity repo folder.

I'm not a node developer so I'm not sure which dependency is causing this. This is from the log file:

1357 verbose stack Error: Unsupported platform
1357 verbose stack     at checkPlatform (C:\nodejs\node_modules\npm\node_modules\npm-install-checks\index.js:35:25)
1357 verbose stack     at Arborist.[checkPlatform] (C:\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:237:5)
1357 verbose stack     at Arborist.[checkEngineAndPlatform] (C:\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:231:29)
1

However I've been using the language server in my own Windows-based project and haven't encountered any issues or Windows incompatibility.