Openbravo Issue Tracking System - POS2
View Issue Details
0047399POS2Corepublic2021-07-15 11:352022-05-03 15:26
shuehner 
jarmendariz 
normalminorhave not tried
closedfixed 
5
 
 
No
0047399: npm ci fails with nodejs 16.x in openbravo custom script (preinstall)
Running npm ci in source.path using Node 16.x and npm 7.x it fails in Openbravo custom preinstall code

node --version v16.4.1
npm --version 7.18.1

> install
> node $npm_package_config_install

Validating npm dependencies included in Openbravo modules...
node:internal/fs/utils:343
    throw err;
    ^

Error: ENOENT: no such file or directory, stat '/home/huehner/ob/branches/pi_pos2_pg/node_modules_global'
    at Object.statSync (node:fs:1526:3)
    at __node_internal_ (node:internal/fs/utils:767:8)
    at Object.rmdirSync (node:fs:1146:15)
    at Object.<anonymous> (/home/huehner/ob/branches/pi_pos2_pg/modules/org.openbravo.client.kernel/build-scripts/install-deps.js:53:4)
    at Module._compile (node:internal/modules/cjs/loader:1095:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1124:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:816:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)
    at node:internal/main/run_main_module:17:47 {
  errno: -2,
  syscall: 'stat',
  code: 'ENOENT',
  path: '/home/huehner/ob/branches/pi_pos2_pg/node_modules_global'
}
1.) Use nodejs 16 from the deb.nodesource.com repo
deb http://deb.nodesource.com/node_16.x [^] sid main

2.) Apply attached path to allow the newer node/npm versions in our version check
3.) Run npm ci in source.path
No tags attached.
related to backport 0049196TAP closed jarmendariz npm ci fails with nodejs 16.x in openbravo custom script (preinstall) 
blocks defect 0047401 closed jarmendariz npm ci fails with node 16.x/npm 7.x 'org.openbravo.core2@*' is not in the npm registry. 
blocks feature request 0048870 closed jarmendariz Add support to Node 16/Npm 8 
diff hack-for-node-16.diff (1,016) 2021-07-15 11:38
https://issues.openbravo.com/file_download.php?file_id=16015&type=bug
Issue History
2021-07-15 11:35shuehnerNew Issue
2021-07-15 11:35shuehnerAssigned To => Retail
2021-07-15 11:35shuehnerTriggers an Emergency Pack => No
2021-07-15 11:36shuehnerNote Added: 0130501
2021-07-15 11:38shuehnerFile Added: hack-for-node-16.diff
2021-07-15 11:39shuehnerSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=22890#r22890
2021-07-15 12:37shuehnerNote Added: 0130506
2021-07-15 12:40dmiguelezResolution time => 1629928800
2021-07-15 12:40dmiguelezAssigned ToRetail => platform
2021-07-15 12:40dmiguelezStatusnew => acknowledged
2021-07-15 12:41shuehnerRelationship addedblocks 0047401
2021-08-16 12:18AugustoMauchResolution time1629928800 => 1631656800
2022-02-01 08:05alostaleAssigned Toplatform => Triage Platform Base
2022-03-28 12:19shuehnerRelationship addedblocks 0048870
2022-03-31 09:56AugustoMauchNote Added: 0136198
2022-04-06 14:44hgbotNote Added: 0136357
2022-04-06 14:55jarmendarizStatusacknowledged => scheduled
2022-04-12 11:46jarmendarizAssigned ToTriage Platform Base => jarmendariz
2022-04-13 09:00jarmendarizStatusscheduled => acknowledged
2022-04-13 09:00jarmendarizStatusacknowledged => scheduled
2022-04-15 11:36hgbotResolutionopen => fixed
2022-04-15 11:36hgbotStatusscheduled => closed
2022-04-15 11:36hgbotFixed in Version => PR22Q3
2022-04-15 11:36hgbotNote Added: 0136524
2022-04-15 11:36hgbotNote Added: 0136525
2022-05-03 15:26jarmendarizIssue cloned0049196
2022-05-03 15:26jarmendarizRelationship addedrelated to 0049196

Notes
(0130501)
shuehner   
2021-07-15 11:36   
Code in in backoffice but reporting as POS2 as added via pos2 project.

NodeJS 16.x will be the next Active LTS around October so we should check and try to fix this in the next 1-2 month to be able to find/fix whatever other issues are behind it.
(0130506)
shuehner   
2021-07-15 12:37   
Problem is line 53 of modules/org.openbravo.client.kernel/build-scripts/install-deps.js

the rmDirSync('node_modules_global')
Fails if that folder does not exist (and we delete it in our pre-install file)

Possible fixes: force=true or check if exists before doing the rmDirSync call.
(0136198)
AugustoMauch   
2022-03-31 09:56   
Removing due date because it is a minor issue
(0136357)
hgbot   
2022-04-06 14:44   
Merge Request created: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/553 [^]
(0136524)
hgbot   
2022-04-15 11:36   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: 9c4650648de59e78adc5e227390c56f9695ff41e
Author: Javier Armendáriz <javier.armendariz@openbravo.com>
Date: 15-04-2022 11:31:04
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/9c4650648de59e78adc5e227390c56f9695ff41e [^]

Fixed ISSUE-47399: Npm install script fails when executed in Node16

Starting from Node 16, fs.rmdirSync is deprecated and is set to
throw on non-existent paths. It is recommended to replace this call
with fs.rm, which was introduced in Node 14.14.0, so this fix is
compatible with both Node v14 and v16.

---
M modules/org.openbravo.client.kernel/build-scripts/install-deps.js
---
(0136525)
hgbot   
2022-04-15 11:36   
Merge request merged: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/553 [^]