`--version` is not working as expected if installed via npm
See original GitHub issueIssue
It’s using the package.json
in the working directory…
Examples
Directory without package.json
elm-language-server -v
/home/user/.npm-global/lib/node_modules/@elm-tooling/elm-language-server/node_modules/web-tree-sitte
var Module=void 0!==Module?Module:{};!function(e,t){"function"==typeof define&&define.amd?define([],t):
ule.hasOwnProperty(e)&&(t[e]=Module[e]);Module.arguments=[],Module.thisProgram="./this.program",Module.
a="function"==typeof importScripts,i="object"==typeof process&&"function"==typeof require&&!r&&!a,n=!r&
,l||(l=require("path")),e=l.normalize(e),n=o.readFileSync(e),t?n:n.toString()},Module.readBinary=functi
gv.length>1&&(Module.thisProgram=process.argv[1]
Error: ENOENT: no such file or directory, open '/home/user/dotfiles/package.json'
at Object.openSync (fs.js:447:3)
at Object.readFileSync (fs.js:349:35)
at Function.module.exports.sync (/home/user/.npm-global/lib/node_modules/@elm-tooling/elm-langua
at getVersion (/home/user/.npm-global/lib/node_modules/@elm-tooling/elm-language-server/node_mod
at Object.<anonymous> (/home/user/.npm-global/lib/node_modules/@elm-tooling/elm-language-server/
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:643:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
at Module.require (internal/modules/cjs/loader.js:683:19)))))
Directory with package.json
It shows the local version…
elm-language-server -v
1.0.0
Related code
Fixes
- Make the typescript import (disallowed by current config) of
package.json
work and replace dependency - Copy current version into code or file in compile step
- Look for other dependencies that actually work as expected
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Error npm is known not to run on Node.js v10.24.1 and how to ...
Download and install the latest version of nodejs. · Open you terminal and verify you have the latest version using node -v ....
Read more >Inconsistency between node versions of npm and yarn #812
The engine "node" is incompatible with this module. Expected version ">=4.5.0". If the current behavior is a bug, please provide the steps to ......
Read more >Common errors | npm Docs
Some strange issues can be resolved by simply running npm cache clean and trying again. If you are having trouble with npm install...
Read more >npm-install - npm Docs
Description. This command installs a package and any packages that it depends on. If the package has a package-lock, or an npm shrinkwrap...
Read more >Webpack - npm
webpack. Webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
If we add more args and help, we should probably use a args parser library. Current implementation feels hacky.
Forget about that windows log, I somehow ended up calling the old haskell version of the server…