Cannot run Fiware tutorial on github

77 Views Asked by At

I am trying to run the tutorial on https://github.com/FIWARE/tutorials.Time-Series-Data but I can't. Cygwin gives me the following error when I run ./services create:

$ ./services create
./services: line 16: $'\r': command not found
: invalid option 17: set: -
set: usage: set [-abefhkmnptuvxBCEHPT] [-o option-name] [--] [-] [arg ...]
./services: line 18: $'\r': command not found
./services: line 30: syntax error near unexpected token $'{\r''
'/services: line 30: loadData () {

It seems like the script has

 Windows-style line endings (\r\n or carriage return + line feed) which are causing the problems. I tried the command "dos2unix ./services" but getting the following error: 
': not a valid identifierort:

I've even tried wsl with Ubuntu and Alpine distros but still the same error: ': not a valid identifierort:

I am running out of options at this stage so any help would be appreciated.

1

There are 1 best solutions below

3
Jason Fox On

From the tutorial documentation:

The NGSI-v2 tutorials are designed to run under any Unix environment, the tested configuration and GitPod environment is currently based on Ubuntu 22.04.2 LTS. However, there may be some minor issues when running the tutorials directly on Windows machines or Apple M1 Silicon amd64 systems, and the following Virtual Box set-up or WSL set-up can be used when facing issues.

You can verify this by running the tutorial using GitPod directly on a virtual Unix system.

It seems to me that the version you have locally on your Windows box has altered line endings some how - maybe you viewed a file and the editor "corrected" it for you by mistake? You can rectify these issues using the dos2unix utility.

dos2unix provision-devices
dos2unix import-data

... and repeat on any other file that is still not working for you.