phetsims / perennial

Maintenance tools that won't change with different versions of chipper checked out
MIT License
3 stars 5 forks source link

Build Failure: Cannot find module 'acorn' #256

Closed mattpen closed 2 years ago

mattpen commented 2 years ago

As part of deploying CCK:AC 1.0.0, @samreid added a dependency on the npm module acorn to chipper. However, npm on phet-server failed to install this when running npm update in chipper with the appropriate sha checked out. I manually ran rm -rf node_modules && npm install in chipper master, which successfully added chipper/node_modules/acorn. We ran the production deploy again afterwards and it successfully completed.

I'm not sure how we would reproduce this error to test fixes, so I'm just going to keep an eye on the build failures to see if this becomes persistent.

pixelzoom commented 2 years ago

I'm unable to deploy 1.0.4-rc.1 for fourier-making-waves, likely because of this problem. The grunt build task is failing, details below. I'm guessing other deploys and MRs would be similarly affected. So if the workaround that @mattpen described above is required, that’s something the build tools should be doing.

Raising priority to high, and adding @samreid to assignees.

% grunt --version
grunt-cli v1.3.2
grunt v1.4.1
% npm --version
6.14.12
% node --version
v14.16.1
% pull-all.sh
% cd fourier-making-waves
% grunt rc --brands=phet --branch=1.0
...
Running "build" task
Building runnable repository (fourier-making-waves, brands: phet)
Building brand: phet
...
- /usr/local/lib/node_modules/grunt-cli/bin/grunt
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/Users/cmalley/PhET/GitHub/chipper/node_modules/acorn-import-assertions/lib/index.js:8:38)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
Full Error details:
Error: Cannot find module 'acorn'
Require stack:
- /Users/cmalley/PhET/GitHub/chipper/node_modules/acorn-import-assertions/lib/index.js
- /Users/cmalley/PhET/GitHub/chipper/node_modules/webpack/lib/javascript/JavascriptParser.js
- /Users/cmalley/PhET/GitHub/chipper/node_modules/webpack/lib/javascript/JavascriptModulesPlugin.js
- /Users/cmalley/PhET/GitHub/chipper/node_modules/webpack/lib/WebpackOptionsApply.js
- /Users/cmalley/PhET/GitHub/chipper/node_modules/webpack/lib/webpack.js
- /Users/cmalley/PhET/GitHub/chipper/node_modules/webpack/lib/index.js
- /Users/cmalley/PhET/GitHub/chipper/js/grunt/webpackBuild.js
- /Users/cmalley/PhET/GitHub/chipper/js/grunt/buildStandalone.js
- /Users/cmalley/PhET/GitHub/chipper/js/grunt/copySupplementalPhetioFiles.js
- /Users/cmalley/PhET/GitHub/chipper/js/grunt/buildRunnable.js
- /Users/cmalley/PhET/GitHub/chipper/js/grunt/Gruntfile.js
- /Users/cmalley/PhET/GitHub/fourier-making-waves/Gruntfile.js
- /Users/cmalley/PhET/GitHub/fourier-making-waves/node_modules/grunt/lib/grunt/task.js
- /Users/cmalley/PhET/GitHub/fourier-making-waves/node_modules/grunt/lib/grunt.js
- /usr/local/lib/node_modules/grunt-cli/bin/grunt

Fatal error: perennial grunt "--repo=fourier-making-waves" "rc" "--brands=phet" "--branch=1.0" failed with code 1
samreid commented 2 years ago

We have had an implicit transitive acorn dependency which generated a warning. In https://github.com/phetsims/chipper/issues/1171 we eliminated the warning by explicitly listing acorn in dependencies.json. Should we just try reverting https://github.com/phetsims/chipper/issues/1171 and live with the warning? Will that fix this problem?

Co-assigning @jbphet since he was involved with the review for https://github.com/phetsims/chipper/issues/1171

pixelzoom commented 2 years ago

I worked around this as described in https://github.com/phetsims/fourier-making-waves/issues/215#issuecomment-1005056771, and was able to publish Fourier 1.0.4.

zepumph commented 2 years ago

This seems like a more important issue than just following the workaround described in https://github.com/phetsims/fourier-making-waves/issues/215#issuecomment-1005056771. Translators has having failures that look the same, like these that came in today:

Build failure: Error: Build aborted, Error: grunt --allHTML --debugHTML --brands=phet --locales=fa in ../circuit-construction-kit-ac failed with exit code 1
stdout:
Running "lint-all" task

Running "report-media" task

Running "clean" task

Running "build" task
>> TypeScript compilation complete: 9181ms
1:39:32 PM, 83 ms: ../circuit-construction-kit-ac/js/circuit-construction-kit-ac-main.ts
Building runnable repository (circuit-construction-kit-ac, brands: phet)
Building brand: phet
Fatal error: Perennial task failed:
Error: Cannot find module 'acorn'
Require stack:
- /data/share/phet/phet-repos/chipper/node_modules/acorn-import-assertions/lib/index.js
- /data/share/phet/phet-repos/chipper/node_modules/webpack/lib/javascript/JavascriptParser.js
- /data/share/phet/phet-repos/chipper/node_modules/webpack/lib/javascript/JavascriptModulesPlugin.js
- /data/share/phet/phet-repos/chipper/node_modules/webpack/lib/WebpackOptionsApply.js
- /data/share/phet/phet-repos/chipper/node_modules/webpack/lib/webpack.js
- /data/share/phet/phet-repos/chipper/node_modules/webpack/lib/index.js
- /data/share/phet/phet-repos/chipper/js/grunt/webpackBuild.js
- /data/share/phet/phet-repos/chipper/js/grunt/buildStandalone.js
- /data/share/phet/phet-repos/chipper/js/grunt/Gruntfile.js
- /data/share/phet/phet-repos/circuit-construction-kit-ac/Gruntfile.js
- /data/share/phet/phet-repos/circuit-construction-kit-ac/node_modules/grunt/lib/grunt/task.js
- /data/share/phet/phet-repos/circuit-construction-kit-ac/node_modules/grunt/lib/grunt.js
- /usr/lib/node_modules/grunt-cli/bin/grunt
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/data/share/phet/phet-repos/chipper/node_modules/acorn-import-assertions/lib/index.js:8:38)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
Full Error details:
Error: Cannot find module 'acorn'
Require stack:
- /data/share/phet/phet-repos/chipper/node_modules/acorn-import-assertions/lib/index.js
- /data/share/phet/phet-repos/chipper/node_modules/webpack/lib/javascript/JavascriptParser.js
- /data/share/phet/phet-repos/chipper/node_modules/webpack/lib/javascript/JavascriptModulesPlugin.js
- /data/share/phet/phet-repos/chipper/node_modules/webpack/lib/WebpackOptionsApply.js
- /data/share/phet/phet-repos/chipper/node_modules/webpack/lib/webpack.js
- /data/share/phet/phet-repos/chipper/node_modules/webpack/lib/index.js
- /data/share/phet/phet-repos/chipper/js/grunt/webpackBuild.js
- /data/share/phet/phet-repos/chipper/js/grunt/buildStandalone.js
- /data/share/phet/phet-repos/chipper/js/grunt/Gruntfile.js
- /data/share/phet/phet-repos/circuit-construction-kit-ac/Gruntfile.js
- /data/share/phet/phet-repos/circuit-construction-kit-ac/node_modules/grunt/lib/grunt/task.js
- /data/share/phet/phet-repos/circuit-construction-kit-ac/node_modules/grunt/lib/grunt.js
- /usr/lib/node_modules/grunt-cli/bin/grunt
. Sim = circuit-construction-kit-ac Version = 1.0.0 Brands = phet Locales = fa Shas = {"comment":"# circuit-construction-kit-ac 1.0.0 Sun Dec 26 2021 02:26:19 GMT-0700 (Mountain Standard Time)","assert":{"sha":"767b2f345518ceca5144a152ecf40cd4f9206136","branch":"HEAD"},"axon":{"sha":"bcb2817f963ab22685fbb5bde7017008d92178ea","branch":"HEAD"},"bamboo":{"sha":"1f76417e363625a97a5b2c6c90b3d54b857a096f","branch":"HEAD"},"brand":{"sha":"2552e723a049d380528eeb03184dd3cdd402121e","branch":"HEAD"},"chipper":{"sha":"a777699ffdf0554147a19b45390415eac0d3ff38","branch":"HEAD"},"circuit-construction-kit-ac":{"sha":"8533e64b80e02fb5afd833eade2f414b6fda7efb","branch":"HEAD"},"circuit-construction-kit-common":{"sha":"2174f6a80cf3776d1803778b1c529b28b7fb3afd","branch":"HEAD"},"dot":{"sha":"67d17a901ca09970b8a74bcb611e48ba56404342","branch":"HEAD"},"joist":{"sha":"8eaa6445e7458f64965b86674db2f810f35720a5","branch":"HEAD"},"kite":{"sha":"6502ea6834ae0d77c0320973e25ad9726914f6ba","branch":"HEAD"},"perennial-alias":{"sha":"0998891a5aa7c4dd05639c2be7bd747356d56843","branch":"HEAD"},"phet-core":{"sha":"f23fac30eb0279af8f10e786408f22586c9de393","branch":"HEAD"},"phet-io":{"sha":"8748286bf16d55266183b592f7ab3a41801ff616","branch":"HEAD"},"phet-io-client-guides":{"sha":"e400520eff875c8d858af87667fad5b0daba4a72","branch":"HEAD"},"phet-io-wrappers":{"sha":"bc457edbc7b5a6d2a5452a2ec8f80bf83eccfd66","branch":"HEAD"},"phetcommon":{"sha":"0dd5378b39009e61ec33e7285e6744b681adc8d4","branch":"HEAD"},"phetmarks":{"sha":"64b01a476a9b51471d8080dc8962df6cc0ed5e29","branch":"HEAD"},"query-string-machine":{"sha":"b34079414b982587bd382a81a254e9f362e8772c","branch":"HEAD"},"scenery":{"sha":"ad3f44aecf29ba44102c26da8a82d30a51c5e8df","branch":"HEAD"},"scenery-phet":{"sha":"c91e731a2ff812e2721feeda86307ca09216f67d","branch":"HEAD"},"sherpa":{"sha":"1c42b328fd99c71c71d77aa820376df5f2b34ed0","branch":"HEAD"},"studio":{"sha":"5a0e9fb77f4cd7f83284a0b33e162896a1480f89","branch":"HEAD"},"sun":{"sha":"e7bf7bea865a781b7a8bff476b694aee8d1f25ad","branch":"HEAD"},"tambo":{"sha":"bbd659d9f4303f963010fececf11601931218461","branch":"HEAD"},"tandem":{"sha":"1ef31ff591f61a0c040638e55240e36b14cd784c","branch":"HEAD"},"twixt":{"sha":"bcdd52a5630885b865ddd99bc6927e5203b03897","branch":"HEAD"},"utterance-queue":{"sha":"09d1fe76bba4b2e7bd329c82ebfe579fbf96a7a3","branch":"HEAD"}}

I don't know enough about this issue to know how severe this issue is. marking for dev meeting.

pixelzoom commented 2 years ago

This seems like a more important issue than just following the workaround ...

I totally agree. I only applied the workaround in Fourier because I needed to move forward.

samreid commented 2 years ago

I decided to revert acorn for now. After reverting it, I did a trial deploy of CCK DC phet brand, and it seemed to work OK. The commit is referenced over in https://github.com/phetsims/chipper/issues/1171

samreid commented 2 years ago

From slack:

@KatieWoe said:

Most sims are failing CT.

I replied:

I don’t understand the problem and will need help on it. Adding acorn as a dependency got rid of the warning but fails maintenance builds. Removing acorn as a dependency failed several columns of CT.

KatieWoe commented 2 years ago

Example of what is showing up on CT:

area-builder : build
Build failed with status code 1:
Running "report-media" task

Running "clean" task

Running "build" task
>> TypeScript compilation complete: 5606ms
11:41:41 PM, 652 ms: ../area-builder/js/area-builder-main.js
11:41:41 PM, 30 ms: ../area-builder/js/areaBuilder.js
11:41:41 PM, 45 ms: ../area-builder/js/areaBuilderStrings.ts
11:41:41 PM, 22 ms: ../area-builder/js/common/AreaBuilderQueryParameters.js
11:41:41 PM, 32 ms: ../area-builder/js/common/AreaBuilderSharedConstants.js
11:41:41 PM, 65 ms: ../area-builder/js/common/model/MovableShape.js
11:41:41 PM, 79 ms: ../area-builder/js/common/model/PerimeterShape.js
11:41:42 PM, 241 ms: ../area-builder/js/common/model/ShapePlacementBoard.js
11:41:42 PM, 30 ms: ../area-builder/js/common/view/AreaBuilderControlPanel.js
11:41:42 PM, 44 ms: ../area-builder/js/common/view/AreaBuilderIconFactory.js
11:41:42 PM, 31 ms: ../area-builder/js/common/view/DimensionsIcon.js
11:41:42 PM, 29 ms: ../area-builder/js/common/view/Grid.js
11:41:42 PM, 24 ms: ../area-builder/js/common/view/GridIcon.js
11:41:42 PM, 61 ms: ../area-builder/js/common/view/PerimeterShapeNode.js
11:41:42 PM, 50 ms: ../area-builder/js/common/view/ShapeCreatorNode.js
11:41:42 PM, 40 ms: ../area-builder/js/common/view/ShapeNode.js
11:41:42 PM, 28 ms: ../area-builder/js/common/view/ShapePlacementBoardNode.js
11:41:42 PM, 21 ms: ../area-builder/js/explore/AreaBuilderExploreScreen.js
11:41:42 PM, 40 ms: ../area-builder/js/explore/model/AreaBuilderExploreModel.js
11:41:42 PM, 30 ms: ../area-builder/js/explore/view/AreaAndPerimeterDisplay.js
11:41:42 PM, 31 ms: ../area-builder/js/explore/view/AreaBuilderExploreView.js
11:41:42 PM, 27 ms: ../area-builder/js/explore/view/BoardDisplayModePanel.js
11:41:42 PM, 31 ms: ../area-builder/js/explore/view/ExploreNode.js
11:41:42 PM, 22 ms: ../area-builder/js/game/AreaBuilderGameScreen.js
11:41:42 PM, 110 ms: ../area-builder/js/game/model/AreaBuilderChallengeFactory.js
11:41:42 PM, 23 ms: ../area-builder/js/game/model/AreaBuilderGameChallenge.js
11:41:42 PM, 43 ms: ../area-builder/js/game/model/AreaBuilderGameModel.js
11:41:42 PM, 22 ms: ../area-builder/js/game/model/BuildSpec.js
11:41:42 PM, 19 ms: ../area-builder/js/game/model/GameState.js
11:41:42 PM, 31 ms: ../area-builder/js/game/model/QuizGameModel.js
11:41:42 PM, 70 ms: ../area-builder/js/game/view/AreaBuilderGameView.js
11:41:42 PM, 28 ms: ../area-builder/js/game/view/AreaBuilderScoreboard.js
11:41:42 PM, 23 ms: ../area-builder/js/game/view/ColorProportionsPrompt.js
11:41:42 PM, 21 ms: ../area-builder/js/game/view/FeedbackWindow.js
11:41:42 PM, 31 ms: ../area-builder/js/game/view/FractionNode.js
11:41:43 PM, 35 ms: ../area-builder/js/game/view/GameIconFactory.js
11:41:43 PM, 30 ms: ../area-builder/js/game/view/GameInfoBanner.js
11:41:43 PM, 25 ms: ../area-builder/js/game/view/StartGameLevelNode.js
11:41:43 PM, 28 ms: ../area-builder/js/game/view/YouBuiltWindow.js
11:41:43 PM, 19 ms: ../area-builder/js/game/view/YouEnteredWindow.js
11:41:43 PM, 18 ms: ../area-builder/images/exploreIcon_png.js
11:41:43 PM, 19 ms: ../area-builder/images/gameIcon_png.js
Building runnable repository (area-builder, brands: phet)
Building brand: phet
Fatal error: Perennial task failed:
Error: Cannot find module 'acorn'
Require stack:
- /data/share/phet/continuous-testing/ct-snapshots/1641447468886/chipper/node_modules/acorn-import-assertions/lib/index.js
- /data/share/phet/continuous-testing/ct-snapshots/1641447468886/chipper/node_modules/webpack/lib/javascript/JavascriptParser.js
- /data/share/phet/continuous-testing/ct-snapshots/1641447468886/chipper/node_modules/webpack/lib/javascript/JavascriptModulesPlugin.js
- /data/share/phet/continuous-testing/ct-snapshots/1641447468886/chipper/node_modules/webpack/lib/WebpackOptionsApply.js
- /data/share/phet/continuous-testing/ct-snapshots/1641447468886/chipper/node_modules/webpack/lib/webpack.js
- /data/share/phet/continuous-testing/ct-snapshots/1641447468886/chipper/node_modules/webpack/lib/index.js
- /data/share/phet/continuous-testing/ct-snapshots/1641447468886/chipper/js/grunt/webpackBuild.js
- /data/share/phet/continuous-testing/ct-snapshots/1641447468886/chipper/js/grunt/buildStandalone.js
- /data/share/phet/continuous-testing/ct-snapshots/1641447468886/chipper/js/grunt/Gruntfile.js
- /data/share/phet/continuous-testing/ct-snapshots/1641447468886/area-builder/Gruntfile.js
- /data/share/phet/continuous-testing/ct-snapshots/1641447468886/area-builder/node_modules/grunt/lib/grunt/task.js
- /data/share/phet/continuous-testing/ct-snapshots/1641447468886/area-builder/node_modules/grunt/lib/grunt.js
- /usr/lib/node_modules/grunt-cli/bin/grunt
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (/data/share/phet/continuous-testing/ct-snapshots/1641447468886/chipper/node_modules/acorn-import-assertions/lib/index.js:8:38)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
Full Error details:
Error: Cannot find module 'acorn'
Require stack:
- /data/share/phet/continuous-testing/ct-snapshots/1641447468886/chipper/node_modules/acorn-import-assertions/lib/index.js
- /data/share/phet/continuous-testing/ct-snapshots/1641447468886/chipper/node_modules/webpack/lib/javascript/JavascriptParser.js
- /data/share/phet/continuous-testing/ct-snapshots/1641447468886/chipper/node_modules/webpack/lib/javascript/JavascriptModulesPlugin.js
- /data/share/phet/continuous-testing/ct-snapshots/1641447468886/chipper/node_modules/webpack/lib/WebpackOptionsApply.js
- /data/share/phet/continuous-testing/ct-snapshots/1641447468886/chipper/node_modules/webpack/lib/webpack.js
- /data/share/phet/continuous-testing/ct-snapshots/1641447468886/chipper/node_modules/webpack/lib/index.js
- /data/share/phet/continuous-testing/ct-snapshots/1641447468886/chipper/js/grunt/webpackBuild.js
- /data/share/phet/continuous-testing/ct-snapshots/1641447468886/chipper/js/grunt/buildStandalone.js
- /data/share/phet/continuous-testing/ct-snapshots/1641447468886/chipper/js/grunt/Gruntfile.js
- /data/share/phet/continuous-testing/ct-snapshots/1641447468886/area-builder/Gruntfile.js
- /data/share/phet/continuous-testing/ct-snapshots/1641447468886/area-builder/node_modules/grunt/lib/grunt/task.js
- /data/share/phet/continuous-testing/ct-snapshots/1641447468886/area-builder/node_modules/grunt/lib/grunt.js
- /usr/lib/node_modules/grunt-cli/bin/grunt
Snapshot from 1/5/2022, 10:37:48 PM
samreid commented 2 years ago

CT corrected in the 12:51 shas, perhaps someone ran an npm update on CT? @jessegreenberg mentioned working in that area.

jessegreenberg commented 2 years ago

Great! But was not me. I tried but used the wrong account, I didn't try again after this:

Jesse Greenberg  11:46 AM
Maybe just removing node_modules and reinstalling for CT's chipper will help? Want me to try?
11:50
I cannot, permission denied.

Jonathan Olson  11:55 AM
I'm curious about why this is happening, let me know if I can help
11:56
Also, any work on CT files should be done with the phet-admin user

Jesse Greenberg  11:56 AM
That explains it, thanks
samreid commented 2 years ago

I'm not sure what else to do or try before the upcoming dev meeting, so I'll unassign myself until then.

jbphet commented 2 years ago

I'm going to unassign myself too because I'm not clear on the current status or what, if anything, to do about this. We'll clear it up in dev meeting I guess. We should make sure to discuss why the translation builds of CCK were failing, but appear to be succeeding now.

mattpen commented 2 years ago

I'm also unsure of what I can do at this time, unassigning. I did see two more translation build failures (CCKAC, CCKACVL in fa) happen over the weekend because of this error, so it definitely needs to be addressed.

mattpen commented 2 years ago

Maybe a simple solution could be to use rm -rf node_modules && npm install instead of npm prune && npm update where acorn is needed. This would definitely result in longer build times.

samreid commented 2 years ago

I reverted the acorn change in https://github.com/phetsims/chipper/issues/1171, maybe we should cherry pick the revert to affected maintenance branches. Would be good to decide at dev meeting.

chrisklus commented 2 years ago

From 1/27/22 dev meeting: We are going to leave it like it is because no one has enough time to investigate more and it hasn't been a problem recently. Closing.