Skip to content
This repository was archived by the owner on Oct 16, 2021. It is now read-only.

v6 beta for z/OS - npm not working #90

Closed
rich335z opened this issue Jun 29, 2017 · 21 comments
Closed

v6 beta for z/OS - npm not working #90

rich335z opened this issue Jun 29, 2017 · 21 comments

Comments

@rich335z
Copy link

All npm commands are failing.

If under /bin/sh, receiving the following error on all npm commands (e.g. npm --version, npm ls, npm config --global, etc):

npm 2: FSUM7332 syntax error: got (), expecting Word

If under bash, receive the following error on all npm commands:

/u/rjack11/node-v6.10.3-os390-s390x/bin/npm: line 1: unexpected EOF while looking for matching ``'
/u/rjack11/node-v6.10.3-os390-s390x/bin/npm: line 2: syntax error: unexpected end of file

Based on prior systax errors during install, I suspected AUTOCVT issues, but this may not be the case. I have uninstalled/reinstalled multiple times upon removal/disablement in .profile of the the following environment settings, and still encounter the same errors:

# _BPXK_AUTOCVT=ON                                  
# _CEE_RUNOPTS="FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)" 
# export _TAG_REDIR_ERR=txt                         
# export _TAG_REDIR_IN=txt                          
# export _TAG_REDIR_OUT=txt

Removal of these items from .profile results in following defaults:

rjack11:/u/rjack11/node-v6.10.3-os390-s390x: >echo $_BPXK_AUTOCVT
OFF
rjack11:/u/rjack11/node-v6.10.3-os390-s390x: >echo $_CEE_RUNOPTS
FILETAG(AUTOCVT,NOAUTOTAG),TRAP(ON)
rjack11:/u/rjack11/node-v6.10.3-os390-s390x: >echo $_TAG_REDIR_ERR

rjack11:/u/rjack11/node-v6.10.3-os390-s390x: >echo $_TAG_REDIR_IN

rjack11:/u/rjack11/node-v6.10.3-os390-s390x: >echo $_TAG_REDIR_OUT

Given that I receive different error responses depending on whether I'm in /bin/sh or bash, I ran the install under both shells, but it had no affect on the result.

Not sure where to go from here... please advise.

Thanks,
Rich

@jBarz
Copy link

jBarz commented Jun 29, 2017

I am curious about the file tag on npm.
What is the output for "ls -T <path to npm>"

@Karagines
Copy link

Karagines commented Jun 29, 2017

Here is the output from a number of ls commands.

MJKARAG:/u/rjack11/node-v6.10.3-os390-s390x/bin:>ls -T npm
                    npm
MJKARAG:/u/rjack11/node-v6.10.3-os390-s390x/bin:>ls -a npm
npm
MJKARAG:/u/rjack11/node-v6.10.3-os390-s390x/bin:>ls -l npm
lrwxrwxrwx   1 RJACK11  OEGROUP       38 Jun 28 22:40 npm -> ../lib/node_modules/npm/bin/npm-cli.js

@jBarz
Copy link

jBarz commented Jun 29, 2017

ls-T didn't output the encoding.
Could you try "chtag -p <path to npm>"

Can you also test running a simple hello world file

#!node
console.log("hello, world");

@jBarz jBarz self-assigned this Jun 29, 2017
@rich335z
Copy link
Author

Node itself seems to work fine. I've been able to run several existing apps that I have.

rjack11:/u/rjack11/node-v6.10.3-os390-s390x/bin: >node
> console.log("hello world");
hello world
undefined

Looks like npm and npm-cli.js are tagged as ISO8859-1, while node is tagged as IBM-1047:

rjack11:/u/rjack11/node-v6.10.3-os390-s390x/bin: >chtag -p node
t IBM-1047    T=on  node
rjack11:/u/rjack11/node-v6.10.3-os390-s390x/bin: >chtag -p npm
t ISO8859-1   T=on  npm
rjack11:/u/rjack11/node-v6.10.3-os390-s390x/bin: >chtag -p ../lib/node_modules/npm/bin/npm-cli.js
t ISO8859-1   T=on  ../lib/node_modules/npm/bin/npm-cli.js

If I remove the tags from the npm files, I still get the errors.

./npm: line 1: unexpected EOF while looking for matching ``'
./npm: line 2: syntax error: unexpected end of file

If I explicitly tag the npm files as IBM-1047, I get different errors:

./npm: line 2: syntax error near unexpected token `;'
./npm: line 2: `;(function () { // wrapper in case we're in module_context mode'

@jBarz
Copy link

jBarz commented Jun 29, 2017

That file should not be tagged. I wonder how it got the tag.
Can you display the tag information from within the pax file like so:

pax -v -o T -f <path to pax> node-v6.10.3-os390-s390x/lib/node_modules/npm/bin/npm-cli.js

It is also odd that the node binary has the Text flag turned on.

@rich335z
Copy link
Author

rich335z commented Jul 1, 2017

- untagged    T=off -rwxr-xr-x   1 JENKINS  SUDOGRP     1996 Mar 29 14:01 node-v6.10.3-os390-s390x/lib/node_modules/npm/bin/npm-cli.js

@jBarz
Copy link

jBarz commented Jul 2, 2017

Are you unpaxing using the following command?
pax -rzf <path to pax.Z file>

That command should not change the filetags.

@rich335z
Copy link
Author

rich335z commented Jul 2, 2017

I am using the pax -rf <path_to_pax.Z_file> -x pax command that's referenced on the DeveloperWorks page

@rich335z
Copy link
Author

rich335z commented Jul 5, 2017

However, to clarify... as originally referenced in this issue, the tagging of npm doesn't appear to be the problem. I have re-installed multiple times, with and without auto-tagging, and still encounter the syntax error. My latest replies here are simply based on my most recent install attempt. So, to address the question of file tagging...

I uninstalled, then again removed the auto-tagging settings from my .profile, and removed bash so that I come in on the the default shell (/bin/sh).

I re-installed while under default environment, and see that the npm symlink and the npm-cli.js file install as untagged, but I still receive the syntax error:

rjack11:/u/rjack11/node-v6.10.3-os390-s390x/bin: >chtag -p ../lib/node_modules/npm/bin/npm-cli.js
- untagged    T=off ../lib/node_modules/npm/bin/npm-cli.js
rjack11:/u/rjack11/node-v6.10.3-os390-s390x/bin: >chtag -p npm
- untagged    T=off npm
rjack11:/u/rjack11/node-v6.10.3-os390-s390x/bin: >npm --version
npm 2: FSUM7332 syntax error: got (), expecting Word

@jBarz
Copy link

jBarz commented Jul 5, 2017

FSUM7332 indicates that the shell is unable to process the npm script.

Now that there is no file tagging, i am curious about the codepage of the npm script.
Could you post the output of
od -x <path to npm> | head

@rich335z
Copy link
Author

rich335z commented Jul 5, 2017

rjack11:/u/rjack11/node-v6.10.3-os390-s390x/bin: >od -x npm | head
0000000000      7B5A    61A4    A299    6182    8995    6185    95A5    4095
0000000020      9684    8515    5E4D    86A4    9583    A389    9695    404D
0000000040      5D40    C040    6161    40A6    9981    9797    8599    4089
0000000060      9540    8381    A285    40A6    857D    9985    4089    9540
0000000100      9496    84A4    9385    6D83    9695    A385    A7A3    4094
0000000120      9684    8515    4040    6161    40A6    8995    8496    A6A2
0000000140      7A40    99A4    9595    8995    8740    7F95    9794    4082
0000000160      9381    887F    4089    9540    A388    89A2    4086    9693
0000000200      8485    9940    A689    9393    4089    95A5    9692    8540
0000000220      E6E2    C86B    4095    96A3    4095    9684    854B    1540

@jBarz
Copy link

jBarz commented Jul 6, 2017

That indicates that it is in the ebcdic codepage which is good.

npm 2: FSUM7332 syntax error: got (), expecting Word

The error message above seems to indicate that npm is being run as a shell script because that error code comes from the builtin shell utility.
The first line in the npm script indicates that it should be run by node and not the shell.

#!/usr/bin/env node

Is node on your PATH?
You can do this to put it on your PATH
export PATH=/u/rjack11/node-v6.10.3-os390-s390x/bin:$PATH

@rich335z
Copy link
Author

rich335z commented Jul 6, 2017

Ahh... that makes sense. Node is indeed in my PATH. However, /usr/bin/env does not exist in our environment... env is located at /bin in our systems. This also helps explain the early issue I had with the unpack.pl script. It looks like the Apache Spark for z/OS folks have encountered this scenario, as well.

I'll have to work with my sysadmins to get a symlink added to /usr/bin, and that may take a while. In the meantime, I guess I could try updating the npm-cli.js script to point at `/bin/env' unless you have any other ideas.

@jBarz
Copy link

jBarz commented Jul 6, 2017

node <path to npm>

should work too I think.

@rich335z
Copy link
Author

rich335z commented Jul 6, 2017

Well, this gets me past the syntax error, but now results in the process being immediately killed when issuing npm command:

rjack11:/u/rjack11: >npm --version
[1] + Done(137) npm --version
  67683 Killed  /u/rjack11/node-v6.10.3-os390-s390x/bin/npm

@jBarz
Copy link

jBarz commented Jul 6, 2017

The download page suggests setting a STEPLIB environment variable.
Did you apply that?

@rich335z
Copy link
Author

rich335z commented Jul 6, 2017

Oh shoot! I forgot I had disabled that while going through the re-install iterations.

rjack11:/u/rjack11/richapp1: >npm --version
3.10.10

SUCCESS! Thanks a ton for the help!

@jBarz jBarz closed this as completed Jul 6, 2017
@yugeshpothuru
Copy link

can one of you let me know what is the steplib to be added. I'm also having the same issues.

@guruchauhan2
Copy link

This worked for me ..
try updating the npm-cli.js script to point at `/bin/env' unless you have any other ideas.

@guruchauhan2
Copy link

but getting --
npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm ERR! errno UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm ERR! request to https://registry.npmjs.org/express failed, reason: unable to get local issuer certificate

npm ERR! A complete log of this run can be found in:
npm ERR! /u/tsuf70f/.npm/_logs/2021-03-05T13_45_52_651Z-debug.log

@zsw007
Copy link
Member

zsw007 commented Mar 5, 2021

but getting --
npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm ERR! errno UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm ERR! request to https://registry.npmjs.org/express failed, reason: unable to get local issuer certificate

npm ERR! A complete log of this run can be found in:
npm ERR! /u/tsuf70f/.npm/_logs/2021-03-05T13_45_52_651Z-debug.log

Hi, v6 is out of service. We suggest upgrading to IBM SDK for Node .js - z/OS 14.0.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants