Closed haitzlm closed 4 months ago
In trying to fix the javascript error on destroy, we ran a compile before deploy. That itself created another issue where the CSS was broken.
Putting into development.rb these values below fixed the css- and were also helpful mostly for debugging the javascript issue in dev. I dont think i need them in production.
config.assets.compile = true config.assets.digest = false
@haitzlm Destroy still isn't working for me on the most recent csschanges branch.
hmnn perplexing. can you check the javascript link in the header of html page and let me know the address?
Lisa Haitz
Developer UC Libraries
From: Glen Horton @.> Sent: Monday, May 13, 2024 1:53:25 PM To: uclibs/staff-directory-23 @.> Cc: Haitz, Lisa (haitzlm) @.>; Mention @.> Subject: Re: [uclibs/staff-directory-23] MERGE FIRST:css changes (PR #173)
External Email: Use Caution
@haitzlmhttps://github.com/haitzlm Destroy still isn't working for me on the most recent csschanges branch.
— Reply to this email directly, view it on GitHubhttps://github.com/uclibs/staff-directory-23/pull/173#issuecomment-2108435152, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AADYQVTDQDIOITXQKTXZF2LZCD4ZLAVCNFSM6AAAAABHRJFVO2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBYGQZTKMJVGI. You are receiving this because you were mentioned.Message ID: @.***>
The link is http://localhost:3000/packs/js/application-b74e82561692dfd08320.js
The file resolves for me, but in the middle of the JS file source is this error:
throw new Error("Module build failed (from ./node_modules/babel-loader/lib/index.js):\nError: Cannot find package '@babel/plugin-proposal-private-methods' imported from /Users/hortongn/Development/uclibs/staff-directory/babel-virtual-resolve-base.js
so - i think you need both branches to get it to work locally. perhaps i should have moved the confit/environments/development.rb from css branch to javascript branch .
Lisa Haitz
Developer UC Libraries
From: Haitz, Lisa (haitzlm) @.> Sent: Monday, May 13, 2024 2:01:42 PM To: uclibs/staff-directory-23 @.>; uclibs/staff-directory-23 @.> Cc: Mention @.> Subject: Re: [uclibs/staff-directory-23] MERGE FIRST:css changes (PR #173)
hmnn perplexing. can you check the javascript link in the header of html page and let me know the address?
Lisa Haitz
Developer UC Libraries
From: Glen Horton @.> Sent: Monday, May 13, 2024 1:53:25 PM To: uclibs/staff-directory-23 @.> Cc: Haitz, Lisa (haitzlm) @.>; Mention @.> Subject: Re: [uclibs/staff-directory-23] MERGE FIRST:css changes (PR #173)
External Email: Use Caution
@haitzlmhttps://github.com/haitzlm Destroy still isn't working for me on the most recent csschanges branch.
— Reply to this email directly, view it on GitHubhttps://github.com/uclibs/staff-directory-23/pull/173#issuecomment-2108435152, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AADYQVTDQDIOITXQKTXZF2LZCD4ZLAVCNFSM6AAAAABHRJFVO2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBYGQZTKMJVGI. You are receiving this because you were mentioned.Message ID: @.***>
hmnn that's new . ok - will check
Lisa Haitz
Developer UC Libraries
From: Glen Horton @.> Sent: Monday, May 13, 2024 2:06:20 PM To: uclibs/staff-directory-23 @.> Cc: Haitz, Lisa (haitzlm) @.>; Mention @.> Subject: Re: [uclibs/staff-directory-23] MERGE FIRST:css changes (PR #173)
External Email: Use Caution
The link is http://localhost:3000/packs/js/application-b74e82561692dfd08320.js
The file resolves for me, but in the middle of the JS file source is this error:
throw new Error("Module build failed (from ./node_modules/babel-loader/lib/index.js):\nError: Cannot find package @.***/plugin-proposal-private-methods' imported from /Users/hortongn/Development/uclibs/staff-directory/babel-virtual-resolve-base.js
— Reply to this email directly, view it on GitHubhttps://github.com/uclibs/staff-directory-23/pull/173#issuecomment-2108480395, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AADYQVXOQYOXI7DW2OTR6YTZCD6JZAVCNFSM6AAAAABHRJFVO2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBYGQ4DAMZZGU. You are receiving this because you were mentioned.Message ID: @.***>
so babel is required, obviously. the error you are getting is saying Babel is unable to find the package @babel/plugin-proposal-private-methods. This is in the package.json and yarn.lock (line 462) as well as a babel.config.js. So, it appears your dev environment has to be updated? ChatGPT suggests the following, which you probably already know, but thought I would document here:
Here's a step-by-step guide to resolve the issue related to Babel and the missing @babel/plugin-proposal-private-methods package:
1. Pull the Latest Code from GitHub
Ensure your colleague has the latest version of the code:
Pull from GitHub: He should pull the latest changes from the repository to make sure his local codebase is up to date.
bash
git pull origin main # Replace 'main' with whatever your default branch is
2. Install JavaScript Dependencies
After updating the code, the next step is to ensure that all JavaScript dependencies are correctly installed:
Install Packages with Yarn: If your project uses Yarn (which is common in Rails projects using Webpacker), your colleague should run:
bash
yarn install
This command installs all dependencies defined in package.json and ensures that yarn.lock is updated and in sync.
3. Check for Configuration Discrepancies
Ensure Correct Babel Configuration: Verify that the babel.config.js is set up correctly in his environment, as per the repository. It should include @babel/plugin-proposal-private-methods if your application requires it.
Sync Configuration Files: Make sure all configuration files, such as webpacker.yml and any specific environment settings in config/webpack, are correctly set up and consistent with what's working in your environment.
4. Clear Caches
Sometimes, stale caches can cause issues:
Clear Yarn Cache: Run yarn cache clean.
Clear Webpacker Cache: Sometimes, it helps to clear the cache that Webpacker might have:
bash
./bin/webpacker clean # Or the appropriate command if configured differently
5. Rebuild Assets
After ensuring that all configurations and dependencies are correct and up to date, have him rebuild the assets:
Recompile JavaScript: This can be done using:
bash
./bin/webpack --watch # Or another appropriate Webpack command as configured in your project
6. Check Environment Variables
Environment Variables: Make sure that any necessary environment variables are set correctly in his development environment. This includes checking .env files or environment-specific settings that might influence how packages are loaded or built.
7. Try Running the Rails Server
After following these steps, he should try running the Rails server again and see if the JavaScript errors are resolved.
Summary
Following these steps should help ensure that your colleague's development environment is correctly set up and consistent with other environments, such as yours, where JavaScript is working as expected. If the problem persists even after taking these measures, it may be necessary to look deeper into any specific local environment issues or discrepancies in system configurations (like different OS versions, node versions, etc.).
updated: # for debugging javascript on dev. Should help destroy to work as well in dev.
config.assets.compile = true config.assets.digest = false