Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dyld: Symbol not found: _clock_gettime #1278

Closed
yourVictor opened this issue May 12, 2021 · 9 comments
Closed

dyld: Symbol not found: _clock_gettime #1278

yourVictor opened this issue May 12, 2021 · 9 comments

Comments

@yourVictor
Copy link

yourVictor commented May 12, 2021

操作系统(os): mac
node: v14.16.1
npm: 6.14.12

npm install 的时候报错

> esbuild@0.11.20 postinstall /Users/halvie/Downloads/github/vue3-ele-admin-pure/node_modules/esbuild
> node install.js

dyld: Symbol not found: _clock_gettime
  Referenced from: /Users/halvie/Downloads/github/vue3-ele-admin-pure/node_modules/esbuild/bin/esbuild__
  Expected in: flat namespace

The version of the downloaded binary is incorrect: Command failed: /Users/halvie/Downloads/github/vue3-ele-admin-pure/node_modules/esbuild/bin/esbuild__ --version
dyld: Symbol not found: _clock_gettime
  Referenced from: /Users/halvie/Downloads/github/vue3-ele-admin-pure/node_modules/esbuild/bin/esbuild__
  Expected in: flat namespace
@evanw
Copy link
Owner

evanw commented May 12, 2021

I googled this for you and this was the first result: https://stackoverflow.com/questions/66741383/dyld-symbol-not-found-clock-gettime-after-installing-golang. It sounds like you are using an unsupported version of macOS. You will either have to upgrade your operating system or install the WebAssembly version to use esbuild: https://esbuild.github.io/getting-started/#wasm.

@evanw
Copy link
Owner

evanw commented May 13, 2021

Closing since esbuild is not supported on this platform. Workarounds are described above.

@evanw evanw closed this as completed May 13, 2021
@fergardi
Copy link

That happened to me as well. I'm on macOS v10.11.6. Unfortunately my current hardware cannot support a more modern version.

> esbuild@0.12.24 postinstall /Library/WebServer/Documents/WorkspacePHP/mage/node_modules/@angular-devkit/build-angular/node_modules/esbuild
> node install.js

dyld: Symbol not found: _clock_gettime
  Referenced from: /Library/WebServer/Documents/WorkspacePHP/mage/node_modules/@angular-devkit/build-angular/node_modules/esbuild/bin/esbuild__
  Expected in: flat namespace

The version of the downloaded binary is incorrect: Command failed: /Library/WebServer/Documents/WorkspacePHP/mage/node_modules/@angular-devkit/build-angular/node_modules/esbuild/bin/esbuild__ --version
dyld: Symbol not found: _clock_gettime
  Referenced from: /Library/WebServer/Documents/WorkspacePHP/mage/node_modules/@angular-devkit/build-angular/node_modules/esbuild/bin/esbuild__
  Expected in: flat namespace

I've tried the alternative WASM version. But no luck so far.

npm install esbuild-wasm

Are there more steps I should follow in order to make this work?

Thanks in advance.

@evanw
Copy link
Owner

evanw commented Sep 21, 2021

The platforms that esbuild currently supports are the same platforms that Go currently supports since esbuild is written in Go. The latest version of Go (1.17) only supports macOS 10.13 or higher (released in 2017).

The WASM version should work since WASM is platform-independent and presumably node's WASM support for macOS 10.11 works. That's the approach I'd recommend. What does "no luck so far" mean? Do you get an error?

If you really want to use the native version of esbuild, you could try building from source using Go version 1.14 (the last version to support macOS 10.11).

@fergardi
Copy link

I'm trying to develop and compile an Angular12 project, but keep getting the same error, even after installing the esbuild-wasm package.

I don't have the esbuild dependency directly in my package.json so I guess it is a chained dependency I cannot get rid of.

So I don't really know how to bypass this installation error.

Thanks for your response.

@fergardi
Copy link

fergardi commented Mar 10, 2022

For anybody having the same issue, see sveltejs/kit#3028 (comment) for an alternative solution.

@DespertaWeb
Copy link

As @fergardi links to, I just managed to survive the planned obsolescence thanks to:
sveltejs/kit#3028 (comment)

Issue:
Old OS => MacOS Sierra : v10.12.6

SOLUTION:

  1. Update your package.json, like os:
"devDependencies":{
  "esbuild-wasm":"latest"
},
"pnpm":{
  "overrides":{
    "esbuild":"npm:esbuild-wasm@latest"
  }
}
  1. Use to PNPM:

    1. Install pnpm: https://pnpm.io/installation
    2. install packages: pnpm i
    3. Run your server, for example: pnpm dev
  2. Back to the game!

@guizhixiao
Copy link

As @fergardi links to, I just managed to survive the planned obsolescence thanks to: sveltejs/kit#3028 (comment)

Issue: Old OS => MacOS Sierra : v10.12.6

SOLUTION:

  1. Update your package.json, like os:
"devDependencies":{
  "esbuild-wasm":"latest"
},
"pnpm":{
  "overrides":{
    "esbuild":"npm:esbuild-wasm@latest"
  }
}
  1. Use to PNPM:

    1. Install pnpm: https://pnpm.io/installation
    2. install packages: pnpm i
    3. Run your server, for example: pnpm dev
  2. Back to the game!

thanks, This method solved my problem

@hacker112
Copy link

I had the same issue still running on Mac OS X El Capitan 10.11.6 when I wanted to test Vite that uses esbuild.
Here is my hacky solution to redirect esbuild to esbuild-wasm without PNPM :)

fix-esbuild.sh:

#!/bin/sh

npm i
npm i -D esbuild-wasm
rm -rf node_modules/esbuild
ln -s $(pwd)/node_modules/esbuild-wasm ./node_modules/esbuild

package.json:

{
  "name": "vite-project",
  "private": true,
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "tsc && vite build",
    "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
    "preview": "vite preview"
  },
  "dependencies": {
    "react": "^18.2.0",
    "react-dom": "^18.2.0"
  },
  "devDependencies": {
    "@types/react": "^18.2.15",
    "@types/react-dom": "^18.2.7",
    "@typescript-eslint/eslint-plugin": "^6.0.0",
    "@typescript-eslint/parser": "^6.0.0",
    "@vitejs/plugin-react": "^4.0.3",
    "esbuild-wasm": "^0.19.2",
    "eslint": "^8.45.0",
    "eslint-plugin-react-hooks": "^4.6.0",
    "eslint-plugin-react-refresh": "^0.4.3",
    "typescript": "^5.0.2",
    "vite": "^4.4.5"
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants