Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node build -all fails on node v18 and above. #21

Closed
axyl opened this issue Oct 3, 2023 · 12 comments
Closed

node build -all fails on node v18 and above. #21

axyl opened this issue Oct 3, 2023 · 12 comments

Comments

@axyl
Copy link

axyl commented Oct 3, 2023

Fetching EspoCRM repository...
  Downloading EspoCRM archive from Github...
  Unzipping...
Installing EspoCRM instance...
  Creating config...
  Npm install...
node:internal/errors:867
  const err = new Error(message);
              ^

Error: Command failed: npm ci
    at checkExecSyncError (node:child_process:885:11)
    at Object.execSync (node:child_process:957:15)
    at buildEspo (file:///E:/source/espoExtensions/ext-template/node_modules/espo-extension-tools/build.js:224:8)
    at file:///E:/source/espoExtensions/ext-template/node_modules/espo-extension-tools/build.js:155:9
    at new Promise (<anonymous>)
    at install (file:///E:/source/espoExtensions/ext-template/node_modules/espo-extension-tools/build.js:149:12)
    at file:///E:/source/espoExtensions/ext-template/node_modules/espo-extension-tools/build.js:29:25 {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 19568,
  stdout: null,
  stderr: null
}

Node.js v18.16.0

Node v16 is okay, but Node v16 is EOL.

@yurikuzn
Copy link
Collaborator

yurikuzn commented Oct 3, 2023

Does npm ci work?

@axyl
Copy link
Author

axyl commented Oct 3, 2023

Yup

@yurikuzn
Copy link
Collaborator

yurikuzn commented Oct 3, 2023

I cannot look soon as having other work to do. Any help would be appreciated.

@axyl
Copy link
Author

axyl commented Oct 3, 2023

Possible dupe of #14, but that wasn't really fixed.

I will drill down more.

@yurikuzn
Copy link
Collaborator

yurikuzn commented Oct 3, 2023

Regarding npm ci, I meant when running from the site directory. It installs node modules for the Espo instance. It's the same what we do for the main Espo repository. Since there was no any reports, it could an issue specific to environment.

@axyl
Copy link
Author

axyl commented Oct 3, 2023

Ok. After a npm install, npm ci runs without error in the site directory.

When I last looked at this problem a few months back, I came across a change with execSync between Node 16 -> 18. I'll dig deeper on that.

@axyl
Copy link
Author

axyl commented Oct 3, 2023

After doing the above manually... ( from the site directory, npm install and then npm ci), node build -all works from the base directory.

@yurikuzn
Copy link
Collaborator

yurikuzn commented Oct 4, 2023

Interesting. So npm install is what solved the problem? I wonder if our Espo repository does not work w/o running npm install on new node versions (which would change package-lock, which is not good).

@yurikuzn
Copy link
Collaborator

yurikuzn commented Oct 4, 2023

We tested npm ci (w/o install) on the Espo repository on node 19 and it was working.

@axyl
Copy link
Author

axyl commented Oct 4, 2023

For me, it seems that the package-lock.json file extracted from the archive.zip is corrupt. It's not valid JSON.

npm install works, because it overwrites the package-lock.json, but npm ci reports...

"verbose shrinkwrap failed to load package-lock.json JSONParseError: Unexpected token "d" (0x64) in JSON at position 0 while parsing near "dule-transforms": {\r...""

and the package-lock.json's first line is...

dule-transforms": {

So the extracted file has been truncated, as downloading the original zip from https://github.com/espocrm/espocrm/archive/stable.zip doesn't have the corruption.

Stopping the build.js after the unzip and checking the extracted contents in the espocrm-stable directory shows the corruption.

composer.lock is also corrupt.

This is running on Windows.

I'm thinking that it might be an issue with node-unzipper, there seems to be a lot of people there with open issues about extractions not working properly.

I'll keep drilling.

@axyl
Copy link
Author

axyl commented Oct 4, 2023

ZJONSSON/node-unzipper#271 is pretty revealing with the number of projects having issues...

Switching out unzipper for something like adm-zip works.

                .then(() => {
                    console.log('  Unzipping...');
                    const archive= new AdmZip(cwd + '/site/archive.zip');
                    archive.extractAllTo(cwd + '/site', true);
                    fs.unlinkSync(cwd + '/site/archive.zip');
                    helpers.moveDir(
                        cwd + '/site/espocrm-' + branch.replace('/', '-'),
                        cwd + '/site'
                    )
                    .then(() => resolve());
                });

@yurikuzn
Copy link
Collaborator

yurikuzn commented Oct 6, 2023

Thanks for the help. Fix: espocrm/extension-tools@3fa2809, 22c1d65.

For those who has the extension-tools dependency in their extension, it's recommended to upgrade to 0.0.4.

@yurikuzn yurikuzn closed this as completed Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants