`npm install` ends with "Killed"

32,504

Solution 1

I am running into a similar issue installing npm packages and getting the message "Killed" and a non-zero exit status. For my scenario, it was because my system was running out of memory and I had no swap configured. Configuring swap fixed my problem.

Solution 2

I haved same problem, my solution:

  sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
  sudo /sbin/mkswap /var/swap.1
  sudo /sbin/swapon /var/swap.1

this commands changed configuration for swap

Solution 3

To solve this issue on 14.04 and 16.04:

sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon --show
sudo cp /etc/fstab /etc/fstab.bak
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
sudo sysctl vm.swappiness=10
echo 'vm.swappiness=10' | sudo tee -a /etc/sysctl.conf
sudo sysctl vm.vfs_cache_pressure=50
echo 'vm.vfs_cache_pressure=50' | sudo tee -a /etc/sysctl.conf

This will create a swap file of 1GB

Solution 4

Trying running npm install cross-spawn and then npm install again to see if that works. It looks like whats happening is when you run npm install npm looks inside your package.json provided by telesope and is running a deprecated package

Solution 5

I got the same issue when running npm run build in a VM with a single core CPU and 1GB RAM. Increasing the RAM to 4GB resolved this issue.

Share:
32,504

Related videos on Youtube

kramer65
Author by

kramer65

Updated on July 09, 2022

Comments

  • kramer65
    kramer65 almost 2 years

    I'm trying to run Telescope (a meteor app) on an Ubuntu 16.04 server. I follow the instructions in the readme:

    curl https://install.meteor.com/ | sh
    git clone [email protected]:TelescopeJS/Telescope.git
    npm install
    

    The first two commands run without an error, but the last command end in Killed:

    $ npm install
    npm WARN deprecated [email protected]: cross-spawn no longer requires a build toolchain, use it instead!
    extract:moment → gunzTarP ▐ ╢█████████████████████████████████████████████████░░░░░░░░░░╟
    Killed
    

    Since it doesn't give any information I'm unsure what could be wrong here. Does anybody know how I can solve this? All tips are welcome!

    [EDIT] Using the tip of @Mills in the comments I first ran npm install cross-spawn and then npm install again. This fixed the npm install issue, but when I now try to run the app using meteor it ends with "Killed" again:

    $ meteor
    Killednloading [email protected]_4...        |
    

    Any more ideas?

    • M1lls
      M1lls almost 8 years
      looks like cross-spawn-async is deprecated try npmjs.com/package/cross-spawn instead
    • kramer65
      kramer65 almost 8 years
      @Mills - I'm not very familiar with npm. Could you explain a bit more on how I can do that?
    • M1lls
      M1lls almost 8 years
      trying running npm install cross-spawn and then npm install again to see if that works. It looks like whats happening is when you run npm install npm looks inside your package.json provided by telesope and is running a deprecated package
    • kramer65
      kramer65 almost 8 years
      It did indeed solve that issue. Thanks for that. But when I now try to run the app using meteor, it ends in "Killed" again. Any ideas?
    • M1lls
      M1lls almost 8 years
      What did the error message say before it gave you the "killed" output? Looks to me like opening an issue on the telescope repo might be best because the build process shouldn't be this broken.
  • sankargorthi
    sankargorthi over 7 years
    I was running a vagrant box with default settings (512MB in RAM). Adding 2 cpus and 1024MB RAM fixed this for me.
  • kujiy
    kujiy over 6 years
    I limited the resource of my docker container. Unreal. Adding memswap_limit fixed the problem. Thanks.
  • Eugene Wang
    Eugene Wang almost 6 years
    Thank you so much, it worked for me. I use the Digital Ocean minimum server ( 512 MB ) and this solution worked for me.
  • Adiii
    Adiii almost 6 years
    facing the same issue in docker just reduce container memory and its works
  • shiva
    shiva over 5 years
    free -m total used free shared buff/cache available Mem: 7938 4968 278 92 2690 2594 Swap: 5119 2 5117 after this i have run npm install command but i got sudo npm install npm WARN deprecated [email protected]: Use ngx-filter-pipe instead. npm WARN deprecated [email protected]: Typings is deprecated in favor of NPM @types -- see README for more information Killed ............] / fetchMetadata: sill mapToRegistry uri registry.npmjs.org/webpack-subresource-integrity
  • Yuriy Korman
    Yuriy Korman over 5 years
    Hello Shiva! Please post your package.json
  • Admin
    Admin over 5 years
    That's not going to work in some situations. Some Node modules include binary components which may be system-dependent. (For an obvious example: node_modules from a Linux system will not be portable to Windows, and vice versa.)
  • Sugam Malviya
    Sugam Malviya over 5 years
    Thank you so much, In t2.nano AWS EC2 configuration it worked.
  • zakaria amine
    zakaria amine about 5 years
    I followed this digitalocean.com/community/tutorials/… for setting swap on ubuntu, although it seems a bit old. So far so good.
  • Mostafa Soufi
    Mostafa Soufi almost 5 years
    Worked for me. Thank you. 👍🏻
  • AtAFork
    AtAFork about 4 years
    @zakariaamine this DigitalOcean article is the updated version (for Ubuntu 18.04) of the article you linked to
  • Aaron Miller
    Aaron Miller almost 4 years
    Perfect. Worked for my Ubuntu LTS 18.4 on AWS Lighsail. Thanks!
  • VityaSchel
    VityaSchel almost 3 years
    What if I only have 512 mb of ram on server?
  • wlarcheveque
    wlarcheveque over 2 years
    Also, node_modules is a gargantuan folder of thousands of files, this transfer would not be very fast.
  • oschvr
    oschvr about 2 years
    Thank you worked for Ubuntu 18.04 on EC2 !