grupoboticario / nestjs-sap-rfc

NestJS SAP RFC Client, providing convenient ABAP business logic consumption from Nest.
MIT License
12 stars 3 forks source link

Facing issue while npm install #828

Closed prajyot1708 closed 1 year ago

prajyot1708 commented 1 year ago

Hi Team and @alvarolimajr ,

I am using below dockerfile. FROM ubuntu:22.04

RUN apt update && apt install -y curl \ unzip

RUN curl -sL https://deb.nodesource.com/setup_18.x | bash -

RUN apt install -y nodejs

RUN mkdir -p /usr/local/sap

Here you need to copy your SAP SDK (zip file)

COPY nwrfc750P_11-70002752.zip /tmp

The content file to nwrfcsdk.conf

START CONTENT

include nwrfcsdk

/usr/local/sap/nwrfcsdk/lib

END CONTENT

COPY nwrfcsdk.conf /etc/ld.so.conf.d/

RUN unzip -o /tmp/nwrfc750P_11-70002752.zip -d /usr/local/sap

ENV SAPNWRFC_HOME /usr/local/sap/nwrfcsdk

RUN ldconfig

And I am facing below issue on mac.

[15/16] RUN npm install:
42.21 npm notice
42.21 npm notice New minor version of npm available! 9.6.1 -> 9.8.0
42.21 npm notice Changelog: https://github.com/npm/cli/releases/tag/v9.8.0
42.21 npm notice Run npm install -g npm@9.8.0 to update!
42.21 npm notice 42.21 npm ERR! code 1 42.21 npm ERR! path /app/node_modules/node-rfc 42.21 npm ERR! command failed 42.21 npm ERR! command sh -c prebuild-install -r napi || cmake-js rebuild 42.21 npm ERR! [ 42.21 npm ERR! '/usr/bin/node', 42.21 npm ERR! '/app/node_modules/node-rfc/node_modules/.bin/cmake-js', 42.21 npm ERR! 'rebuild' 42.21 npm ERR! ] 42.21 npm ERR! prebuild-install warn install No prebuilt binaries found (target=5 runtime=napi arch=arm64 libc= platform=linux) 42.21 npm ERR! ERR! OMG C++ Compiler toolset is not available. Install proper compiler toolset with your package manager, eg. 'sudo apt-get install g++'. 42.21 npm ERR! ERR! OMG C++ Compiler toolset is not available. Install proper compiler toolset with your package manager, eg. 'sudo apt-get install g++'. 42.21 42.21 npm ERR! A complete log of this run can be found in: 42.21 npm ERR! /root/.npm/_logs/2023-07-19T06_25_44_263Z-debug-0.log

alvarolimajr commented 1 year ago

Hi @prajyot1708.

It's not clear to me whether you're running npm install directly on your machine or the docker image. If it's directly on your machine, you need to install the SDK for your MacOs operating system (Intel or ARM based). The process would be similar to installing for Linux, but would require the SDK for MacOs.

sudo mkdir -p /usr/local/sap/nwrfcsdk
sudo cp assets/mac/SAP_SDK_FOR_MACOS.zip /usr/local/sap/nwrfcsdk
sudo cp assets/mac/paths_fix.sh /usr/local/sap/nwrfcsdk
cd /usr/local/sap/nwrfcsdk
sudo unzip SAP_SDK_FOR_MACOS.zip
sudo rm SAP_SDK_FOR_MACOS.zip
sudo mv nwrfcsdk/* .
sudo rm -rf nwrfcsdk/

vi ~/.zshrc
# OR vi ~/.bash_profile
export SAPNWRFC_HOME="/usr/local/sap/nwrfcsdk"

File content (paths_fix.sh):

# SPDX-FileCopyrightText: 2013 SAP SE Srdjan Boskovic <srdjan.boskovic@sap.com>
#
# SPDX-License-Identifier: Apache-2.0

#!/bin/bash

if [ -z "$SAPNWRFC_HOME" ]; then
    echo "SAPNWRFC_HOME env variable not set. Should point to SAP NWRFC SDK library root"
    exit 1
fi

# run from sap nwrfc sdk root folder

#
# lib folder fix
#

cd lib
RPATH="$SAPNWRFC_HOME/lib"
for filename in *.dylib; do
    # LC_RPATH
    sudo install_name_tool -add_rpath $RPATH $filename
    # LC_ID_DYLIB
    sudo install_name_tool -id @rpath/$filename $filename
done

# LC_LOAD_DYLIB
sudo install_name_tool -change @loader_path/libicuuc.50.dylib @rpath/libicuuc.50.dylib libicui18n.50.dylib
sudo install_name_tool -change @loader_path/libicudata.50.dylib @rpath/libicudata.50.dylib libicui18n.50.dylib
sudo install_name_tool -change @loader_path/libicudata.50.dylib @rpath/libicudata.50.dylib libicuuc.50.dylib
cd ..

#
# bin folder fix
#

cd bin
for filename in *; do
    sudo chmod +x $filename
    # LC_RPATH
    sudo install_name_tool -add_rpath $RPATH $filename
    # LC_ID_DYLIB
    sudo install_name_tool -id @rpath/$filename $filename
    # LC_LOAD_DYLIB
    sudo install_name_tool -change @loader_path/libsapnwrfc.dylib @rpath/libsapnwrfc.dylib $filename
    sudo install_name_tool -change @loader_path/libsapucum.dylib @rpath/libsapucum.dylib $filename
done
sudo install_name_tool -change @loader_path/libsapucum.dylib @rpath/libsapucum.dylib ./startrfc
cd ..
alvarolimajr commented 1 year ago

Hi @prajyot1708. Did you get ahead? Do you need any help?

prajyot1708 commented 1 year ago

Hi @alvarolimajr I m running in docker container:

Below is the dockerfile need to use for MAC M1:

FOR MACOS

FROM --platform=linux/amd64 ubuntu:22.04

RUN apt update && apt install -y curl \ unzip

RUN curl -sL https://deb.nodesource.com/setup_18.x | bash -

RUN apt install -y nodejs

RUN mkdir -p /usr/local/sap

COPY nwrfc750P_11-70002752.zip /tmp

WORKDIR /app

COPY nwrfcsdk.conf /etc/ld.so.conf.d/nwrfcsdk.conf RUN unzip -o /tmp/nwrfc750P_11-70002752.zip -d /usr/local/sap ENV SAPNWRFC_HOME /usr/local/sap/nwrfcsdk