can/t deploy on cloudflare build error - useEventListener()
See original GitHub issue17:37:06.484 Initializing build environment. This may take up to a few minutes to complete
17:39:30.143 Success: Finished initializing build environment
17:39:30.143 Cloning repository…
17:39:34.249 Success: Finished cloning repository files
17:39:35.123 Installing dependencies
17:39:35.126 Python version set to 2.7
17:39:36.152 Downloading and installing node v12.22.0…
17:39:36.313 Downloading https://nodejs.org/dist/v12.22.0/node-v12.22.0-linux-x64.tar.xz…
17:39:36.528 Computing checksum with sha256sum
17:39:36.634 Checksums matched!
17:39:38.947 Now using node v12.22.0 (npm v6.14.11)
17:39:39.041 Started restoring cached build plugins
17:39:39.044 Finished restoring cached build plugins
17:39:39.196 Attempting ruby version 2.7.1, read from environment
17:39:40.388 Using ruby version 2.7.1
17:39:40.706 Using PHP version 5.6
17:39:40.744 5.2 is already installed.
17:39:40.751 Using Swift version 5.2
17:39:40.752 Started restoring cached node modules
17:39:40.755 Finished restoring cached node modules
17:39:40.973 Installing NPM modules using NPM version 6.14.11
17:39:42.801 npm WARN deprecated @material-ui/core@4.12.3: You can now upgrade to @mui/material. See the guide: https://mui.com/guides/migration-v4/
17:39:42.818 npm WARN deprecated @material-ui/icons@4.11.2: You can now upgrade to @mui/icons. See the guide: https://mui.com/guides/migration-v4/
17:39:43.508 npm WARN deprecated @material-ui/system@4.12.1: You can now upgrade to @mui/system. See the guide: https://mui.com/guides/migration-v4/
17:39:44.436 npm WARN deprecated @material-ui/styles@4.11.4: You can now upgrade to @mui/styles. See the guide: https://mui.com/guides/migration-v4/
17:40:07.346
17:40:07.346 > @fortawesome/fontawesome-common-types@0.3.0 postinstall /opt/buildhome/repo/node_modules/@fortawesome/fontawesome-common-types
17:40:07.346 > node attribution.js
17:40:07.346
17:40:07.401 Font Awesome Free 0.3.0 by @fontawesome - https://fontawesome.com
17:40:07.401 License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
17:40:07.401 Copyright {{currentYear}} Fonticons, Inc.
17:40:07.401
17:40:07.414
17:40:07.414 > @fortawesome/fontawesome-common-types@0.2.36 postinstall /opt/buildhome/repo/node_modules/@fortawesome/free-brands-svg-icons/node_modules/@fortawesome/fontawesome-common-types
17:40:07.414 > node attribution.js
17:40:07.414
17:40:07.472 Font Awesome Free 0.2.36 by @fontawesome - https://fontawesome.com
17:40:07.472 License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
17:40:07.472
17:40:07.479
17:40:07.479 > @fortawesome/fontawesome-common-types@0.2.36 postinstall /opt/buildhome/repo/node_modules/@fortawesome/free-solid-svg-icons/node_modules/@fortawesome/fontawesome-common-types
17:40:07.479 > node attribution.js
17:40:07.479
17:40:07.547 Font Awesome Free 0.2.36 by @fontawesome - https://fontawesome.com
17:40:07.548 License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
17:40:07.548
17:40:07.560
17:40:07.560 > @fortawesome/fontawesome-common-types@0.2.36 postinstall /opt/buildhome/repo/node_modules/font-awesome-5-pro-regular/node_modules/@fortawesome/fontawesome-common-types
17:40:07.560 > node attribution.js
17:40:07.560
17:40:07.617 Font Awesome Free 0.2.36 by @fontawesome - https://fontawesome.com
17:40:07.617 License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
17:40:07.617
17:40:07.638
17:40:07.638 > @fortawesome/fontawesome-svg-core@1.3.0 postinstall /opt/buildhome/repo/node_modules/@fortawesome/fontawesome-svg-core
17:40:07.638 > node attribution.js
17:40:07.638
17:40:07.696 Font Awesome Free 1.3.0 by @fontawesome - https://fontawesome.com
17:40:07.696 License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
17:40:07.696 Copyright {{currentYear}} Fonticons, Inc.
17:40:07.696
17:40:07.704
17:40:07.704 > @fortawesome/free-brands-svg-icons@5.15.4 postinstall /opt/buildhome/repo/node_modules/@fortawesome/free-brands-svg-icons
17:40:07.704 > node attribution.js
17:40:07.704
17:40:07.761 Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com
17:40:07.761 License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
17:40:07.761
17:40:07.772
17:40:07.772 > @fortawesome/free-solid-svg-icons@5.15.4 postinstall /opt/buildhome/repo/node_modules/@fortawesome/free-solid-svg-icons
17:40:07.772 > node attribution.js
17:40:07.772
17:40:07.826 Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com
17:40:07.826 License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
17:40:07.826
17:40:07.834
17:40:07.834 > font-awesome-5-pro-regular@5.15.2 postinstall /opt/buildhome/repo/node_modules/font-awesome-5-pro-regular
17:40:07.834 > node attribution.js
17:40:07.834
17:40:07.893 Font Awesome Pro 5.15.2 by @fontawesome - https://fontawesome.com
17:40:07.893 License - https://fontawesome.com/license (Commercial License)
17:40:07.893
17:40:08.055 npm notice created a lockfile as package-lock.json. You should commit this file.
17:40:08.062 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @next/swc-android-arm64@12.1.0 (node_modules/next/node_modules/@next/swc-android-arm64):
17:40:08.062 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @next/swc-android-arm64@12.1.0: wanted {“os”:“android”,“arch”:“arm64”} (current: {“os”:“linux”,“arch”:“x64”})
17:40:08.068 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @next/swc-darwin-arm64@12.1.0 (node_modules/next/node_modules/@next/swc-darwin-arm64):
17:40:08.068 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @next/swc-darwin-arm64@12.1.0: wanted {“os”:“darwin”,“arch”:“arm64”} (current: {“os”:“linux”,“arch”:“x64”})
17:40:08.074 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @next/swc-darwin-x64@12.1.0 (node_modules/next/node_modules/@next/swc-darwin-x64):
17:40:08.074 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @next/swc-darwin-x64@12.1.0: wanted {“os”:“darwin”,“arch”:“x64”} (current: {“os”:“linux”,“arch”:“x64”})
17:40:08.080 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @next/swc-linux-arm-gnueabihf@12.1.0 (node_modules/next/node_modules/@next/swc-linux-arm-gnueabihf):
17:40:08.080 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @next/swc-linux-arm-gnueabihf@12.1.0: wanted {“os”:“linux”,“arch”:“arm”} (current: {“os”:“linux”,“arch”:“x64”})
17:40:08.085 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @next/swc-linux-arm64-gnu@12.1.0 (node_modules/next/node_modules/@next/swc-linux-arm64-gnu):
17:40:08.085 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @next/swc-linux-arm64-gnu@12.1.0: wanted {“os”:“linux”,“arch”:“arm64”} (current: {“os”:“linux”,“arch”:“x64”})
17:40:08.091 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @next/swc-linux-arm64-musl@12.1.0 (node_modules/next/node_modules/@next/swc-linux-arm64-musl):
17:40:08.091 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @next/swc-linux-arm64-musl@12.1.0: wanted {“os”:“linux”,“arch”:“arm64”} (current: {“os”:“linux”,“arch”:“x64”})
17:40:08.096 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @next/swc-win32-arm64-msvc@12.1.0 (node_modules/next/node_modules/@next/swc-win32-arm64-msvc):
17:40:08.096 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @next/swc-win32-arm64-msvc@12.1.0: wanted {“os”:“win32”,“arch”:“arm64”} (current: {“os”:“linux”,“arch”:“x64”})
17:40:08.102 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @next/swc-win32-ia32-msvc@12.1.0 (node_modules/next/node_modules/@next/swc-win32-ia32-msvc):
17:40:08.102 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @next/swc-win32-ia32-msvc@12.1.0: wanted {“os”:“win32”,“arch”:“ia32”} (current: {“os”:“linux”,“arch”:“x64”})
17:40:08.109 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @next/swc-win32-x64-msvc@12.1.0 (node_modules/next/node_modules/@next/swc-win32-x64-msvc):
17:40:08.109 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @next/swc-win32-x64-msvc@12.1.0: wanted {“os”:“win32”,“arch”:“x64”} (current: {“os”:“linux”,“arch”:“x64”})
17:40:08.120 npm WARN react-loading-overlay@1.0.1 requires a peer of react@^0.14 || ^15.0.0-rc || ^15.0 || ^16.0.0 || ^16.0 but none is installed. You must install peer dependencies yourself.
17:40:08.129 npm WARN react-loading-overlay@1.0.1 requires a peer of react-dom@^0.14 || ^15.0.0-rc || ^15.0 || ^16.0.0 || ^16.0 but none is installed. You must install peer dependencies yourself.
17:40:08.139 npm WARN file-loader@6.2.0 requires a peer of webpack@^4.0.0 || ^5.0.0 but none is installed. You must install peer dependencies yourself.
17:40:08.140
17:40:08.142 added 170 packages from 198 contributors and audited 180 packages in 26.371s
17:40:08.245
17:40:08.245 19 packages are looking for funding
17:40:08.245 run npm fund
for details
17:40:08.245
17:40:08.245 found 0 vulnerabilities
17:40:08.246
17:40:08.278 NPM modules installed
17:40:08.555 Installing Hugo 0.54.0
17:40:09.237 Hugo Static Site Generator v0.54.0-B1A82C61A/extended linux/amd64 BuildDate: 2019-02-01T10:04:38Z
17:40:09.238 Started restoring cached go cache
17:40:09.242 Finished restoring cached go cache
17:40:09.274 go version go1.14.4 linux/amd64
17:40:09.280 go version go1.14.4 linux/amd64
17:40:09.282 Installing missing commands
17:40:09.282 Verify run directory
17:40:09.282 Executing user command: next build && next export
17:40:10.068 warn - SWC minify release candidate enabled. https://nextjs.org/docs/messages/swc-minify-enabled
17:40:10.072 warn - No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
17:40:10.093 Attention: Next.js now collects completely anonymous telemetry regarding usage.
17:40:10.093 This information is used to shape Next.js’ roadmap and prioritize features.
17:40:10.093 You can learn more, including how to opt-out if you’d not like to participate in this anonymous program, by visiting the following URL:
17:40:10.093 https://nextjs.org/telemetry
17:40:10.093
17:40:10.147 info - Checking validity of types…
17:40:10.275 warn - No ESLint configuration detected. Run next lint to begin setup
17:40:10.281 info - Creating an optimized production build…
17:40:31.923 info - Compiled successfully
17:40:31.924 info - Collecting page data…
17:40:33.958
17:40:33.958 > Build error occurred
17:40:33.962 /opt/buildhome/repo/node_modules/usehooks-ts/dist/cjs/useEventListener/useEventListener.js:7
17:40:33.962 const targetElement = element?.current || window;
17:40:33.962 ^
17:40:33.962
17:40:33.962 SyntaxError: Unexpected token ‘.’
17:40:33.962 at wrapSafe (internal/modules/cjs/loader.js:915:16)
17:40:33.962 at Module._compile (internal/modules/cjs/loader.js:963:27)
17:40:33.962 at Object.Module._extensions…js (internal/modules/cjs/loader.js:1027:10)
17:40:33.962 at Module.load (internal/modules/cjs/loader.js:863:32)
17:40:33.962 at Function.Module._load (internal/modules/cjs/loader.js:708:14)
17:40:33.962 at Module.require (internal/modules/cjs/loader.js:887:19)
17:40:33.962 at require (internal/modules/cjs/helpers.js:74:18)
17:40:33.962 at Object.<anonymous> (/opt/buildhome/repo/node_modules/usehooks-ts/dist/cjs/useEventListener/index.js:17:26)
17:40:33.962 at Module._compile (internal/modules/cjs/loader.js:999:30)
17:40:33.962 at Object.Module._extensions…js (internal/modules/cjs/loader.js:1027:10) {
17:40:33.962 type: ‘SyntaxError’
17:40:33.962 }
17:40:34.007 Failed: build command exited with code: 1
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
Hi @adhamaa, thanks for reporting this. We are working on it and the fix will be in the next release. For now, I would recommend you to roll back to
usehooks-ts@2.2.1
.I have the same error log in Sentry. I’m using
usehooks-ts 2.5.1
. Environment:Nextjs 12.1.5
.