teambit / bit

A build system for development of composable software.
https://bit.dev
Other
17.84k stars 924 forks source link

Peer Dependency ModuleNotFoundError in Ripple-CI Job #8265

Closed gtwilliams03 closed 9 months ago

gtwilliams03 commented 9 months ago

Describe the bug

I can build my component library locally using bit [tag|snap] --build and then export to my remote collection without an issue. If I eliminate the --build flag, the ripple-ci job fails on bit.cloud with a dependency error (ModuleNotFoundError). This seems to be related to a font-awesome package - but I have the "not found" package listed as a peer dependency - it seems like ripple is not installing the peer dependencies for this package. All others seem to be working. I realize this is a package-specific issue, and very possibly not a bug, but rather a setup issue with my component library, but I cannot seem to get this component to build with ripple.

Steps to Reproduce

  1. Install font-awesome as a peerDependency - build remote with a ripple-ci build.

Expected Behavior

I expected this to build like my other components, but I get a ModuleNotFoundError.

Screenshots, exceptions and logs

- running command "sign"...
  signing using 1.5.19 version
  import objects 
- importing 1 components which are the seeders for the sign process
- successfully imported 1 components which are the seeders for the sign process
✔ import objects. Succeeded in 664ms
- importing 1 components for loading aspects from the scope
- successfully imported 1 components for loading aspects from the scope
- importing 1 components for loading aspects from the scope
- successfully imported 1 components for loading aspects from the scope
  ensuring 1 capsule(s) for all envs and aspects for /tmp/scope-fs at /tmp/capsules-root/tmp-aspects/2023-12-13/976a8058-527c-4ece-938a-c9d6d6422e16 
- importing 23 objects to get dists artifacts for 1 components
- successfully imported 23 objects to get dists artifacts for 1 components
Progress: resolved 1, reused 0, downloaded 0
AProgress: resolved 45, reused 45, downloaded 0, done
✔ ensuring 1 capsule(s) for all envs and aspects for /tmp/scope-fs at /tmp/capsules-root/tmp-aspects/2023-12-13/976a8058-527c-4ece-938a-c9d6d6422e16. Succeeded in 4s
✔ resolved aspect(s): severed-links.common/envs/my-react-bootstrap-env@0.0.11
  install packages in 1 capsules 
Progress: resolved 1, reused 0, downloaded 0
AProgress: resolved 39, reused 38, downloaded 0, done
✔ install packages in 1 capsules. Succeeded in 4s
  ensuring 1 capsule(s) for all envs and aspects for /tmp/scope-fs at /tmp/capsules-root/tmp-aspects/2023-12-13/976a8058-527c-4ece-938a-c9d6d6422e16 
  Total 1 components to build

  Running build pipeline using 1 environment(s), total 9 tasks 
  building 1 components of env "severed-links.common/envs/my-react-bootstrap-env@0.0.11". original seeders of this env: 1, graph of this env: 1, graph total (include other envs): 1
  running pre-build for all tasks 
✔ running pre-build for all tasks. Succeeded in 12ms
  running tasks (total: 9)
- (1/9) [Aspect: CoreExporter] export all core aspects via the main aspects
✔ (1/9) [Aspect: CoreExporter] Completed successfully in 361μs
- (2/9) [Compiler: TSCompiler] compile components for artifact dist
  compile typescript components (total: 1)
- compile typescript components (1/1) severed-links.common/font-awesome-icon@0.0.23
✔ compile typescript components. Succeeded in 2s
✔ (2/9) [Compiler: TSCompiler] Completed successfully in 2s
- (3/9) [Tester: TestComponents]
✔ (3/9) [Tester: TestComponents] Completed successfully in 4ms
- (4/9) [Ui: BundleUI]
✔ (4/9) [Ui: BundleUI] Completed successfully in 380μs
- (5/9) [Application: build_application]
✔ (5/9) [Application: build_application] Completed successfully in 923μs
- (6/9) [Pkg: PreparePackages]
✔ (6/9) [Pkg: PreparePackages] Completed successfully in 2ms
- (7/9) [Schema: ExtractSchema] extract api schema for a set of components
✔ (7/9) [Schema: ExtractSchema] Completed successfully in 5s
- (8/9) [Preview: GenerateEnvTemplate]
✔ (8/9) [Preview: GenerateEnvTemplate] Completed successfully in 3ms
- (9/9) [Preview: GeneratePreview] Bundling components for preview
  running Webpack bundler (total: 1)
- running Webpack bundler (1/1) process initiated by: GeneratePreview task. config created by env: severed-links.common/envs/my-react-bootstrap-env@0.0.11. running on 1 components
✔ running Webpack bundler. Succeeded in 797ms
✖ env: severed-links.common/envs/my-react-bootstrap-env@0.0.11, task "teambit.preview/preview:GeneratePreview" has failed
✖ (9/9) env: severed-links.common/envs/my-react-bootstrap-env@0.0.11, task "teambit.preview/preview:GeneratePreview" has failed in 2s
✔ running tasks. Succeeded in 10s
  running post-build for all tasks 
✔ running post-build for all tasks. Succeeded in 496μs
✖ Running build pipeline using 1 environment(s), total 9 tasks. Failed in 10s
- all objects were persisted successfully!
The following errors were found while running the build pipeline
Failed task 1: "teambit.preview/preview:GeneratePreview" of env "severed-links.common/envs/my-react-bootstrap-env@0.0.11"
component: severed-links.common/font-awesome-icon@0.0.23
ModuleNotFoundError: Module not found: Error: Can't resolve '@fortawesome/fontawesome-svg-core' in '/tmp/capsules-root/sign-capsules/2023-11-13/148d5e2/node_modules/.pnpm/@fortawesome+react-fontawesome@0.2.0_react@17.0.2/node_modules/@fortawesome/react-fontawesome'
ModuleNotFoundError: Module not found: Error: Can't resolve '@fortawesome/fontawesome-svg-core' in '/tmp/capsules-root/sign-capsules/2023-11-13/148d5e2/node_modules/.pnpm/@fortawesome+react-fontawesome@0.2.0_react@17.0.2/node_modules/@fortawesome/react-fontawesome'
    at /root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/webpack/lib/Compilation.js:2022:28
    at /root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/webpack/lib/NormalModuleFactory.js:817:13
    at eval (eval at create (/root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:10:1)
    at /root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/webpack/lib/NormalModuleFactory.js:275:22
    at eval (eval at create (/root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at /root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/webpack/lib/NormalModuleFactory.js:448:22
    at /root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/webpack/lib/NormalModuleFactory.js:118:11
    at /root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/webpack/lib/NormalModuleFactory.js:689:25
    at /root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/webpack/lib/NormalModuleFactory.js:893:8
    at /root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/webpack/lib/NormalModuleFactory.js:1013:5
    at /root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/neo-async/async.js:6883:13
    at /root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/webpack/lib/NormalModuleFactory.js:996:45
    at finishWithoutResolve (/root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/enhanced-resolve/lib/Resolver.js:372:11)
    at /root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/enhanced-resolve/lib/Resolver.js:461:15
    at /root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/enhanced-resolve/lib/Resolver.js:519:5
    at eval (eval at create (/root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at /root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/enhanced-resolve/lib/Resolver.js:519:5
    at eval (eval at create (/root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
    at /root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:89:43
    at /root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/enhanced-resolve/lib/Resolver.js:519:5
    at eval (eval at create (/root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
    at /root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/enhanced-resolve/lib/forEachBail.js:39:13
    at /root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/enhanced-resolve/lib/AliasPlugin.js:148:14
    at next (/root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/enhanced-resolve/lib/forEachBail.js:35:3)
    at forEachBail (/root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/enhanced-resolve/lib/forEachBail.js:49:9)
    at /root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/enhanced-resolve/lib/AliasPlugin.js:61:5
    at _next0 (eval at create (/root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:8:1)
    at eval (eval at create (/root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:30:1)
    at /root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/enhanced-resolve/lib/Resolver.js:519:5
    at eval (eval at create (/root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
    at /root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/enhanced-resolve/lib/Resolver.js:519:5
    at eval (eval at create (/root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
    at /root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/enhanced-resolve/lib/Resolver.js:519:5
    at eval (eval at create (/root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
    at /root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:89:43
    at /root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/enhanced-resolve/lib/Resolver.js:519:5
    at eval (eval at create (/root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
    at /root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/enhanced-resolve/lib/Resolver.js:519:5
    at eval (eval at create (/root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at /root/.bvm/versions/1.5.19/bit-1.5.19/node_modules/enhanced-resolve/lib/DirectoryExistsPlugin.js:41:15
    at process.processTicksAndRejections (node:internal/process/task_queues:81:21)
Found 1 errors in 1 components
✖ Total 9 tasks. 8 succeeded. 1 failed. 0 skipped. Total errors: 1.
the following 1 component(s) were signed with build-status "failed"
severed-links.common/font-awesome-icon@0.0.23

Specifications

Additional context

Adding --build flag to bit tag command builds locally just fine and I can export the components from my IDE.

gtwilliams03 commented 9 months ago

workspace.jsonc peerDependencies:

      "peerDependencies": {
        "@fortawesome/fontawesome-free": "^6.5.1",
        "@fortawesome/fontawesome-svg-core": "^6.5.1",
        "@fortawesome/free-brands-svg-icons": "^6.5.1",
        "@fortawesome/free-regular-svg-icons": "^6.5.1",
        "@fortawesome/free-solid-svg-icons": "^6.5.1",
        "@fortawesome/react-fontawesome": "^0.2.0",
        "bootstrap": "^5.3.2",
        "lodash": "^4.17.21",
        "moment": "^2.29.4",
        "moment-timezone": "^0.5.43",
        "react": "^18.2.0",
        "react-bootstrap": "^2.9.1",
        "react-dom": "^18.2.0",
        "react-router": "^6.20.1",
        "react-router-dom": "^6.20.1"
      }
itaymendel commented 9 months ago

if you have a custom env, please move the peerDeps to the env.jsonc of that custom env, this will solve for your problem. if you don't please create a custom env, move the peerDeps there and set bit env replace ... to update the envs for your components. also, once you have your peerdeps properly defined, you can remove them from worksapce.jsonc.

gtwilliams03 commented 9 months ago

@itaymendel Thank you very much for your prompt response. Your advice was perfect. I did have a custom env set up already and I moved the peerDependencies out of workspace.jsonc into a new env.jsonc file (policy.peers). Ran bit install and the next build ran fine.