[GH-ISSUE #1681] user shivammathur/setup-php@v2 got error with SyntaxError: Unexpected token '??=' #831

Closed
opened 2026-03-01 21:46:44 +03:00 by kerem · 8 comments
Owner

Originally created by @zgqit on GitHub (Mar 16, 2023).
Original GitHub issue: https://github.com/nektos/act/issues/1681

Bug report info

act version:            0.2.43
GOOS:                   windows
GOARCH:                 amd64
NumCPU:                 8
Docker host:            DOCKER_HOST environment variable is unset/empty.
Sockets found:
        \\.\pipe\docker_engine
Config files:
        C:\Users\Powte\.actrc:
                -P ubuntu-latest=catthehacker/ubuntu:act-latest
                -P ubuntu-22.04=catthehacker/ubuntu:act-22.04
                -P ubuntu-20.04=catthehacker/ubuntu:act-20.04
                -P ubuntu-18.04=catthehacker/ubuntu:full-18.04
Build info:
        Go version:            go1.18.10
        Module path:           github.com/nektos/act
        Main version:          (devel)
        Main path:             github.com/nektos/act
        Main checksum:
        Build settings:
                -compiler:            gc
                -ldflags:             -s -w -X main.version=0.2.43 -X main.commit=44b510f48cac6a58654bf920ee26cc6e1d36ac3a -X main.date=2023-03-01T02:33:51Z -X main.builtBy=goreleaser
                CGO_ENABLED:          0
                GOARCH:               amd64
                GOOS:                 windows
                GOAMD64:              v1
                vcs:                  git
                vcs.revision:         44b510f48cac6a58654bf920ee26cc6e1d36ac3a
                vcs.time:             2023-03-01T02:33:29Z
                vcs.modified:         false
Docker Engine:
        Engine version:        20.10.21
        Engine runtime:        runc
        Cgroup version:        1
        Cgroup driver:         cgroupfs
        Storage driver:        overlay2
        Registry URI:          https://index.docker.io/v1/
        OS:                    Docker Desktop
        OS type:               linux
        OS version:
        OS arch:               x86_64
        OS kernel:             5.10.16.3-microsoft-standard-WSL2
        OS CPU:                8
        OS memory:             11976 MB
        Security options:
                name=seccomp,profile=default

Command used with act

act  --secret-file AZUREAPPSERVICE_PUBLISHPROFILE=xxxx.PublishSettings -v -W .github/workflows/azure-dev.yml

Describe issue

use act depoly php environment on the azure web app service,when execute the shivammathur-setup-php@v2 action, got the SyntaxError: Unexpected token '??='.

No response

Workflow content

# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: Azure development 

on:
  push:
    branches:
      - development
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-18.04
    environment:
      name: ''
      url: ''
    steps:
      - uses: actions/checkout@v2

      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: '8.1'

      - name: Check if composer.json exists
        id: check_files
        uses: andstor/file-existence-action@v1
        with:
          files: 'composer.json'

      - name: Run composer install if composer.json exists
        if: steps.check_files.outputs.files_exists == 'true'
        run: composer validate --no-check-publish && composer install --prefer-dist --no-progress

      - name: 'Deploy to Azure Web App'
        uses: azure/webapps-deploy@v2
        id: deploy-to-webapp
        with:
          app-name: ''
          slot-name: 'Production'
          publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE}}
          package: .

Relevant log output

| /run/act/actions/shivammathur-setup-php@v2/dist/index.js:935

|     data['domain'] ??= data['github'];

|                    ^^^

|

| SyntaxError: Unexpected token '??='

|     at wrapSafe (internal/modules/cjs/loader.js:988:16)

|     at Module._compile (internal/modules/cjs/loader.js:1036:27)

|     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)

|     at Module.load (internal/modules/cjs/loader.js:937:32)

|     at Function.Module._load (internal/modules/cjs/loader.js:778:12)

|     at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)

|     at internal/main/run_main_module.js:17:47

Additional information

No response

Originally created by @zgqit on GitHub (Mar 16, 2023). Original GitHub issue: https://github.com/nektos/act/issues/1681 ### Bug report info ```plain text act version: 0.2.43 GOOS: windows GOARCH: amd64 NumCPU: 8 Docker host: DOCKER_HOST environment variable is unset/empty. Sockets found: \\.\pipe\docker_engine Config files: C:\Users\Powte\.actrc: -P ubuntu-latest=catthehacker/ubuntu:act-latest -P ubuntu-22.04=catthehacker/ubuntu:act-22.04 -P ubuntu-20.04=catthehacker/ubuntu:act-20.04 -P ubuntu-18.04=catthehacker/ubuntu:full-18.04 Build info: Go version: go1.18.10 Module path: github.com/nektos/act Main version: (devel) Main path: github.com/nektos/act Main checksum: Build settings: -compiler: gc -ldflags: -s -w -X main.version=0.2.43 -X main.commit=44b510f48cac6a58654bf920ee26cc6e1d36ac3a -X main.date=2023-03-01T02:33:51Z -X main.builtBy=goreleaser CGO_ENABLED: 0 GOARCH: amd64 GOOS: windows GOAMD64: v1 vcs: git vcs.revision: 44b510f48cac6a58654bf920ee26cc6e1d36ac3a vcs.time: 2023-03-01T02:33:29Z vcs.modified: false Docker Engine: Engine version: 20.10.21 Engine runtime: runc Cgroup version: 1 Cgroup driver: cgroupfs Storage driver: overlay2 Registry URI: https://index.docker.io/v1/ OS: Docker Desktop OS type: linux OS version: OS arch: x86_64 OS kernel: 5.10.16.3-microsoft-standard-WSL2 OS CPU: 8 OS memory: 11976 MB Security options: name=seccomp,profile=default ``` ### Command used with act ```sh act --secret-file AZUREAPPSERVICE_PUBLISHPROFILE=xxxx.PublishSettings -v -W .github/workflows/azure-dev.yml ``` ### Describe issue use act depoly php environment on the azure web app service,when execute the shivammathur-setup-php@v2 action, got the SyntaxError: Unexpected token '??='. ### Link to GitHub repository _No response_ ### Workflow content ```yml # Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy # More GitHub Actions for Azure: https://github.com/Azure/actions name: Azure development on: push: branches: - development workflow_dispatch: jobs: build: runs-on: ubuntu-18.04 environment: name: '' url: '' steps: - uses: actions/checkout@v2 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: '8.1' - name: Check if composer.json exists id: check_files uses: andstor/file-existence-action@v1 with: files: 'composer.json' - name: Run composer install if composer.json exists if: steps.check_files.outputs.files_exists == 'true' run: composer validate --no-check-publish && composer install --prefer-dist --no-progress - name: 'Deploy to Azure Web App' uses: azure/webapps-deploy@v2 id: deploy-to-webapp with: app-name: '' slot-name: 'Production' publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE}} package: . ``` ### Relevant log output ```sh | /run/act/actions/shivammathur-setup-php@v2/dist/index.js:935 | data['domain'] ??= data['github']; | ^^^ | | SyntaxError: Unexpected token '??=' | at wrapSafe (internal/modules/cjs/loader.js:988:16) | at Module._compile (internal/modules/cjs/loader.js:1036:27) | at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10) | at Module.load (internal/modules/cjs/loader.js:937:32) | at Function.Module._load (internal/modules/cjs/loader.js:778:12) | at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) | at internal/main/run_main_module.js:17:47 ``` ### Additional information _No response_
kerem 2026-03-01 21:46:44 +03:00
Author
Owner

@kuhnchris commented on GitHub (Mar 16, 2023):

What's the base image's nodejs version?
According to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing_assignment you'd need at least node v15+

<!-- gh-comment-id:1471433262 --> @kuhnchris commented on GitHub (Mar 16, 2023): What's the base image's nodejs version? According to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing_assignment you'd need at least node v15+
Author
Owner

@zgqit commented on GitHub (Mar 16, 2023):

thanks for reply.
I check the deploy image(catthehacker/ubuntu:full-18.04) in docker,the node version is v14.17.6.
So i shoud update node version before execute shivammathur/setup-php@v2 action.

<!-- gh-comment-id:1471489552 --> @zgqit commented on GitHub (Mar 16, 2023): thanks for reply. I check the deploy image(catthehacker/ubuntu:full-18.04) in docker,the node version is v14.17.6. So i shoud update node version before execute shivammathur/setup-php@v2 action.
Author
Owner

@ricardo-nolan commented on GitHub (Mar 16, 2023):

use -P ubuntu-18.04=shivammathur/node:1804 with the act command.

<!-- gh-comment-id:1472654310 --> @ricardo-nolan commented on GitHub (Mar 16, 2023): use `-P ubuntu-18.04=shivammathur/node:1804` with the act command.
Author
Owner

@robsonsobral commented on GitHub (Jun 16, 2023):

Can't fix not even using @ricardo-nolan's suggestion.

[deploy/build]   🐳  docker exec cmd=[node /var/run/act/actions/shivammathur-setup-php@v2/dist/index.js] user= workdir=
| /run/act/actions/shivammathur-setup-php@v2/dist/index.js:935
|     data['domain'] ??= data['github'];
|                    ^^^
|
| SyntaxError: Unexpected token '??='
|     at wrapSafe (internal/modules/cjs/loader.js:1029:16)
|     at Module._compile (internal/modules/cjs/loader.js:1078:27)
|     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
|     at Module.load (internal/modules/cjs/loader.js:979:32)
|     at Function.Module._load (internal/modules/cjs/loader.js:819:12)
|     at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12)
|     at internal/main/run_main_module.js:17:47
<!-- gh-comment-id:1594711644 --> @robsonsobral commented on GitHub (Jun 16, 2023): Can't fix not even using @ricardo-nolan's suggestion. ``` [deploy/build] 🐳 docker exec cmd=[node /var/run/act/actions/shivammathur-setup-php@v2/dist/index.js] user= workdir= | /run/act/actions/shivammathur-setup-php@v2/dist/index.js:935 | data['domain'] ??= data['github']; | ^^^ | | SyntaxError: Unexpected token '??=' | at wrapSafe (internal/modules/cjs/loader.js:1029:16) | at Module._compile (internal/modules/cjs/loader.js:1078:27) | at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10) | at Module.load (internal/modules/cjs/loader.js:979:32) | at Function.Module._load (internal/modules/cjs/loader.js:819:12) | at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12) | at internal/main/run_main_module.js:17:47 ```
Author
Owner

@james-green-affinity commented on GitHub (Jul 18, 2023):

I have this issue to:

act version 0.2.48

image

I notice when I go into the container itself and run "/bin/bash /run/act/actions/shivammathur-setup-php@v2/src/scripts/run.sh"

It does successfully install PHP:

image

<!-- gh-comment-id:1640105380 --> @james-green-affinity commented on GitHub (Jul 18, 2023): I have this issue to: act version 0.2.48 ![image](https://github.com/nektos/act/assets/91469943/44176164-381f-4fda-9b38-bedda49d0c41) I notice when I go into the container itself and run "/bin/bash /run/act/actions/shivammathur-setup-php@v2/src/scripts/run.sh" It does successfully install PHP: ![image](https://github.com/nektos/act/assets/91469943/0387e37f-3792-4577-b2d8-31cc7c8150cb)
Author
Owner

@agopaul commented on GitHub (Dec 12, 2023):

I had the same issue and I was able to fix it by using the option -P ubuntu-latest=shivammathur/node:latest as described in the Action's own documentation: https://github.com/shivammathur/setup-php?tab=readme-ov-file#local-testing-setup

<!-- gh-comment-id:1852402726 --> @agopaul commented on GitHub (Dec 12, 2023): I had the same issue and I was able to fix it by using the option `-P ubuntu-latest=shivammathur/node:latest` as described in the Action's own documentation: https://github.com/shivammathur/setup-php?tab=readme-ov-file#local-testing-setup
Author
Owner

@github-actions[bot] commented on GitHub (Jun 10, 2024):

Issue is stale and will be closed in 14 days unless there is new activity

<!-- gh-comment-id:2156915689 --> @github-actions[bot] commented on GitHub (Jun 10, 2024): Issue is stale and will be closed in 14 days unless there is new activity
Author
Owner

@teamhamza commented on GitHub (May 28, 2025):

i have this error from my side : composer-install/Run composer install/composer-install] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/3] user= workdir= | ::error ::Your github oauth token for github.com contains invalid characters: "" | | In BaseIO.php line 140: | | Your github oauth token for github.com contains invalid characters: "

<!-- gh-comment-id:2916829900 --> @teamhamza commented on GitHub (May 28, 2025): i have this error from my side : `composer-install/Run composer install/composer-install] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/3] user= workdir= | ::error ::Your github oauth token for github.com contains invalid characters: "" | | In BaseIO.php line 140: | | Your github oauth token for github.com contains invalid characters: "`
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#831
No description provided.