Can’t build/deploy Forge example app (Forge-Byline-DynamicProperties)

Hello everyone,
I was trying to build a Forge app from this repository:
https://bitbucket.org/atlassian/forge-byline-dynamicproperties/src/master/

However, when I execute the “forge deploy” command, it fails with the following error log:

Deploying your app to the development environment.
Press Ctrl+C to cancel.

Running forge lint...
No issues found.

✕ Deploying page-approver-forge-app to development...

ℹ Packaging app files

Error: Bundling failed: ./src/index.jsx
Module not found: Error: Can't resolve '@forge/api' in '/Documents/AE/confluence-apps/forge-byline-dynamicproperties/src'
resolve '@forge/api' in '/Documents/AE/confluence-apps/forge-byline-dynamicproperties/src'
  Parsed request is a module
  using description file:/Documents/AE/confluence-apps/forge-byline-dynamicproperties/package.json (relative path: ./src)
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module
     /Documents/AE/confluence-apps/forge-byline-dynamicproperties/src/node_modules doesn't exist or is not a directory
      /Documents/AE/confluence-apps/node_modules doesn't exist or is not a directory
     /Documents/AE/node_modules doesn't exist or is not a directory
     /Documents/node_modules doesn't exist or is not a directory
     /node_modules doesn't exist or is not a directory
      /Users/node_modules doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory
      looking for modules in /Documents/AE/confluence-apps/forge-byline-dynamicproperties/node_modules
        using description file:/Documents/AE/confluence-apps/forge-byline-dynamicproperties/package.json (relative path: ./node_modules)
          Field 'browser' doesn't contain a valid alias configuration
          using description file: /Documents/AE/confluence-apps/forge-byline-dynamicproperties/package.json (relative path: ./node_modules/@forge/api)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
             /Documents/AE/confluence-apps/forge-byline-dynamicproperties/node_modules/@forge/api doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
             /Documents/AE/confluence-apps/forge-byline-dynamicproperties/node_modules/@forge/api.ts doesn't exist
            .tsx
              Field 'browser' doesn't contain a valid alias configuration
             /Documents/AE/confluence-apps/forge-byline-dynamicproperties/node_modules/@forge/api.tsx doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
             /Documents/AE/confluence-apps/forge-byline-dynamicproperties/node_modules/@forge/api.js doesn't exist
            .jsx
              Field 'browser' doesn't contain a valid alias configuration
             /Documents/AE/confluence-apps/forge-byline-dynamicproperties/node_modules/@forge/api.jsx doesn't exist
            .json
              Field 'browser' doesn't contain a valid alias configuration
             /Documents/AE/confluence-apps/forge-byline-dynamicproperties/node_modules/@forge/api.json doesn't exist
            as directory
             /Documents/AE/confluence-apps/forge-byline-dynamicproperties/node_modules/@forge/api doesn't exist
[/Documents/AE/confluence-apps/forge-byline-dynamicproperties/src/node_modules]
[/Documents/AE/confluence-apps/node_modules]
[/Documents/AE/node_modules]
[/Documents/node_modules]
[node_modules]
[/Users/node_modules]
[/node_modules]
[/Documents/AE/confluence-apps/forge-byline-dynamicproperties/node_modules/@forge/api]
[Documents/AE/confluence-apps/forge-byline-dynamicproperties/node_modules/@forge/api.ts]
[Documents/AE/confluence-apps/forge-byline-dynamicproperties/node_modules/@forge/api.tsx]
[/Documents/AE/confluence-apps/forge-byline-dynamicproperties/node_modules/@forge/api.js]
[/Documents/AE/confluence-apps/forge-byline-dynamicproperties/node_modules/@forge/api.jsx]
[/Documents/AE/confluence-apps/forge-byline-dynamicproperties/node_modules/@forge/api.json]
 @ ./src/index.jsx 2:0-40 9:26-36 14:10-20 18:10-20 53:28-38, ./src/index.jsx
Module not found: Error: Can't resolve '@forge/ui' in '/Documents/AE/confluence-apps/forge-byline-dynamicproperties/src'
resolve '@forge/ui' in '/Documents/AE/confluence-apps/forge-byline-dynamicproperties/src'
  Parsed request is a module
  using description file: /Documents/AE/confluence-apps/forge-byline-dynamicproperties/package.json (relative path: ./src)
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module
     /Documents/AE/confluence-apps/forge-byline-dynamicproperties/src/node_modules doesn't exist or is not a directory
     /Documents/AE/confluence-apps/node_modules doesn't exist or is not a directory
     /Documents/AE/node_modules doesn't exist or is not a directory
      /Documents/node_modules doesn't exist or is not a directory
     /node_modules doesn't exist or is not a directory
      /Users/node_modules doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory
      looking for modules in /Documents/AE/confluence-apps/forge-byline-dynamicproperties/node_modules
        using description file: /Documents/AE/confluence-apps/forge-byline-dynamicproperties/package.json (relative path: ./node_modules)
          Field 'browser' doesn't contain a valid alias configuration
          using description file: /Documents/AE/confluence-apps/forge-byline-dynamicproperties/package.json (relative path: ./node_modules/@forge/ui)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
             /Documents/AE/confluence-apps/forge-byline-dynamicproperties/node_modules/@forge/ui doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
             /Documents/AE/confluence-apps/forge-byline-dynamicproperties/node_modules/@forge/ui.ts doesn't exist
            .tsx
              Field 'browser' doesn't contain a valid alias configuration
             /Documents/AE/confluence-apps/forge-byline-dynamicproperties/node_modules/@forge/ui.tsx doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
             /Documents/AE/confluence-apps/forge-byline-dynamicproperties/node_modules/@forge/ui.js doesn't exist
            .jsx
              Field 'browser' doesn't contain a valid alias configuration
             /Documents/AE/confluence-apps/forge-byline-dynamicproperties/node_modules/@forge/ui.jsx doesn't exist
            .json
              Field 'browser' doesn't contain a valid alias configuration
             /Documents/AE/confluence-apps/forge-byline-dynamicproperties/node_modules/@forge/ui.json doesn't exist
            as directory
             /Documents/AE/confluence-apps/forge-byline-dynamicproperties/node_modules/@forge/ui doesn't exist
[/Documents/AE/confluence-apps/forge-byline-dynamicproperties/src/node_modules]
[/Documents/AE/confluence-apps/node_modules]
[/Documents/AE/node_modules]
[/Documents/node_modules]
[/node_modules]
[/Users/node_modules]
[/node_modules]
[/Documents/AE/confluence-apps/forge-byline-dynamicproperties/node_modules/@forge/ui]
[/Documents/AE/confluence-apps/forge-byline-dynamicproperties/node_modules/@forge/ui.ts]
[/Documents/AE/confluence-apps/forge-byline-dynamicproperties/node_modules/@forge/ui.tsx]
[/Documents/AE/confluence-apps/forge-byline-dynamicproperties/node_modules/@forge/ui.js]
[/Documents/AE/confluence-apps/forge-byline-dynamicproperties/node_modules/@forge/ui.jsx]
[/Documents/AE/confluence-apps/forge-byline-dynamicproperties/node_modules/@forge/ui.json]
 @ ./src/index.jsx 1:0-120 7:6-23 8:38-46 22:9-16 22:31-43 24:5-12 24:27-31 26:51-58 26:73-79 30:6-13 30:28-34 37:19-25 37:26-33 37:48-65 39:3-10

Rerunning the command with --verbose may give more details.

If anyone has any insight, please share.

Thanks in advance.

Hi @NasmusSadat , welcome to the developer community!

I was able to replicate the same error you got when I did:

  1. Clone the repo
  2. Run forge register
  3. Run forge deploy

To fix the issue, you missed calling npm install before running forge deploy. That should do the trick.

Cheers!
Ian

Hi @iragudo,
Many thanks for reaching out on this.

I confirm your suggested solution worked for me!

Thanks.
Nazmus

1 Like