Yarn Syntax error on Ubuntu 16 at yarn --version - ubuntu-16.04

I installed Yarn on my Ubuntu 16.04 server.
Setup flow:
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
and then
sudo apt-get update && sudo apt-get install yarn
Apparently it doesn't end with an error:
...
Processing triggers for libc-bin (2.23-0ubuntu11) ...
But when I run yarn --version I get this error
root#AMS-148750:~# yarn --version
/usr/share/yarn/lib/cli.js:46083
let {
^
SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/usr/share/yarn/bin/yarn.js:24:13)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
Please let me know how to fix it. Thank you in advance.

that is because your node version is incompatible with yarn.Check your node version with node -version if you have an older version of node then upgrade it to latest version by using:
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
apt-get install -y nodejs

This looks like a too old nodejs version for the version of yarn installed from the repo. Please check the requirements for the yarn version you installed and make sure your server fulfills them.

There could be another reason for that. Your nodejs version is very old. You just need to upgrade your nodejs with below command (using npm).
sudo npm install -g n
sudo n stable
This will upgrade to latest stable version.
Worked for me.

I've got such error because I'm using nvm but I didn't install any node version :stuck_out_tongue_closed_eyes:
nvm list
N/A
iojs -> N/A (default)
node -> stable (-> N/A) (default)
unstable -> N/A (default)
Just install node version which you need, for example
nvm install 13.3.0

Related

postgresql-13-postgis-3 : Depends: libgdal20 (>= 2.0.1) but it is not going to be installed

I am trying to install the postgresql-13-postgis-3 package using following method on ubuntu 18.04 version. I have tried following method,
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
sudo wget --no-check-certificate --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt update -y; sudo apt install -y postgresql-13 postgresql-13-postgis-3 postgresql-13-postgis-3-scripts postgresql-13 postgresql-client-13
But I am getting following error,
postgresql-client-13 is already the newest version (13.5-1.pgdg18.04+1).
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
postgresql-13-postgis-3 : Depends: libgdal20 (>= 2.0.1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Can anyone suggest to me, how to install the postGIS in ubuntu 18.04? Any help will be highly appreciated.
The missing dependency is available in universe:
sudo add-apt-repository universe
sudo apt update
sudo apt install libgdal20

The "SCRAM-SHA-1" authentication mechanism requires libmongoc built with --enable-ssl

Getting error message while connecting to database using Laravel 5.4 and Mongodb 3.6
The "SCRAM-SHA-1" authentication mechanism requires libmongoc built with --enable-ssl
Its running fine in ubuntu 16.04 with same versions, but not in AWS Linux.
Installed LAMP [ php70, apach24 ] :
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-LAMP.html
Installed Mongodb [ 3.6 ] :
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-amazon/
Installed php-mongodb driver for php7:
sudo yum -y install php7-pear php70-devel gcc // completed
sudo pecl7 install mongodb // completed
sudo yum install openssl-devel // completed
php-mongodb driver installed and updated to php.ini, mongodb shows in phpinfo() as well.
we find there is libmongoc ssl disabled from phpinfo, Is that issue ?
How can we enable it ?
On Ubuntu 18.04 LTS, PHP 7.2.7
I had to install some extra packages:
sudo apt-get install -y libcurl4-openssl-dev pkg-config libssl-dev
Then re-install mongodb:
sudo pecl uninstall mongodb
sudo pecl install mongodb
Then check that SSL is enabled:
php -i | grep mongo
/etc/php/7.2/cli/conf.d/20-mongodb.ini,
mongodb
libmongoc bundled version => 1.11.0
libmongoc SSL => enabled
libmongoc SSL library => OpenSSL
libmongoc crypto => enabled
libmongoc crypto library => libcrypto
Restart php:
sudo service php7.2-fpm restart
Error, because of disabled libmongoc SSL and libmongoc Crypto from php-mongodb driver and enabled by following command.
sudo pecl7 config-set php_ini /etc/php.ini
After installing mongodb driver sudo pecl7 install mongodb, we should set the above.
now runs fine.
For those who have the error on an Alpine docker. You must add in your Dockerfile :
RUN apk add curl-dev openssl-dev
instead of sudo apt-get install -y libcurl4-openssl-dev pkg-config libssl-dev
I used RUN pecl config-set php_ini /etc/php.ini too
I get the same message using docker. I add to my Docker file
apt-get install -y libcurl4-openssl-dev pkg-config libssl-dev
and run
docker-compose up -d --build
Here is how I solved in CentOS 7
Remove mongodb extension:
pecl uninstall mongodb
Install openssl
sudo yum install openssl-devel
Reinstall MongoDB extension again
pecl install mongodb
On my Debian 9 module compillation fails with following error:
configure: error: OpenSSL libraries and development headers could not
be found
If you have same error try following:
apt-get remove libssl-dev
apt-get install libssl1.0-dev
As for me, this command does everything on Debian 9 and php 7.0
sudo apt-get install php-mongodb
Just restart Apache2 service afterwards

Ionic issue after installation

I need some helps to solve problems with ionic on my mac. For every command I launch from terminal with ionic, I receive the same error as shown below.
For example even if I give command ionic -v, I receive this:
$ ionic -v
/usr/local/lib/node_modules/ionic/dist/index.js:24
const [xcode, iosDeploy, iosSim,] = yield Promise.all([
^
SyntaxError: Unexpected token [
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:387:25)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (/usr/local/lib/node_modules/ionic/bin/ionic:8:11)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
I have checked the file /usr/local/lib/node_modules/ionic/dist/index.js, but all is fine. Even there's this parse error, I even tried with uninstall and reinstalled ionic without success. Can someone give me suggestions please?
I have solved this! My nodejs version was too old (5.6.0) and I have seen that it doesn't work with ionic cli, so I have installed before nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash
and then launch from terminal -> nvm install v6.10.3 to have last stable node js version, now all works again!
Just remove nodejs from your linux :
sudo apt remove nodejs
And install the latest version :
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get install -y nodejs
This come from the official website
This did the trick for me, Hope it helps :)
I got the same issue. But After re installed latest version (7) of node.js .
It is working Properly.
1st I did flowing command on Ubuntu.
npm cache clean -f
npm install npm -g
2nd
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash - sudo
apt-get install -y nodejs
Try this.
On Mac, I am able to solve it using upgrading node using following command :
nvm install node --reinstall-packages-from=node

Error installing php mongo driver after php5 upgrade

I upgraded my php5 version from 5.4 to 5.6 this way (debian 7.9) :
I added
deb http://packages.dotdeb.org wheezy-php56 all
deb-src http://packages.dotdeb.org wheezy-php56 all
to my /etc/apt/source.list file, and then :
apt-get update
apt-get install php5
All is running fine :
php --version
PHP 5.6.16-1
But i need to upgrade my php mongodb driver, and i got the following error :
pecl install mongodb
331 source files, building
running: phpize
Configuring for:
PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226
building in /tmp/pear/temp/pear-build-rootmStnQj/mongodb-1.0.0
running: /tmp/pear/temp/mongodb/configure --with-php-config=/usr/bin/php-config
[...]
checking for pkg-config... no
configure: error: Cannot find OpenSSL's libraries
ERROR: `/tmp/pear/temp/mongodb/configure --with-php-config=/usr/bin/php-config' failed
I have openssl and libssl-dev installed.
Any idea ?
I had same problem and following command worked for me.
apt-get install pkg-config
I had the same error. I installed the following dependencies before installing mongodb
sudo apt-get install -y autoconf g++ make openssl libssl-dev libcurl4-openssl-dev pkg-config libsasl2-dev libpcre3-dev
sudo pecl install mongodb

How to install cocoa pods in terminal?

I read cocoa pods documents and many times try to installed but always fail to installed because in starting steps i found one error so i can't install gems first. can anyone give me steps one by one? how to install or demo.
this is one link which i try.
http://www.raywenderlich.com/12139/introduction-to-cocoapods
OUTPUT in terminal
$ sudo gem install cocoapods
or i try
$ sudo gem install cocoapods -V
ERROR: While executing gem ... (TypeError)
nil can't be coerced into Fixnum
Thanks
Just try this before install cocoa pods
$ sudo gem update —system
then use this commond
$ sudo gem install cocoapods
Hope this will solved your issue.
Seems like an issue with your Ruby installation. You're running 1.8.7(mentioned in comment) which has been retired: https://www.ruby-lang.org/en/news/2013/06/30/we-retire-1-8-7/
Update Ruby(see https://www.ruby-lang.org/en/) and then run:
sudo gem update --system
sudo gem install cocoapods