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

Upgrade version of Node. Update dependencies #44

Merged
merged 11 commits into from
Aug 8, 2024
Merged

Conversation

palagdan
Copy link
Collaborator

@palagdan palagdan commented Aug 7, 2024

Resolve #43

@palagdan palagdan self-assigned this Aug 7, 2024
@palagdan
Copy link
Collaborator Author

palagdan commented Aug 7, 2024

@blcham
It is very strange that Docker Image CI fails. I tested it locally and it builds the image without any issues.

@blcham
Copy link
Contributor

blcham commented Aug 7, 2024

@palagdan Try to do testing PR from main (e.g. modify README.md only) and see if docker build works ... See also warning here:
image

@palagdan
Copy link
Collaborator Author

palagdan commented Aug 7, 2024

@blcham

These warnings were due to the actions/checkout@v2 in workflow file which had be deprecated. I updated to actions/checkout@v3. Now it should work fine.

@blcham
Copy link
Contributor

blcham commented Aug 7, 2024

@palagdan I tried it locally and I get the same error:

> ERROR [build 6/6] RUN npm run build                                                                                                                                                               3.3s 
------                                                                                                                                                                                                     
 > [build 6/6] RUN npm run build:                                                                                                                                                                          
0.294                                                                                                                                                                                                      
0.294 > [email protected] prebuild                                                                                                                                                       
0.294 > rimraf dist                                                                                                                                                                                        
0.294                                                                                                                                                                                                      
0.329 
0.329 > [email protected] build
0.329 > cross-env NODE_ENV=production webpack --mode production  --env env=prod
0.329 
0.767 (node:38) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
0.767 (Use `node --trace-deprecation ...` to show where the warning was created)
3.056 Error: error:0308010C:digital envelope routines::unsupported
3.056     at new Hash (node:internal/crypto/hash:69:19)
3.056     at Object.createHash (node:crypto:133:10)
3.056     at module.exports (/app/node_modules/webpack/lib/util/createHash.js:135:53)
3.056     at NormalModule._initBuildHash (/app/node_modules/webpack/lib/NormalModule.js:417:16)
3.056     at handleParseError (/app/node_modules/webpack/lib/NormalModule.js:471:10)
3.056     at /app/node_modules/webpack/lib/NormalModule.js:503:5
3.056     at /app/node_modules/webpack/lib/NormalModule.js:358:12
3.056     at /app/node_modules/loader-runner/lib/LoaderRunner.js:373:3
3.056     at iterateNormalLoaders (/app/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
3.056     at iterateNormalLoaders (/app/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
3.056     at /app/node_modules/loader-runner/lib/LoaderRunner.js:236:3
3.056     at runSyncOrAsync (/app/node_modules/loader-runner/lib/LoaderRunner.js:130:11)
3.056     at iterateNormalLoaders (/app/node_modules/loader-runner/lib/LoaderRunner.js:232:2)
3.056     at Array.<anonymous> (/app/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
3.056     at Storage.finished (/app/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
3.056     at /app/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
3.105 Browserslist: caniuse-lite is outdated. Please run:
3.105 npx browserslist@latest --update-db
3.105 
3.105 Why you should do it regularly:
3.105 https://github.com/browserslist/browserslist#browsers-data-updating
3.120 node:internal/crypto/hash:69
3.120   this[kHandle] = new _Hash(algorithm, xofLen);
3.120                   ^
3.120 
3.120 Error: error:0308010C:digital envelope routines::unsupported
3.120     at new Hash (node:internal/crypto/hash:69:19)
3.120     at Object.createHash (node:crypto:133:10)
3.120     at module.exports (/app/node_modules/webpack/lib/util/createHash.js:135:53)
3.120     at NormalModule._initBuildHash (/app/node_modules/webpack/lib/NormalModule.js:417:16)
3.120     at handleParseError (/app/node_modules/webpack/lib/NormalModule.js:471:10)
3.120     at /app/node_modules/webpack/lib/NormalModule.js:503:5
3.120     at /app/node_modules/webpack/lib/NormalModule.js:358:12
3.120     at /app/node_modules/loader-runner/lib/LoaderRunner.js:373:3
3.120     at iterateNormalLoaders (/app/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
3.120     at Array.<anonymous> (/app/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
3.120     at Storage.finished (/app/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
3.120     at /app/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
3.120     at /app/node_modules/graceful-fs/graceful-fs.js:123:16
3.120     at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3) {
3.120   opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
3.120   library: 'digital envelope routines',
3.120   reason: 'unsupported',
3.120   code: 'ERR_OSSL_EVP_UNSUPPORTED'
3.120 }
3.120 
3.120 Node.js v18.20.4
------
Dockerfile:24
--------------------
  22 |     
  23 |     # Build the application
  24 | >>> RUN npm run build
  25 |     
  26 |     #### Stage 2: Serve the React application from Nginx
--------------------
ERROR: failed to solve: process "/bin/sh -c npm run build" did not complete successfully: exit code: 1

@blcham
Copy link
Contributor

blcham commented Aug 7, 2024

I executed it as follows:

  • git checkout package.json package-lock.json
  • docker build .

@palagdan
Copy link
Collaborator Author

palagdan commented Aug 7, 2024

It is strange that it fails on the execution of npm run build. I tried it locally without docker and it works fine as well.
Also I tried to rebuild image without cache and it works.
Screenshot from 2024-08-07 14-40-40

@blcham
Copy link
Contributor

blcham commented Aug 7, 2024

@palagdan do i understand it correcly, that you cannot simulate failure of docker build ?

@palagdan
Copy link
Collaborator Author

palagdan commented Aug 7, 2024

@palagdan do i understand it correcly, that you cannot simulate failure of docker build ?

Locally no.

@palagdan
Copy link
Collaborator Author

palagdan commented Aug 7, 2024

@blcham

The problem was due to the updated Node.js version. Starting with Node.js v17, the default OpenSSL configuration changed, and some older cryptographic algorithms and modes are no longer supported by default. That’s why the solution I found is to set the environment variable:
NODE_OPTIONS=--openssl-legacy-provider sudo npm run dev

@blcham
Copy link
Contributor

blcham commented Aug 8, 2024

@palagdan what would it require to remove this option, can we even update it more so we would not need NODE_OPTIONS=--openssl-legacy-provider, please make fast investigation if possible -- so we at least know which dependencies causes those issues.

@blcham
Copy link
Contributor

blcham commented Aug 8, 2024

@palagdan, moreover, did you test that npm run dev actually works... i.e., it shows some UI?

@palagdan
Copy link
Collaborator Author

palagdan commented Aug 8, 2024

@blcham

I updated webpack to the latest version and made changes to the configuration because of the following message from the webpack team:

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "util": require.resolve("util/") }'
        - install 'util'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "util": false }

I decided to disable this polyfill for now.

@palagdan
Copy link
Collaborator Author

palagdan commented Aug 8, 2024

@palagdan, moreover, did you test that npm run dev actually works... i.e., it shows some UI?

Yes, after each update

@palagdan
Copy link
Collaborator Author

palagdan commented Aug 8, 2024

@palagdan what would it require to remove this option, can we even update it more so we would not need NODE_OPTIONS=--openssl-legacy-provider, please make fast investigation if possible -- so we at least know which dependencies causes those issues.

Yes, you’re right. I updated webpack to the latest version and it is no longer needed.

@palagdan palagdan requested a review from blcham August 8, 2024 09:37
package.json Outdated Show resolved Hide resolved
@kbss-cvut kbss-cvut deleted a comment from palagdan Aug 8, 2024
@blcham blcham merged commit 8f94dee into master Aug 8, 2024
1 check passed
@blcham blcham deleted the 43-update-node-version branch August 13, 2024 21:46
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

Successfully merging this pull request may close these issues.

Upgrade S-pipes-editor to Latest Node Version and Update Dependencies
2 participants