cancel
Showing results for 
Search instead for 
Did you mean: 

Error when initializing 2105.9 OOB

3,480

Hi,

I am trying to setup OOB code with 2105.9 version. When running initialize command, below error is thrown. Can some one please help on resolving this. I installed nodejs and verified from commandprompt.

SAP Hybris version=2105.9

Command:

install.bat -r cx initialize -A local_property:initialpasswor....

Error:
[exec] Error: Unable to install package: Error: Unable to determine the path to the NPM tool: Error: Command failed: where npm

[exec] 'where' is not recognized as an internal or external command,

[exec] operable program or batch file.

[exec

Caused by: java.lang.IllegalStateException: external process returned non-zero exit code, command: [cmd, /c, set "ANT_OPTS=-Xmx1024m -Dfile.encoding=UTF-8" & set "PLATFORM_HOME=C:\CX2105OOB\CXCOMM210500P_9-70005661\hybris\bin\platform" & set "ANT_HOME=C:\CX2105OOB\CXCOMM210500P_9-70005661\hybris\bin\platform\apache-ant" & set "PATH=C:\CX2105OOB\CXCOMM210500P_9-70005661\hybris\bin\platform\apache-ant\bin;%PATH%" & ant clean all]

Is there any thing specific to verify on nodejs installation. I have updated System Variable "Path" to

....\hybris\bin\modules\npm-ancillary\npmancillary\resources\npm\node\node-v16.14.0-win-x64".

Are there any prerequisites to follow before installing recipe?

Accepted Solutions (1)

Accepted Solutions (1)

hjaenisch
Discoverer

Hi,

today I had the same issue. When trying to deploy (using first ant clean all), building the SmartEdit tools failed with the following output:

[exec] Error: Unable to install package: Error: Unable to determine the path to the NPM tool: Error: Command failed: where npm
     [exec] 'where' is not recognized as an internal or external command,
     [exec] operable program or batch file.

I assume, that your process runs also on a windows environment. The interesting point here in this message is: "where" is not recognized as an internal or external command. Sounds crazy, but it is just a windows command which is used by the RUSH process to determine the NPM path on the local system. So, the RUSH process has something under the hood which invokes that windows command to build up the PATH entries.

I checked the place where this call is triggered. Maybe it will help in your situation. Although it is not a proper solution, you can try the following:

Edit the file ../modules/npm-ancillary/npmancillary/buildcallbacks.xml. Lines 127 - 146 show something like this:

 <if>
<os family="windows" />
<then>
<exec executable="cmd" dir="@{path}" failonerror="@{failonerror}">
<arg value="/c"/>
<arg value="${loc.NODE_HOME}${file.separator}node"/>
<arg value="${ext.smartedittools.path}${file.separator}common${file.separator}scripts${file.separator}install-run-rush.js"/>
<env key="PATH" value="${loc.EXTRA_PATH}${path.separator}${env.PATH}"/>
<env key="RUSH_ALLOW_WARNINGS_IN_SUCCESSFUL_BUILD" value="1"/>
<arg line="@{arguments}"/>
</exec>
</then>
<else>
<exec dir="@{path}" executable="${loc.NODE_HOME}${file.separator}bin${file.separator}node" failonerror="@{failonerror}">
<env key="PATH" value="${loc.EXTRA_PATH}${path.separator}${env.PATH}"/>
<env key="RUSH_ALLOW_WARNINGS_IN_SUCCESSFUL_BUILD" value="1"/>
<arg line="${ext.smartedittools.path}${file.separator}common${file.separator}scripts${file.separator}install-run-rush.js @{arguments}"/>
</exec>
</else>
</if>

Line 134 is the key:

<env key="PATH" value="${loc.EXTRA_PATH}${path.separator}${env.PATH}"/>

In my case, the expression ${env.PATH} was not resolved. I did not finalize the investigations, but I guess, that this path entry is not resolved properly on a windows environment in the CX build scripts. So I assume, it is a bug in this special case.

As the PATH is not propagated to the build process, it does not know about a directory like C:\Windows\System32. This is exactly the place where the "where" command is located (where.exe). Obviously, this makes the trouble here and causes the build to fail with that exception.

As a quick hack, you can do the following: Just change the expression ${env.PATH} like this:

<env key="PATH" value="${loc.EXTRA_PATH}${path.separator}c:\Windows\System32"/>

In my case, with this change, the build process was working fine. Sure, it is not a solution. Take this just as a hint, maybe it helps.

best regards,

Henryk

0 Kudos

Hi Henryk,

Your solution really helped to understand the problem. I think the issue is for windows it should be "Path" not "PATH".

May be it should be ${env.Path} and not ${env.PATH}

Thanks,

M.Manesh

0 Kudos

hi Henryk, any update on this issue ?

swollmershaeuser
Explorer
0 Kudos

I looked into the CXCOMM220500P_10-80006942 version and there was surprisingly a change:

<env key="PATH" value="${loc.EXTRA_PATH}${path.separator}${env.Path}"/><!-- env.Path in WinOS is case-sensitive --><br>

now it is "env.Path" instead of "env.PATH". Sadly no change at all, it still fails with same error.

in user variables and in the system variables is in "Path" the value "C:\Windows\system32" provided.

I don't understand what the problem is ...

Error:

2023-03-16T12:23:14.855+0100 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
2023-03-16T12:23:14.855+0100 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
2023-03-16T12:23:14.855+0100 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Where:
2023-03-16T12:23:14.856+0100 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Build file 'C:\Users\...\SapCommerceDemoshop\installer\recipes\cx-for-spa\build.gradle' line: 603
2023-03-16T12:23:14.856+0100 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
2023-03-16T12:23:14.856+0100 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
2023-03-16T12:23:14.856+0100 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Execution failed for task ':recipes:cx-for-spa:buildSystem'.
2023-03-16T12:23:14.856+0100 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > external process returned non-zero exit code, command: [cmd, /c, set "ANT_OPTS=-Xmx2g -Dfile.encoding=UTF-8 -Dpolyglot.js.nashorn-compat=true -Dpolyglot.engine.WarnInterpreterOnly=false --add-exports java.xml/com.sun.org.apache.xpath.internal=ALL-UNNAMED --add-exports java.xml/com.sun.org.apache.xpath.internal.objects=ALL-UNNAMED" & set "PLATFORM_HOME=C:\Users\...\SapCommerceDemoshop\hybris\bin\platform" & set "ANT_HOME=C:\Users\...\SapCommerceDemoshop\hybris\bin\platform\apache-ant" & set "PATH=C:\Users\...\SapCommerceDemoshop\hybris\bin\platform\apache-ant\bin;%PATH%" & ant clean all]

EDIT:

changing it back to env.PATH works! O.o ... I don't understand it anymore ...

Answers (3)

Answers (3)

Please verify that location %SystemRoot%\System32 is set on your PATH...

The "where.exe" application is needed by the rush installation process

obaspinar
Member
0 Kudos

Hi,

you can enable this property and try, it worked for me.

smartedittools.only.build.once=true

mansurarisoy
Contributor
0 Kudos

It is possible that your installation directories (Hybris or node.js) have invalid characters (like space or special characters). Can you verify that your installation directories do not contain invalid characters?

Also can you check by executing echo %PATH% command to see whether any defined path in PATH variable has invalid character?

0 Kudos

Hi Mansur,

Thanks for your reply. I verified but couldn't find root cause yet. Any other suggestions?