NomicFoundation / hardhat-vscode

Solidity and Hardhat support for Visual Studio Code
https://hardhat.org
MIT License
163 stars 36 forks source link

solidity-language-server ENOENT: solidity-language-server/out/antlr/Solidity.tokens #558

Closed Ethnical closed 2 months ago

Ethnical commented 2 months ago

Hey there, On the last version 0.8.0 of the solidity-language-server I got an error. I tried with multiples version of node (with the latests version and other version from 18 to 20) but always failed with the same error.

  code: 'ENOENT',
  path: '/Users/ethnical/.nvm/versions/node/v20.5.0/lib/node_modules/@nomicfoundation/solidity-language-server/out/antlr/Solidity.tokens'

Here, the test is with the 20.5.0 and the npm version is: 9.8.0. I don't know why I got this missing antlr/Solidity.tokens if someone have an idea would happy to know for know. I am downgrading to 0.7.3 that is current working for me there.

Error: ENOENT: no such file or directory, open '/Users/ethnical/.nvm/versions/node/v20.5.0/lib/node_modules/@nomicfoundation/solidity-language-server/out/antlr/Solidity.tokens'
    at Object.openSync (node:fs:602:3)
    at Object.readFileSync (node:fs:470:35)
    at /Users/ethnical/.nvm/versions/node/v20.5.0/lib/node_modules/@nomicfoundation/solidity-language-server/out/index.js:87:30951
    at /Users/ethnical/.nvm/versions/node/v20.5.0/lib/node_modules/@nomicfoundation/solidity-language-server/out/index.js:56:70348
    at node_modules/@solidity-parser/parser/dist/index.cjs.js (/Users/ethnical/.nvm/versions/node/v20.5.0/lib/node_modules/@nomicfoundation/solidity-language-server/out/index.js:301:129281)
    at /Users/ethnical/.nvm/versions/node/v20.5.0/lib/node_modules/@nomicfoundation/solidity-language-server/out/index.js:2:1341
    at Object.<anonymous> (/Users/ethnical/.nvm/versions/node/v20.5.0/lib/node_modules/@nomicfoundation/solidity-language-server/out/index.js:2897:89590)
    at Module._compile (node:internal/modules/cjs/loader:1233:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1287:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: '/Users/ethnical/.nvm/versions/node/v20.5.0/lib/node_modules/@nomicfoundation/solidity-language-server/out/antlr/Solidity.tokens'
}

For reproducing, I just tried to install with a simple npm install and the package name.

npm install @nomicfoundation/solidity-language-server -g

I am on Macos Sillicon maybe this can help?

Thanks!

kanej commented 2 months ago

I have been able to reproduce this locally. It looks like our packaging config is behaving different with the latest version of npm.

kanej commented 2 months ago

@Ethnical can you try the latest version v0.8.1?