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

Fix: GitHub Workflow Fails to Publish to NPM #139

Merged
merged 9 commits into from
Oct 3, 2023
Merged

Conversation

wesdevpro
Copy link
Member

@wesdevpro wesdevpro commented Oct 2, 2023

The Problem: The NPM publish workflow failed to run because no package-lock.json was present in the root directory. This should have been easily generated by running npm install. However, there were some dependency issues involving eslint and some in house dependencies used for configuring eslint in the nuxt-buefy project.

The Presented Solution (in this PR):

  1. Bump our in house eslint-config-buefy to the latest version (v0.0.3)
  2. Roll back eslint in the nuxt-buefy project to v4.18.2 to solve the conflict to allow npm install to generate the package-lock.json file
  3. Add a step to the GitHub Publish Workflow to generate the package-lock.json in the event it is not pushed to GitHub.

@wesdevpro wesdevpro requested a review from kikuomax October 2, 2023 21:20
@wesdevpro wesdevpro self-assigned this Oct 2, 2023
@wesdevpro wesdevpro linked an issue Oct 2, 2023 that may be closed by this pull request
@wesdevpro
Copy link
Member Author

wesdevpro commented Oct 2, 2023

@kikuomax @gmercey Circle CI Build Error

Now our Circle Ci tests are failing when the following command is run NODE_OPTIONS=--openssl-legacy-provider yarn test

The Logs

yarn run v1.22.19
$ npm run lint && jest

> nuxt-buefy@0.4.26 lint
> eslint lib test

 FAIL  test/module.test.js
  ● Test suite failed to run



    Vue packages version mismatch:

    - vue@2.7.14
    - vue-server-renderer@2.7.10

    This may cause things to work incorrectly. Make sure to use the same version for both.

      at Object.<anonymous> (node_modules/vue-server-renderer/index.js:8:9)
      at Object.<anonymous> (node_modules/@nuxt/vue-renderer/dist/vue-renderer.js:19:27)
      at Object.<anonymous> (node_modules/@nuxt/server/dist/server.js:19:21)

----------|----------|----------|----------|----------|-------------------|
File      |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
----------|----------|----------|----------|----------|-------------------|
All files |  Unknown |  Unknown |  Unknown |  Unknown |                   |
----------|----------|----------|----------|----------|-------------------|
Handlebars: Access has been denied to resolve the property "statements" because it is not an "own property" of its parent.
You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Handlebars: Access has been denied to resolve the property "branches" because it is not an "own property" of its parent.
You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Handlebars: Access has been denied to resolve the property "functions" because it is not an "own property" of its parent.
You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Handlebars: Access has been denied to resolve the property "lines" because it is not an "own property" of its parent.
You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        0.827s
Ran all test suites.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Exited with code exit status 1

Note: When I run npm test --openssl-legacy-provider on my local machine (Windows 10), I get the exact same error

Some Questions

  1. Why are we using yarn for testing/development when Buefy/Buefy is using NPM?
  2. Why are the test now failing?

@kikuomax
Copy link
Contributor

kikuomax commented Oct 3, 2023

@wesdevpro
I have investigated the issue, the following error was solved by upgrading nuxt:

Vue packages version mismatch:

    - vue@2.7.14
    - vue-server-renderer@2.7.10

The latest nuxt compatible with Vue 2.x was v2.17.1. After upgrading nuxt, the test failed with another error:

 FAIL  test/module.test.js
  ● Test suite failed to run

    Cannot find module 'node:util' from 'consola.deac7d5a.cjs'

      at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:221:17)
      at Object.<anonymous> (node_modules/consola/dist/shared/consola.deac7d5a.cjs:3:19)

This error suggested that consola package was using a prefixed Node package (node:*) that was introduced since Node v14.18 and v16, but jest-resolve did not understand it. So I also bumped jest to v29.7.0, which I felt too new though, and the test passed.

Bonus: we no longer need NODE_OPTIONS=--openssl-legacy-provider workaround.

- In the GitHub workflow to run the test failed due to Vue version
  mismatch. Fixed the error by bumping `nuxt` to `v2.17.1`. However,
  upgrading `nuxt` caused another error that suggested a `jest`
  dependency did not understand prefixed Node packages; e.g.,
  `node:util`. Fixes the error by bumping `jest` to `v29.7.0`.
- After upgrading `nuxt`, the OpenSSL workaround became unnecessary.
Fix: Fix: GitHub Workflow Fails to Publish to NPM (#139)
@codecov-commenter
Copy link

codecov-commenter commented Oct 3, 2023

Codecov Report

Merging #139 (02a3507) into master (f4cc5fd) will decrease coverage by 10.00%.
The diff coverage is n/a.

@@             Coverage Diff              @@
##            master     #139       +/-   ##
============================================
- Coverage   100.00%   90.00%   -10.00%     
============================================
  Files            1        2        +1     
  Lines            2       20       +18     
  Branches         0        5        +5     
============================================
+ Hits             2       18       +16     
- Misses           0        2        +2     

see 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@wesdevpro
Copy link
Member Author

Codecov Report

Merging #139 (f4ad6f0) into master (f4cc5fd) will decrease coverage by 10.00%.
The diff coverage is n/a.

@@             Coverage Diff              @@
##            master     #139       +/-   ##
============================================
- Coverage   100.00%   90.00%   -10.00%     
============================================
  Files            1        2        +1     
  Lines            2       20       +18     
  Branches         0        5        +5     
============================================
+ Hits             2       18       +16     
- Misses           0        2        +2     

see 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@kikuomax what is this?

@wesdevpro wesdevpro requested a review from kikuomax October 3, 2023 04:25
@kikuomax
Copy link
Contributor

kikuomax commented Oct 3, 2023

Codecov Report

Merging #139 (f4ad6f0) into master (f4cc5fd) will decrease coverage by 10.00%.
The diff coverage is n/a.

@@             Coverage Diff              @@
##            master     #139       +/-   ##
============================================
- Coverage   100.00%   90.00%   -10.00%     
============================================
  Files            1        2        +1     
  Lines            2       20       +18     
  Branches         0        5        +5     
============================================
+ Hits             2       18       +16     
- Misses           0        2        +2     

see 1 file with indirect coverage changes
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@kikuomax what is this?

@wesdevpro I don't know. I followed the link "see 1 file ...", and it did not look a big deal.

Copy link
Contributor

@kikuomax kikuomax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wesdevpro Looks good to me!

@wesdevpro wesdevpro merged commit e404ae4 into master Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Completed ✅
Development

Successfully merging this pull request may close these issues.

Fix:(Bug): GitHub Workflow Fails to Publish to NPM
3 participants