1

I'm setting up a new server (Ubuntu 18.10), and I can't seem to get the latest Babel installed. I'm doing:

apt-get -y install npm
sudo npm install -g babel-cli
npm install --save-dev @babel/core

Yet when I look at the version it tells me I'm only on version 6.26.3 (not what I want, as some of the plugins I need are reliant on > 7.0 version - thus re-building the server)

Any suggestions on what to try?

UPDATE: Not sure if this is related, but for some reason the server has 2 instances of npm, with quite different versions:

root@east:/home/steampunkdev/web/xxx.net/node_modules# /usr/bin/npm -v
5.8.0
root@east:/home/steampunkdev/web/xxxx.net/node_modules# /usr/local/bin/npm -v
6.13.0

UPDATE 2: This is what I get when I try and find the latest version of the babel-core package:

npm view babel-core version
6.26.3

I just don't get why its not seeing 7.7.2 as the latest.

Andrew Newby
  • 1,041
  • 1
  • 22
  • 48
  • NPM modules are not installed from the apt sources. NPM has it's own module repositories. – Gerald Schneider Nov 08 '19 at 13:39
  • @GeraldSchneider ah ok thanks for the clarification. Any ideas why it keeps insisting on installing the older version of Babel, and not 7.7.2 (like I want) . I'm a bit of a noob when it comes to Linux, as I tend to deal more with Windows machines – Andrew Newby Nov 08 '19 at 13:40

1 Answers1

1

Ok, so after discussing with one of the maintainers of Babel ( https://github.com/babel/babel/issues/10688#issuecomment-552114492 ) , he helped me with the solution. I was trying to install babel-cli , which is a v6 version of Babel. For v7 you have to use the new logic of:

npm -g install @babel/core
npm -g install @babel/cli
npm -g install @babel/preset-env
npm -g install @babel/polyfill

I did this, and now I get v 7.7.2 perfectly :) Hoepfully this helps someone else

Andrew Newby
  • 1,041
  • 1
  • 22
  • 48