Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error during installation when npm is already installed #483

Closed
GuentherJulian opened this issue Oct 16, 2020 · 2 comments · Fixed by #485
Closed

Error during installation when npm is already installed #483

GuentherJulian opened this issue Oct 16, 2020 · 2 comments · Fixed by #485
Labels
npm node package manager scripts related to shell scripts (bash and CMD)

Comments

@GuentherJulian
Copy link

Expected behavior

As a developer, I want devonfw ide to setup correctly so that I can use it without issues

Actual behavior

When setting up devonfw ide in a katacoda environment (e.g. https://katacoda.com/devonfw/scenarios/cobigen-cli), error messages are shown during the installation process and 'npm' cannot be installed. The installer show the message 'npm is already installed'.

Steps to reproduce

  1. Open a katacoda tutorial (e.g. https://katacoda.com/devonfw/scenarios/cobigen-cli)
  2. Execute the following steps:

Related/Dependent Issues

Comments/Hints:

Console log:
...
Do you accept these terms of use and all license agreements? (yes/no) yes

Downloading java-11.0.5_10-linux.tar.gz from https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.5%2B10/OpenJDK11U-jdk_x64_linux_hotspot_11.0.5_10.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 675 100 675 0 0 2500 0 --:--:-- --:--:-- --:--:-- 2500
100 187M 100 187M 0 0 8721k 0 0:00:22 0:00:22 --:--:-- 7253k
Successfully extracted archive java-11.0.5_10-linux.tar.gz to updates/extracted
Successfully installed java
To be fully functional please rerun 'devon' command to update your PATH properly.
openjdk version "11.0.5" 2019-10-15
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.5+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.5+10, mixed mode)

*** Setting up mvn ***
Starting installation of maven to /root/devonfw/software/maven from https://archive.apache.org/dist/maven/maven-3//3.6.2/binaries/apache-maven-3.6.2-bin.tar.gz
Downloading maven-3.6.2.tar.gz from https://archive.apache.org/dist/maven/maven-3//3.6.2/binaries/apache-maven-3.6.2-bin.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 8928k 100 8928k 0 0 18.0M 0 --:--:-- --:--:-- --:--:-- 18.0M
Successfully extracted archive maven-3.6.2.tar.gz to updates/extracted
Successfully installed maven
To be fully functional please rerun 'devon' command to update your PATH properly.
Successfully created /root/devonfw/conf/.m2/settings-security.xml
Apache Maven 3.6.2 (40f52333136460af0dc0d7232c0dc0bcf0d9e117; 2019-08-27T15:06:16Z)
Maven home: /root/devonfw/software/maven
Java version: 11.0.5, vendor: AdoptOpenJDK, runtime: /root/devonfw/software/java
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.15.0-111-generic", arch: "amd64", family: "unix"

*** Setting up npm ***
npm is already installed at /usr/bin/npm

*** Setting up ng ***
/root/devonfw/scripts/command/../functions: line 73: /root/devonfw/software/node/bin/npm: No such file or directory
Failed to run command: '/root/devonfw/software/node/bin/npm' install -g @angular/cli@latest --unsafe

******** ATTENTION ********
ERROR: Failed to install angular-cli ('/root/devonfw/software/node/bin/npm')
We are sorry for the inconvenience. Please check the above errors, resolve them and try again.
Exit code was 127
ERROR: command 'ng setup' failed with exit code 127

Affected version:

  • Linux (Ubuntu 18.04.4 LTS)
  • Browser: -
@GuentherJulian GuentherJulian added the bug Something isn't working label Oct 16, 2020
@hohwille
Copy link
Member

@GuentherJulian thanks for filing this issue and your helpful error description.
Indeed you found a bug that we seemed to miss out in our current tests.
If I am not mistaken the bug is here and in the following lines:

local npm_command="${DEVON_IDE_HOME}/software/node/npm"

I see the following options to fix this:

  1. at the linked code-place we can first check if npm is available in the path and get its installation (which npm)
  2. generally expect that npm is on the path and invoke it relatively (npm) instead of absolutely (${DEVON_IDE_HOME}/software/node/npm).
  3. always install npm explicitly and use it from the current devonfw-ide installation

I would actually propose option 3. as we always follow the sandbox principle and want to be in control of the version and config of our tools whereas with a global installation we end up with all the problems and errors we had earlier and avoid with devonfw-ide already for all other tools.

@hohwille hohwille added this to the release:2020.08.003 milestone Oct 16, 2020
@hohwille hohwille added npm node package manager scripts related to shell scripts (bash and CMD) and removed bug Something isn't working labels Oct 16, 2020
@hohwille
Copy link
Member

For option 3. we need to fix here:

if command -v npm &> /dev/null

@hohwille hohwille linked a pull request Oct 16, 2020 that will close this issue
hohwille added a commit that referenced this issue Oct 19, 2020
* drop obsolete angular-cli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
npm node package manager scripts related to shell scripts (bash and CMD)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants