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

Cannot install on NodeJS 20 and npm 10.4.0 #5787

Closed
3 tasks done
adrian-niculescu opened this issue Feb 5, 2024 · 18 comments
Closed
3 tasks done

Cannot install on NodeJS 20 and npm 10.4.0 #5787

adrian-niculescu opened this issue Feb 5, 2024 · 18 comments
Labels
known issue Issue that is known, has a fix or a workaround.

Comments

@adrian-niculescu
Copy link

Issue Description

I am trying to update to NodeJS 20
on macOS Sonoma 14.3 I have a NodeJS installation managed with nvm

rm -rf ~/.npm/_cacache/; nvm install 20.11.0; nvm use 20.11.0; npm i -g [email protected]; npm i -g nativescript

results in

Now using node v20.11.0 (npm v10.3.0)

removed 13 packages, and changed 28 packages in 905ms

24 packages are looking for funding
  run `npm fund` for details
npm WARN deprecated [email protected]: Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau
npm ERR! code 1
npm ERR! path /Users/adriann/.nvm/versions/node/v20.11.0/lib/node_modules/nativescript/node_modules/fsevents
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | arm64
npm ERR! gyp info find Python using Python version 3.11.7 found at "/opt/homebrew/opt/[email protected]/bin/python3.11"
npm ERR! gyp info spawn /opt/homebrew/opt/[email protected]/bin/python3.11
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/Users/adriann/.nvm/versions/node/v20.11.0/lib/node_modules/nativescript/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/adriann/.nvm/versions/node/v20.11.0/lib/node_modules/nativescript/node_modules/fsevents/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/adriann/.nvm/versions/node/v20.11.0/lib/node_modules/nativescript/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/adriann/Library/Caches/node-gyp/20.11.0/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/Users/adriann/Library/Caches/node-gyp/20.11.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/Users/adriann/.nvm/versions/node/v20.11.0/lib/node_modules/nativescript/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/adriann/Library/Caches/node-gyp/20.11.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/adriann/.nvm/versions/node/v20.11.0/lib/node_modules/nativescript/node_modules/fsevents',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp: binding.gyp not found (cwd: /Users/adriann/.nvm/versions/node/v20.11.0/lib/node_modules/nativescript/node_modules/fsevents) while trying to load binding.gyp
npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.<anonymous> (/Users/adriann/.nvm/versions/node/v20.11.0/lib/node_modules/nativescript/node_modules/node-gyp/lib/configure.js:271:18)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:518:28)
npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:294:12)
npm ERR! gyp ERR! System Darwin 23.3.0
npm ERR! gyp ERR! command "/Users/adriann/.nvm/versions/node/v20.11.0/bin/node" "/Users/adriann/.nvm/versions/node/v20.11.0/lib/node_modules/nativescript/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /Users/adriann/.nvm/versions/node/v20.11.0/lib/node_modules/nativescript/node_modules/fsevents
npm ERR! gyp ERR! node -v v20.11.0
npm ERR! gyp ERR! node-gyp -v v10.0.1
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in: /Users/adriann/.npm/_logs/2024-02-05T17_46_50_035Z-debug-0.log

Note that the same works on npm 10.2.4 (which comes out-of-the-box with NodeJS 20.11.0) and also works on npm 10.3.0, so it's something isolated to (or starting from) npm version 10.3.4

Reproduction

No response

Relevant log output (if applicable)

4118 timing build:link Completed in 47ms
4119 info run [email protected] install node_modules/nativescript/node_modules/fsevents node-gyp rebuild
4120 info run [email protected] install { code: 1, signal: null }
4121 timing reify:rollback:createSparse Completed in 716ms
4122 timing reify:rollback:retireShallow Completed in 1ms
4123 timing command:i Completed in 14983ms
4124 verbose stack Error: command failed
4124 verbose stack     at ChildProcess.<anonymous> (/Users/adriann/.nvm/versions/node/v20.11.0/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:53:27)
4124 verbose stack     at ChildProcess.emit (node:events:518:28)
4124 verbose stack     at maybeClose (node:internal/child_process:1105:16)
4124 verbose stack     at ChildProcess._handle.onexit (node:internal/child_process:305:5)
4125 verbose pkgid [email protected]
4126 verbose cwd /Users/adriann/Developer/MobileHM/unfence.moblib.device
4127 verbose Darwin 23.3.0
4128 verbose node v20.11.0
4129 verbose npm  v10.4.0
4130 error code 1
4131 error path /Users/adriann/.nvm/versions/node/v20.11.0/lib/node_modules/nativescript/node_modules/fsevents
4132 error command failed
4133 error command sh -c node-gyp rebuild
4134 error gyp info it worked if it ends with ok
4134 error gyp info using [email protected]
4134 error gyp info using [email protected] | darwin | arm64
4134 error gyp info find Python using Python version 3.11.7 found at "/opt/homebrew/opt/[email protected]/bin/python3.11"
4134 error gyp info spawn /opt/homebrew/opt/[email protected]/bin/python3.11
4134 error gyp info spawn args [
4134 error gyp info spawn args '/Users/adriann/.nvm/versions/node/v20.11.0/lib/node_modules/nativescript/node_modules/node-gyp/gyp/gyp_main.py',
4134 error gyp info spawn args 'binding.gyp',
4134 error gyp info spawn args '-f',
4134 error gyp info spawn args 'make',
4134 error gyp info spawn args '-I',
4134 error gyp info spawn args '/Users/adriann/.nvm/versions/node/v20.11.0/lib/node_modules/nativescript/node_modules/fsevents/build/config.gypi',
4134 error gyp info spawn args '-I',
4134 error gyp info spawn args '/Users/adriann/.nvm/versions/node/v20.11.0/lib/node_modules/nativescript/node_modules/node-gyp/addon.gypi',
4134 error gyp info spawn args '-I',
4134 error gyp info spawn args '/Users/adriann/Library/Caches/node-gyp/20.11.0/include/node/common.gypi',
4134 error gyp info spawn args '-Dlibrary=shared_library',
4134 error gyp info spawn args '-Dvisibility=default',
4134 error gyp info spawn args '-Dnode_root_dir=/Users/adriann/Library/Caches/node-gyp/20.11.0',
4134 error gyp info spawn args '-Dnode_gyp_dir=/Users/adriann/.nvm/versions/node/v20.11.0/lib/node_modules/nativescript/node_modules/node-gyp',
4134 error gyp info spawn args '-Dnode_lib_file=/Users/adriann/Library/Caches/node-gyp/20.11.0/<(target_arch)/node.lib',
4134 error gyp info spawn args '-Dmodule_root_dir=/Users/adriann/.nvm/versions/node/v20.11.0/lib/node_modules/nativescript/node_modules/fsevents',
4134 error gyp info spawn args '-Dnode_engine=v8',
4134 error gyp info spawn args '--depth=.',
4134 error gyp info spawn args '--no-parallel',
4134 error gyp info spawn args '--generator-output',
4134 error gyp info spawn args 'build',
4134 error gyp info spawn args '-Goutput_dir=.'
4134 error gyp info spawn args ]
4134 error gyp: binding.gyp not found (cwd: /Users/adriann/.nvm/versions/node/v20.11.0/lib/node_modules/nativescript/node_modules/fsevents) while trying to load binding.gyp
4134 error gyp ERR! configure error 
4134 error gyp ERR! stack Error: `gyp` failed with exit code: 1
4134 error gyp ERR! stack at ChildProcess.<anonymous> (/Users/adriann/.nvm/versions/node/v20.11.0/lib/node_modules/nativescript/node_modules/node-gyp/lib/configure.js:271:18)
4134 error gyp ERR! stack at ChildProcess.emit (node:events:518:28)
4134 error gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:294:12)
4134 error gyp ERR! System Darwin 23.3.0
4134 error gyp ERR! command "/Users/adriann/.nvm/versions/node/v20.11.0/bin/node" "/Users/adriann/.nvm/versions/node/v20.11.0/lib/node_modules/nativescript/node_modules/.bin/node-gyp" "rebuild"
4134 error gyp ERR! cwd /Users/adriann/.nvm/versions/node/v20.11.0/lib/node_modules/nativescript/node_modules/fsevents
4134 error gyp ERR! node -v v20.11.0
4134 error gyp ERR! node-gyp -v v10.0.1
4134 error gyp ERR! not ok
4135 verbose exit 1
4136 timing npm Completed in 15066ms
4137 verbose unfinished npm timer reify 1707155210120
4138 verbose unfinished npm timer reify:build 1707155224080
4139 verbose unfinished npm timer build 1707155224081
4140 verbose unfinished npm timer build:deps 1707155224081
4141 verbose unfinished npm timer build:run:install 1707155224138
4142 verbose unfinished npm timer build:run:install:node_modules/nativescript/node_modules/fsevents 1707155224138
4143 verbose code 1
4144 error A complete log of this run can be found in: /Users/adriann/.npm/_logs/2024-02-05T17_46_50_035Z-debug-0.log

Environment

OS: macOS 14.3
CPU: (12) arm64 Apple M2 Pro
Shell: /bin/bash
node: 20.11.0
npm: 10.4.0
nativescript: 8.6.5

# android
java: 17.0.7
ndk: Not Found
apis: 33, 34
build_tools: 34.0.0
system_images: 
  - android-28 | Google ARM64-V8a Play ARM 64 v8a
  - android-29 | Google Play ARM 64 v8a
  - android-30 | Google APIs ARM 64 v8a
  - android-30 | Google Play ARM 64 v8a
  - android-33 | Google APIs ARM 64 v8a
  - android-33 | Google Play ARM 64 v8a
  - android-34-ext8 | Google Play ARM 64 v8a
  - android-34 | Google APIs ARM 64 v8a
  - android-34 | Google Play ARM 64 v8a

# ios
xcode: 15.2/15C500b
cocoapods: 1.15.0
python: 3.11.7
python3: 3.11.7
ruby: 3.3.0
platforms: 
  - DriverKit 23.2
  - iOS 17.2
  - macOS 14.2
  - tvOS 17.2
  - visionOS 1.0
  - watchOS 10.2

Dependencies

"dependencies": {},
"devDependencies": {}

Please accept these terms

@adrian-niculescu adrian-niculescu added the bug-pending-triage Reported bug, pending triage to confirm. label Feb 5, 2024
@RehArk
Copy link

RehArk commented Mar 21, 2024

Same bug here on node 20.10.0 :

npm ERR! code 1
npm ERR! path /usr/local/lib/node_modules/nativescript/node_modules/fsevents
npm ERR! command failed

@rigor789
Copy link
Member

OS: macOS 14.4
CPU: (12) arm64 Apple M3 Pro
Shell: /bin/zsh
node: 21.6.2
npm: 10.2.4
nativescript: 8.6.6-next-02-23-2024-8019050415

# ios
xcode: 15.2/15C500b
cocoapods: 1.15.2
python: Not Found
python3: 3.9.6
ruby: 2.7.8
platforms:
  - DriverKit 23.2
  - iOS 17.2
  - macOS 14.2
  - tvOS 17.2
  - visionOS 1.0
  - watchOS 10.2

No issues on node 21.6.2 here. I have seen others having issues with fsevents (some on Windows) but not really sure what causes it - as far as I understand fsevents wouldn't even attempt to build on Windows machines because it's macos specific. We also don't directly depend on fsevents either, plus it's marked optional so failing to build it shouldn't cause installation errors at all. I suspect it's either system env related, or an npm bug perhaps?

npm why fsevents
[email protected] optional
node_modules/fsevents
  optional fsevents@"~2.3.2" from [email protected]
  node_modules/chokidar
    chokidar@"3.5.3" from the root project
    chokidar@"*" from @types/[email protected]
    node_modules/@types/chokidar
      dev @types/chokidar@"2.1.3" from the root project
    chokidar@"3.5.3" from [email protected]
    node_modules/mocha
      dev mocha@"10.2.0" from the root project
    chokidar@"^3.5.2" from [email protected]
    node_modules/nodemon

@minichiello
Copy link

I'm having the same problem of not being able to install on Ubuntu 22.04

Node: v20.11.1
npm: 10.5.0
Python: 3.12.2
NativeScript: 8.6.5

Error:
npm i -g nativescript npm WARN deprecated [email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. npm WARN deprecated [email protected]: Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau npm ERR! code 1 npm ERR! path /home/gerson/.asdf/installs/nodejs/20.11.1/lib/node_modules/nativescript/node_modules/fsevents npm ERR! command failed npm ERR! command sh -c node-gyp rebuild npm ERR! gyp info it worked if it ends with ok npm ERR! gyp info using [email protected] npm ERR! gyp info using [email protected] | linux | x64 npm ERR! gyp info find Python using Python version 3.12.2 found at "/home/gerson/.asdf/installs/python/3.12.2/bin/python" npm ERR! gyp info spawn /home/gerson/.asdf/installs/python/3.12.2/bin/python npm ERR! gyp info spawn args [ npm ERR! gyp info spawn args '/home/gerson/.asdf/installs/nodejs/20.11.1/lib/node_modules/nativescript/node_modules/node-gyp/gyp/gyp_main.py', npm ERR! gyp info spawn args 'binding.gyp', npm ERR! gyp info spawn args '-f', npm ERR! gyp info spawn args 'make', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args '/home/gerson/.asdf/installs/nodejs/20.11.1/lib/node_modules/nativescript/node_modules/fsevents/build/config.gypi', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args '/home/gerson/.asdf/installs/nodejs/20.11.1/lib/node_modules/nativescript/node_modules/node-gyp/addon.gypi', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args '/home/gerson/.cache/node-gyp/20.11.1/include/node/common.gypi', npm ERR! gyp info spawn args '-Dlibrary=shared_library', npm ERR! gyp info spawn args '-Dvisibility=default', npm ERR! gyp info spawn args '-Dnode_root_dir=/home/gerson/.cache/node-gyp/20.11.1', npm ERR! gyp info spawn args '-Dnode_gyp_dir=/home/gerson/.asdf/installs/nodejs/20.11.1/lib/node_modules/nativescript/node_modules/node-gyp', npm ERR! gyp info spawn args '-Dnode_lib_file=/home/gerson/.cache/node-gyp/20.11.1/<(target_arch)/node.lib', npm ERR! gyp info spawn args '-Dmodule_root_dir=/home/gerson/.asdf/installs/nodejs/20.11.1/lib/node_modules/nativescript/node_modules/fsevents', npm ERR! gyp info spawn args '-Dnode_engine=v8', npm ERR! gyp info spawn args '--depth=.', npm ERR! gyp info spawn args '--no-parallel', npm ERR! gyp info spawn args '--generator-output', npm ERR! gyp info spawn args 'build', npm ERR! gyp info spawn args '-Goutput_dir=.' npm ERR! gyp info spawn args ] npm ERR! gyp: binding.gyp not found (cwd: /home/gerson/.asdf/installs/nodejs/20.11.1/lib/node_modules/nativescript/node_modules/fsevents) while trying to load binding.gyp npm ERR! gyp ERR! configure error npm ERR! gyp ERR! stack Error: gyp failed with exit code: 1 npm ERR! gyp ERR! stack at ChildProcess.<anonymous> (/home/gerson/.asdf/installs/nodejs/20.11.1/lib/node_modules/nativescript/node_modules/node-gyp/lib/configure.js:271:18) npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:518:28) npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:294:12) npm ERR! gyp ERR! System Linux 6.5.0-26-generic npm ERR! gyp ERR! command "/home/gerson/.asdf/installs/nodejs/20.11.1/bin/node" "/home/gerson/.asdf/installs/nodejs/20.11.1/lib/node_modules/nativescript/node_modules/.bin/node-gyp" "rebuild" npm ERR! gyp ERR! cwd /home/gerson/.asdf/installs/nodejs/20.11.1/lib/node_modules/nativescript/node_modules/fsevents npm ERR! gyp ERR! node -v v20.11.1 npm ERR! gyp ERR! node-gyp -v v10.0.1 npm ERR! gyp ERR! not ok

@alexander-mai
Copy link

I have the same Problem on a MacBook Pro M2:

% node -v
v21.7.1

% npm -v
10.5.0

% npm i -g nativescript        
npm WARN deprecated [email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated [email protected]: Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau
npm ERR! code 1
npm ERR! path /opt/homebrew/lib/node_modules/nativescript/node_modules/fsevents
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | arm64
npm ERR! gyp info find Python using Python version 3.12.2 found at "/opt/homebrew/opt/[email protected]/bin/python3.12"
npm ERR! gyp info spawn /opt/homebrew/opt/[email protected]/bin/python3.12
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/opt/homebrew/lib/node_modules/nativescript/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/opt/homebrew/lib/node_modules/nativescript/node_modules/fsevents/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/opt/homebrew/lib/node_modules/nativescript/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/amai/Library/Caches/node-gyp/21.7.1/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/Users/amai/Library/Caches/node-gyp/21.7.1',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/opt/homebrew/lib/node_modules/nativescript/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/amai/Library/Caches/node-gyp/21.7.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/opt/homebrew/lib/node_modules/nativescript/node_modules/fsevents',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp: binding.gyp not found (cwd: /opt/homebrew/lib/node_modules/nativescript/node_modules/fsevents) while trying to load binding.gyp
npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.<anonymous> (/opt/homebrew/lib/node_modules/nativescript/node_modules/node-gyp/lib/configure.js:271:18)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:519:28)
npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:294:12)
npm ERR! gyp ERR! System Darwin 23.3.0
npm ERR! gyp ERR! command "/opt/homebrew/Cellar/node/21.7.1/bin/node" "/opt/homebrew/lib/node_modules/nativescript/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /opt/homebrew/lib/node_modules/nativescript/node_modules/fsevents
npm ERR! gyp ERR! node -v v21.7.1
npm ERR! gyp ERR! node-gyp -v v10.0.1
npm ERR! gyp ERR! not ok

@rigor789
Copy link
Member

See if this helps? nodejs/node-gyp#2992 (comment)

All of the errors above seem to have the Homebrew Python in common.

Maybe the system python would work better - you could also try uninstalling the brew python and try again.


We're likely going to simplify setup and not require python explicitly anymore soon (since it ships with xCode, we can likely use that one where python is needed in the runtime/metadata-generator)

@alexander-mai
Copy link

I could not uninstall python from homebrew, because it is required by other packages like Podman.

Only using NODE_GYP_FORCE_PYTHON=python3 npm i -g nativescript produced the same error.

@abdurrahmanarikan
Copy link

abdurrahmanarikan commented Mar 29, 2024

I do have the same problem, no matter what I have done (with brew installed python or native python from mac), It did not solve the problem. Strangely enough, the node-gyp is trying some thing which does not exists:

gyp: binding.gyp not found (cwd: /Users//.nvm/versions/node/v21.7.1/lib/node_modules/nativescript/node_modules/fsevents) while trying to load binding.gyp
the foldre /Users//.nvm/versions/node/v21.7.1/lib/node_modules/nativescript/ does not exist after the setup. I assume it was cached previously or it is being deleted right after the error occurs.

Apple M3 Max with Sonomo 14.4.1

@edusperoni
Copy link
Collaborator

Seems like homebrew actually broke something with python. You can use pip3 install setuptools and it should work again.

@abdurrahmanarikan
Copy link

abdurrahmanarikan commented Mar 29, 2024

it did not work, still getting the same error
I have created my env by using :
python3 -m venv ~/myenv
then I used:

NODE_GYP_FORCE_PYTHON=/Users/<username>/myenv/bin/python npm i -g nativescript
Then I got the below:

npm WARN deprecated [email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated [email protected]: Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau
npm ERR! code 1
npm ERR! path /Users/<username>/Library/Application Support/fnm/node-versions/v21.7.1/installation/lib/node_modules/nativescript/node_modules/fsevents
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | arm64
npm ERR! gyp info find Python using Python version 3.12.2 found at "/Users/<username>/myenv/bin/python"
npm ERR! gyp info spawn /Users/<username>/myenv/bin/python
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/Users/<username>/Library/Application Support/fnm/node-versions/v21.7.1/installation/lib/node_modules/nativescript/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/<username>/Library/Application Support/fnm/node-versions/v21.7.1/installation/lib/node_modules/nativescript/node_modules/fsevents/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/<username>/Library/Application Support/fnm/node-versions/v21.7.1/installation/lib/node_modules/nativescript/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/<username>/Library/Caches/node-gyp/21.7.1/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/Users/<username>/Library/Caches/node-gyp/21.7.1',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/Users/<username>/Library/Application Support/fnm/node-versions/v21.7.1/installation/lib/node_modules/nativescript/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/<username>/Library/Caches/node-gyp/21.7.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/<username>/Library/Application Support/fnm/node-versions/v21.7.1/installation/lib/node_modules/nativescript/node_modules/fsevents',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp: binding.gyp not found (cwd: /Users/<username>/Library/Application Support/fnm/node-versions/v21.7.1/installation/lib/node_modules/nativescript/node_modules/fsevents) while trying to load binding.gyp
npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.<anonymous> (/Users/<username>/Library/Application Support/fnm/node-versions/v21.7.1/installation/lib/node_modules/nativescript/node_modules/node-gyp/lib/configure.js:297:18)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:519:28)
npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:294:12)
npm ERR! gyp ERR! System Darwin 23.4.0
npm ERR! gyp ERR! command "/Users/<username>/Library/Application Support/fnm/node-versions/v21.7.1/installation/bin/node" "/Users/<username>/Library/Application Support/fnm/node-versions/v21.7.1/installation/lib/node_modules/nativescript/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /Users/<username>/Library/Application Support/fnm/node-versions/v21.7.1/installation/lib/node_modules/nativescript/node_modules/fsevents
npm ERR! gyp ERR! node -v v21.7.1
npm ERR! gyp ERR! node-gyp -v v10.1.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in: /Users/<username>/.npm/_logs/2024-03-29T01_21_07_719Z-debug-0.log

same applies when I use the system-wide python:

npm WARN deprecated [email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated [email protected]: Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau
npm ERR! code 1
npm ERR! path /Users/<username>/Library/Application Support/fnm/node-versions/v21.7.1/installation/lib/node_modules/nativescript/node_modules/fsevents
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | arm64
npm ERR! gyp info find Python using Python version 3.9.6 found at "/Users/<username>/myenv/bin/python"
npm ERR! gyp info spawn /Users/<username>/myenv/bin/python
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/Users/<username>/Library/Application Support/fnm/node-versions/v21.7.1/installation/lib/node_modules/nativescript/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/<username>/Library/Application Support/fnm/node-versions/v21.7.1/installation/lib/node_modules/nativescript/node_modules/fsevents/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/<username>/Library/Application Support/fnm/node-versions/v21.7.1/installation/lib/node_modules/nativescript/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/<username>/Library/Caches/node-gyp/21.7.1/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/Users/<username>/Library/Caches/node-gyp/21.7.1',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/Users/<username>/Library/Application Support/fnm/node-versions/v21.7.1/installation/lib/node_modules/nativescript/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/<username>/Library/Caches/node-gyp/21.7.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/<username>/Library/Application Support/fnm/node-versions/v21.7.1/installation/lib/node_modules/nativescript/node_modules/fsevents',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp: binding.gyp not found (cwd: /Users/<username>/Library/Application Support/fnm/node-versions/v21.7.1/installation/lib/node_modules/nativescript/node_modules/fsevents) while trying to load binding.gyp
npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.<anonymous> (/Users/<username>/Library/Application Support/fnm/node-versions/v21.7.1/installation/lib/node_modules/nativescript/node_modules/node-gyp/lib/configure.js:297:18)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:519:28)
npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:294:12)
npm ERR! gyp ERR! System Darwin 23.4.0
npm ERR! gyp ERR! command "/Users/<username>/Library/Application Support/fnm/node-versions/v21.7.1/installation/bin/node" "/Users/<username>/Library/Application Support/fnm/node-versions/v21.7.1/installation/lib/node_modules/nativescript/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /Users/<username>/Library/Application Support/fnm/node-versions/v21.7.1/installation/lib/node_modules/nativescript/node_modules/fsevents
npm ERR! gyp ERR! node -v v21.7.1
npm ERR! gyp ERR! node-gyp -v v10.1.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in: /Users/<username>/.npm/_logs/2024-03-29T01_25_46_604Z-debug-0.log

@abdurrahmanarikan
Copy link

Seems like homebrew actually broke something with python. You can use pip3 install setuptools and it should work again.

FYI, I have completely removed brew installed python and used only system-wide provided python, it did not work ...

@jcassidyav
Copy link
Contributor

Downgrading npm to 10.3.0 worked for me ( after installing node 18.20)

@alexander-mai
Copy link

Downgrading to [email protected] while using [email protected] worked for me.
Thank you @jcassidyav

@Yasuomaru
Copy link

The thing that worked for me was using yarn instead of npm.

yarn global add nativescript

@rigor789
Copy link
Member

rigor789 commented Apr 9, 2024

Please see NativeScript/NativeScript#10509

@rigor789 rigor789 added known issue Issue that is known, has a fix or a workaround. and removed bug-pending-triage Reported bug, pending triage to confirm. labels Apr 9, 2024
@rigor789 rigor789 pinned this issue Apr 9, 2024
@ecorbisierSimplon
Copy link

ecorbisierSimplon commented Apr 26, 2024

Hello,
downgrading npm to version 10.3 worked for me:
npm i -g npm@~10.3
Thank you rigor789 👍

@jvondermarck
Copy link

jvondermarck commented May 17, 2024

Hello, downgrading npm to version 10.3 also worked for me (with node v20.11.0). Thanks for the help.

@rigor789
Copy link
Member

Fixed in https://github.com/NativeScript/nativescript-cli/releases/tag/v8.7.2

@adrian-niculescu
Copy link
Author

The issue is indeed fixed.
Tested on node 20.14.0 with npm 10.8.0. npm install -g nativescript works as expected.
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
known issue Issue that is known, has a fix or a workaround.
Projects
None yet
Development

No branches or pull requests

12 participants