cicsdev / cics-nodejs-invoke

Sample Node.js application that uses the invoke API from the ibm-cics-api module to call COBOL programs included in the CICS® catalog manager
Apache License 2.0
6 stars 10 forks source link

Error: Cannot find module 'form-data' #8

Open namnetes opened 3 years ago

namnetes commented 3 years ago

Hello,

Below the error when starting the process : npm start

> cics_nodejs_invoke@0.1.0 start /u/MYUSER/nodejs/cics/cics-nodejs-invoke/projects/cics-nodejs-invoke                              
> node server.js                                                                                                                    

iconv-lite warning: javascript files use encoding different from utf-8. See https://github.com/ashtuchkin/iconv-lite/wiki/Javascript
-source-file-encodings for more info.                                                                                               
internal/modules/cjs/loader.js:969                                                                                                  
  throw err;                                                                                                                        
  ^                                                                                                                                 

Error: Cannot find module 'form-data'                                                                                               
Require stack:                                                                                                                      
- /u/MYUSER/nodejs/cics/cics-nodejs-invoke/projects/cics-nodejs-invoke/node_modules/request/request.js                             
- /u/MYUSER/nodejs/cics/cics-nodejs-invoke/projects/cics-nodejs-invoke/node_modules/request/index.js                               
- /u/MYUSER/nodejs/cics/cics-nodejs-invoke/projects/cics-nodejs-invoke/node_modules/ibm-cics-api/index.js                          
- /u/MYUSER/nodejs/cics/cics-nodejs-invoke/projects/cics-nodejs-invoke/server.js                                                   
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)                                                     
    at Function.Module._load (internal/modules/cjs/loader.js:842:27)                                                                
    at Module.require (internal/modules/cjs/loader.js:1026:19)                                                                      
    at require (internal/modules/cjs/helpers.js:72:18)                                                                              
    at Object.<anonymous> (/u/MYUSER/nodejs/cics/cics-nodejs-invoke/projects/cics-nodejs-invoke/node_modules/request/request.js:15:
16)                                                                                                                                 
    at Module._compile (internal/modules/cjs/loader.js:1138:30)                                                                     
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10) 
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)                                           
    at Module.load (internal/modules/cjs/loader.js:986:32)                                                              
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)                                                    
    at Module.require (internal/modules/cjs/loader.js:1026:19) {                                                        
  code: 'MODULE_NOT_FOUND',                                                                                             
  requireStack: Y                                                                                                       
    '/u/MYUSER/nodejs/cics/cics-nodejs-invoke/projects/cics-nodejs-invoke/node_modules/request/request.js',            
    '/u/MYUSER/nodejs/cics/cics-nodejs-invoke/projects/cics-nodejs-invoke/node_modules/request/index.js',              
    '/u/MYUSER/nodejs/cics/cics-nodejs-invoke/projects/cics-nodejs-invoke/node_modules/ibm-cics-api/index.js',         
    '/u/MYUSER/nodejs/cics/cics-nodejs-invoke/projects/cics-nodejs-invoke/server.js'                                   
  ¨                                                                                                                     
}                                                                                                                       
npm ERR] code ELIFECYCLE                                                                                                
npm ERR] errno 1                                                                                                        
npm ERR] cics_nodejs_invoke@0.1.0 start: `node server.js`                                                               
npm ERR] Exit status 1                                                                                                  
npm ERR]                                                                                                                
npm ERR] Failed at the cics_nodejs_invoke@0.1.0 start script.                                                           
npm ERR] This is probably not a problem with npm. There is likely additional logging output above.                      

npm ERR] A complete log of this run can be found in:                                                                    
npm ERR]     /u/MYUSER/.npm/_logs/2020-11-19T11_02_58_396Z-debug.log                                                   

We are using version 12.18.0 of node.js with CICS 5.5 on z/OS V2R3

Can anyone help me ? Thanks in advance. Thank you

markcocker commented 3 years ago

Can you describe the sequence of events ahead of running npm start, and in particular if you had any errors when running npm install to resolve dependencies.

namnetes commented 3 years ago

Hello,

Sorry for this late response.

I cloned the repository on my Windows 10 PC then I launched followed as described the procedure and launched the npm install always on Windows without any error message.

Then, from IDz I transferred the entire project to USS.

Here is what I find in the directories :

../cics-nodejs-invoke/projects/cics-nodejs-invoke/node_modules/form-data/lib>
browser.js
form_data.js
populate.js

In the error message it is the 'form-data' module that is sought.

But in the folder I found form_data.js and renaming the file to form-data.js doesn't change anything.

Best regards

namnetes commented 3 years ago

Hello,

What's new with my problem ?

Initially I launched the npm install from my Windows workstation in order to recover all the dependencies... since the Z is not connected to the Internet.

In doing so, all the package.json files contained references to the disk locations of my Windows machine. So I launched a FIND AND REPALCE script in order to adjust these files with the project locations under USS.

But it still fails and I don't know why.

Does somebody have an idea ?