Outline
I recently started using a new development machine (Macbook M2 Max
). So, when I was setting up the development environment for the existing project developed with Vue2
, I got the following error.
error /node_modules/deasync: Command failed.
Exit code: 1
Command: node ./build.js
Arguments:
Directory: /node_modules/deasync
Output:
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | arm64
gyp info find Python using Python version 3.11.6 found at "/opt/homebrew/opt/[email protected]/bin/python3.11"
gyp info spawn /opt/homebrew/opt/[email protected]/bin/python3.11
gyp info spawn args [
gyp info spawn args '/.nvm/versions/node/v18.16.1/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/node_modules/deasync/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/.nvm/versions/node/v18.16.1/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Library/Caches/node-gyp/18.16.1/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/Library/Caches/node-gyp/18.16.1',
gyp info spawn args '-Dnode_gyp_dir=/.nvm/versions/node/v18.16.1/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/Library/Caches/node-gyp/18.16.1/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/node_modules/deasync',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
CXX(target) Release/obj.target/deasync/src/deasync.o
SOLINK_MODULE(target) Release/deasync.node
rm -no /lib -o Release/deasync.node Release/obj.target/deasync/src/deasync.o
rm: illegal option -- n
usage: rm [-f | -i] [-dIPRrvWx] file ...
unlink [--] file
make: *** [Release/deasync.node] Error 64
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/.nvm/versions/node/v18.16.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:203:23)
gyp ERR! stack at ChildProcess.emit (node:events:513:28)
gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Darwin 23.1.0
gyp ERR! command "/.nvm/versions/node/v18.16.1/bin/node" "/.nvm/versions/node/v18.16.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /node_modules/deasync
gyp ERR! node -v v18.16.1
In this blog post, I will introduce how to resolve the node-gyp
error when installing the deasync
NPM package on the Mac M2 silicon chip
.
Error cause
I am currently not using deasync
directly in the Vue2
project. So, I didn’t understand why this error was occurring.
I tried to look at the error message in more detail, I found that the vue-jest
library is using deasync
, which is causing this error.
At first, I thought that the problem was that the version of vue-jest
was low, so the version of deasync
was also low. So, I tried to install the latest version of deasync
, but the same error occurred.
Through several investigations, I found that the silicon chip (arm64
) of Macbook M2 Max
was the problem. My development environment is as follows.
- Apple M2 Max
- Node: 18.16.1
- Yarn: 1.22.19
- Python: 3.11.6
Solution
I use NVM
to manage the Node
version. I tried several ways, but all failed.
However, I was able to solve the problem by changing the zsh
settings as follows and reinstalling Node
.
- Delete the existing
Node
version
nvm uninstall 18.16.1
- Change the
zsh
settings tox86_64
arch -x86_64 zsh
- Reinstall
Node
nvm install 18.16.1
exit
- Install packages
yarn install
Completed
I use Homebrew
and Shell Script
to automatically configure the development environment.
When I set up the development environment automatically on a new development machine (Macbook M2 Max
), there was no problem. However, I had a hard time because this problem occurred in the existing project developed with Vue2
. I hope this blog post will help someone who have the same problem as me.
Was my blog helpful? Please leave a comment at the bottom. it will be a great help to me!
App promotion
Deku
.Deku
created the applications with Flutter.If you have interested, please try to download them for free.