Skip to content

[ERROR] Invalid option in build() call: "watch" #154

@SamuelBonilla

Description

@SamuelBonilla

I'm carefully following each step, but in some Phoenix projects, we don't have a package.json, so I copied and pasted the JSON from the example project (it would be helpful to add this to the documentation). Since package.json isn't generated automatically, after running mix phx.server, I get this error.

Node.js v20.14.0

Rebuilding...

Done in 168ms.
[error] Task #PID<0.618.0> started from Demo3Web.Endpoint terminating
** (stop) :watcher_command_error
    (phoenix 1.7.14) lib/phoenix/endpoint/watcher.ex:55: Phoenix.Endpoint.Watcher.watch/2
    (elixir 1.17.3) lib/task/supervised.ex:101: Task.Supervised.invoke_mfa/2
Function: &Phoenix.Endpoint.Watcher.watch/2
    Args: ["node", ["build.js", "--watch", {:cd, "/Users/username/dev/elixir/demo3/assets"}]]
✘ [ERROR] Invalid option in build() call: "watch"

    /Users/username/dev/elixir/demo3/assets/node_modules/esbuild/lib/main.js:253:12:
      253 │       throw new Error(`Invalid option ${where}: ${quote(key)}`);
          ╵             ^

    at checkForInvalidFlags (/Users/username/dev/elixir/demo3/assets/node_modules/esbuild/lib/main.js:253:13)
    at flagsForBuildOptions (/Users/username/dev/elixir/demo3/assets/node_modules/esbuild/lib/main.js:426:3)
    at buildOrContextContinue (/Users/username/dev/elixir/demo3/assets/node_modules/esbuild/lib/main.js:913:9)
    at /Users/username/dev/elixir/demo3/assets/node_modules/esbuild/lib/main.js:887:11
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions