Skip to content

Commit

Permalink
npm_installer: Skip creating package.json
Browse files Browse the repository at this point in the history
If the package name in the `package.json` file generated by `npm
init` matched the name of one of the packages to be installed, npm
would error out. It turns out that npm will happily install packages
without the current directory containing a `package.json`, so just
do that instead of any gymnastics to avoid name the name collision.

fixes #409
  • Loading branch information
kamalmarhubi authored Nov 17, 2020
1 parent 1f86bfd commit 6192688
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lua/lspconfig/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,7 @@ function M.npm_installer(config)
set -e
mkdir -p "{{install_dir}}"
cd "{{install_dir}}"
[ ! -f package.json ] && npm init -y
npm install {{packages}} --no-package-lock --no-save --production
npm install {{packages}} --no-package-lock --no-save --no-color --no-progress
{{post_install_script}}
]]):gsub("{{(%S+)}}", install_params)
cmd:write(install_script)
Expand Down

0 comments on commit 6192688

Please sign in to comment.