Skip to content

Commit

Permalink
Fix Mac compatibility issues caused by the node-sass in Mac arm p…
Browse files Browse the repository at this point in the history
…rocessors (#340)

### What

Fix Mac compatibility issues caused by the `node-sass` in Mac `arm` processors.

### Why

When attempting to run `yarn install`, the `node-sass` package returns the following error, when executing from a ac with `arm` processor:

```text
[4/4] 🔨  Building fresh packages...
[-/3] ⠠ waiting...
[2/3] ⠠ node-sass
error /Users/marcelosantos/Workspace/stellar-demo-wallet/node_modules/node-sass: Command failed.
Exit code: 1
Command: node scripts/build.js
Arguments: 
Directory: /Users/marcelosantos/Workspace/stellar-demo-wallet/node_modules/node-sass
Output:
Binary found at /Users/marcelosantos/Workspace/stellar-demo-wallet/node_modules/node-sass/vendor/darwin-arm64-108/binding.node
Testing binary
Binary has a problem: Error: dlopen(/Users/marcelosantos/Workspace/stellar-demo-wallet/node_modules/node-sass/vendor/darwin-arm64-108/binding.node, 0x0001): tried: '/Users/marcelosantos/Workspace/stellar-demo-wallet/node_modules/node-sass/vendor/darwin-arm64-108/binding.node' (not a mach-o file), '/System/Volumes/Preboot/Cryptexes/OS/Users/marcelosantos/Workspace/stellar-demo-wallet/node_modules/node-sass/vendor/darwin-arm64-108/binding.node' (no such file), '/Users/marcelosantos/Workspace/stellar-demo-wallet/node_modules/node-sass/vendor/darwin-arm64-108/binding.node' (not a mach-o file)
    at Module._extensions..node (node:internal/modules/cjs/loader:1338:18)
    at Module.load (node:internal/modules/cjs/loader:1117:32)
    at Module._load (node:internal/modules/cjs/loader:958:12)
    at Module.require (node:internal/modules/cjs/loader:1141:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at module.exports (/Users/marcelosantos/Workspace/stellar-demo-wallet/node_modules/node-sass/lib/binding.js:19:10)
    at Object.<anonymous> (/Users/marcelosantos/Workspace/stellar-demo-wallet/node_modules/node-sass/lib/index.js:13:35)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Module.load (node:internal/modules/cjs/loader:1117:32) {
  code: 'ERR_DLOPEN_FAILED'
}
Building the binary locally
Building: /Users/marcelosantos/.nvm/versions/node/v18.16.0/bin/node /Users/marcelosantos/Workspace/stellar-demo-wallet/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
/Users/marcelosantos/Workspace/stellar-demo-wallet/node_modules/wide-align/align.js:2
var stringWidth = require('string-width')
                  ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/marcelosantos/Workspace/stellar-demo-wallet/node_modules/string-width/index.js from /Users/marcelosantos/Workspace/stellar-demo-wallet/node_modules/wide-align/align.js not supported.
Instead change the require of index.js in /Users/marcelosantos/Workspace/stellar-demo-wallet/node_modules/wide-align/align.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/Users/marcelosantos/Workspace/stellar-demo-wallet/node_modules/wide-align/align.js:2:19)
    at Object.<anonymous> (/Users/marcelosantos/Workspace/stellar-demo-wallet/node_modules/gauge/lib/render-template.js:2:13)
    at Object.<anonymous> (/Users/marcelosantos/Workspace/stellar-demo-wallet/node_modules/gauge/lib/plumbing.js:3:22)
    at Object.<anonymous> (/Users/marcelosantos/Workspace/stellar-demo-wallet/node_modules/gauge/lib/index.js:2:16)
    at Object.<anonymous> (/Users/marcelosantos/Workspace/stellar-demo-wallet/node_modules/npmlog/lib/log.js:3:13)
    at Object.<anonymous> (/Users/marcelosantos/Workspace/stellar-demo-wallet/node_modules/node-gyp/lib/node-gyp.js:5:13)
    at Object.<anonymous> (/Users/marcelosantos/Workspace/stellar-demo-wallet/node_modules/node-gyp/bin/node-gyp.js:8:13) {
  code: 'ERR_REQUIRE_ESM'
}

Node.js v18.16.0
```
  • Loading branch information
marcelosalloum committed Jan 12, 2024
1 parent 0f6a298 commit e47aed6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 835 deletions.
2 changes: 1 addition & 1 deletion packages/demo-wallet-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@
"https-browserify": "^1.0.0",
"lodash": "^4.17.21",
"marked": "^7.0.3",
"node-sass": "^9.0.0",
"os-browserify": "^0.3.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-redux": "^8.1.2",
"react-router-dom": "^6.15.0",
"redux": "^4.2.1",
"sass": "^1.69.7",
"stellar-sdk": "^11.0.1",
"stream-browserify": "^3.0.0",
"stream-http": "^3.2.0",
Expand Down
Loading

0 comments on commit e47aed6

Please sign in to comment.