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

2.0 brings npm i issues (node-gyp) to my Mac #64

Open
RyanParsley opened this issue Oct 24, 2024 · 3 comments
Open

2.0 brings npm i issues (node-gyp) to my Mac #64

RyanParsley opened this issue Oct 24, 2024 · 3 comments

Comments

@RyanParsley
Copy link

I can initialize a clean app just fine. However, attempting to run npm i fails with node-gyp errors.

Specifically, when npm i gets to wasm-sjlj I get node-gyp build errors.

My failed attempt to debug

I believe python3 is dubiously usable with node-gyp because of the potential need for 2.7 dependencies. I admit I'm not overly well versed in that though. Attempting to investigate this, I made use of python 2.7.18 via mise (my version control tool of choice). I confirmed the path is fine in the context of my workspace with which python reporting 2.7.18 in the expected directory. However, running npm i continues to report

npm error gyp info using [email protected]
npm error gyp info using [email protected] | darwin | arm64
npm error gyp info find Python using Python version 3.11.6 found at "/usr/local/bin/python3"
npm error gyp info spawn /usr/local/bin/python3
...

I went on to set NODE_GYP_FORCE_PYTHON to the location of 2.7.18 to no avail.

I don't get any of this on 1.4, I just see warnings about nx 18 being the highest supported level.

What it seems like

It seems to me like a difference between the dependencies in 1.4 and 2.0 are a bit more flakey with respect to node-gyp and respecting the path.

More comprehensive logs

npx create-nx-workspace --preset=@monodon/rust
Need to install the following packages:
[email protected]
Ok to proceed? (y)

NX Let's create a new workspace [https://nx.dev/getting-started/intro]

✔ Where would you like to create your workspace? · org
✔ Which CI provider would you like to use? · skip
✔ Would you like remote caching to make your build faster? · skip

NX Creating your v20.0.5 workspace.

✔ Installing dependencies with npm
✔ Successfully created the workspace: org.

NX Nx CLI is not installed globally.

This means that you will have to use "npx nx" to execute commands in the workspace.
Run "npm i -g nx" to be able to execute command directly.

NX Successfully applied preset: @monodon/rust

~/Projects/monodon-debug
❯ : cd org/

org on  main
❯ : npm i
npm error code 1
npm error path /Users/ryan/Projects/monodon-debug/org/node_modules/wasm-sjlj
npm error command failed
npm error command sh -c node-gyp rebuild
npm error gyp info it worked if it ends with ok
npm error gyp info using [email protected]
npm error gyp info using [email protected] | darwin | arm64
npm error gyp info find Python using Python version 3.13.0 found at "/Users/ryan/.local/share/mise/installs/python/3.13.0/bin/python3"
npm error gyp info spawn /Users/ryan/.local/share/mise/installs/python/3.13.0/bin/python3
npm error gyp info spawn args [
npm error gyp info spawn args '/Users/ryan/.local/share/mise/installs/node/20.18.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm error gyp info spawn args 'binding.gyp',
npm error gyp info spawn args '-f',
npm error gyp info spawn args 'make',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/Users/ryan/Projects/monodon-debug/org/node_modules/wasm-sjlj/build/config.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/Users/ryan/.local/share/mise/installs/node/20.18.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/Users/ryan/Library/Caches/node-gyp/20.18.0/include/node/common.gypi',
npm error gyp info spawn args '-Dlibrary=shared_library',
npm error gyp info spawn args '-Dvisibility=default',
npm error gyp info spawn args '-Dnode_root_dir=/Users/ryan/Library/Caches/node-gyp/20.18.0',
npm error gyp info spawn args '-Dnode_gyp_dir=/Users/ryan/.local/share/mise/installs/node/20.18.0/lib/node_modules/npm/node_modules/node-gyp',
npm error gyp info spawn args '-Dnode_lib_file=/Users/ryan/Library/Caches/node-gyp/20.18.0/<(target_arch)/node.lib',
npm error gyp info spawn args '-Dmodule_root_dir=/Users/ryan/Projects/monodon-debug/org/node_modules/wasm-sjlj',
npm error gyp info spawn args '-Dnode_engine=v8',
npm error gyp info spawn args '--depth=.',
npm error gyp info spawn args '--no-parallel',
npm error gyp info spawn args '--generator-output',
npm error gyp info spawn args 'build',
npm error gyp info spawn args '-Goutput_dir=.'
npm error gyp info spawn args ]
npm error gyp: binding.gyp not found (cwd: /Users/ryan/Projects/monodon-debug/org/node_modules/wasm-sjlj) while trying to load binding.gyp
npm error gyp ERR! configure error
npm error gyp ERR! stack Error: gyp failed with exit code: 1
npm error gyp ERR! stack at ChildProcess. (/Users/ryan/.local/share/mise/installs/node/20.18.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:297:18)
npm error gyp ERR! stack at ChildProcess.emit (node:events:519:28)
npm error gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:294:12)
npm error gyp ERR! System Darwin 23.6.0
npm error gyp ERR! command "/Users/ryan/.local/share/mise/installs/node/20.18.0/bin/node" "/Users/ryan/.local/share/mise/installs/node/20.18.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm error gyp ERR! cwd /Users/ryan/Projects/monodon-debug/org/node_modules/wasm-sjlj
npm error gyp ERR! node -v v20.18.0
npm error gyp ERR! node-gyp -v v10.1.0
npm error gyp ERR! not ok
npm error A complete log of this run can be found in: /Users/ryan/.npm/_logs/2024-10-24T15_51_51_525Z-debug-0.log

org on  main
❯ : which python
╭───┬─────────┬─────────────────────────────────────────────────────────────────┬──────────╮
│ # │ command │ path │ type │
├───┼─────────┼─────────────────────────────────────────────────────────────────┼──────────┤
│ 0 │ python │ /Users/ryan/.local/share/mise/installs/python/3.13.0/bin/python │ external │
╰───┴─────────┴─────────────────────────────────────────────────────────────────┴──────────╯

org on  main
❯ : mise use [email protected]
mise ~/Projects/monodon-debug/org/.mise.toml tools: [email protected]

org on  main
❯ : which python
╭───┬─────────┬─────────────────────────────────────────────────────────────────┬──────────╮
│ # │ command │ path │ type │
├───┼─────────┼─────────────────────────────────────────────────────────────────┼──────────┤
│ 0 │ python │ /Users/ryan/.local/share/mise/installs/python/2.7.18/bin/python │ external │
╰───┴─────────┴─────────────────────────────────────────────────────────────────┴──────────╯

org on  main
❯ : npm i
npm error code 1
npm error path /Users/ryan/Projects/monodon-debug/org/node_modules/wasm-sjlj
npm error command failed
npm error command sh -c node-gyp rebuild
npm error gyp info it worked if it ends with ok
npm error gyp info using [email protected]
npm error gyp info using [email protected] | darwin | arm64
npm error gyp info find Python using Python version 3.11.6 found at "/usr/local/bin/python3"
npm error gyp info spawn /usr/local/bin/python3
npm error gyp info spawn args [
npm error gyp info spawn args '/Users/ryan/.local/share/mise/installs/node/20.18.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm error gyp info spawn args 'binding.gyp',
npm error gyp info spawn args '-f',
npm error gyp info spawn args 'make',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/Users/ryan/Projects/monodon-debug/org/node_modules/wasm-sjlj/build/config.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/Users/ryan/.local/share/mise/installs/node/20.18.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/Users/ryan/Library/Caches/node-gyp/20.18.0/include/node/common.gypi',
npm error gyp info spawn args '-Dlibrary=shared_library',
npm error gyp info spawn args '-Dvisibility=default',
npm error gyp info spawn args '-Dnode_root_dir=/Users/ryan/Library/Caches/node-gyp/20.18.0',
npm error gyp info spawn args '-Dnode_gyp_dir=/Users/ryan/.local/share/mise/installs/node/20.18.0/lib/node_modules/npm/node_modules/node-gyp',
npm error gyp info spawn args '-Dnode_lib_file=/Users/ryan/Library/Caches/node-gyp/20.18.0/<(target_arch)/node.lib',
npm error gyp info spawn args '-Dmodule_root_dir=/Users/ryan/Projects/monodon-debug/org/node_modules/wasm-sjlj',
npm error gyp info spawn args '-Dnode_engine=v8',
npm error gyp info spawn args '--depth=.',
npm error gyp info spawn args '--no-parallel',
npm error gyp info spawn args '--generator-output',
npm error gyp info spawn args 'build',
npm error gyp info spawn args '-Goutput_dir=.'
npm error gyp info spawn args ]
npm error gyp: binding.gyp not found (cwd: /Users/ryan/Projects/monodon-debug/org/node_modules/wasm-sjlj) while trying to load binding.gyp
npm error gyp ERR! configure error
npm error gyp ERR! stack Error: gyp failed with exit code: 1
npm error gyp ERR! stack at ChildProcess. (/Users/ryan/.local/share/mise/installs/node/20.18.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:297:18)
npm error gyp ERR! stack at ChildProcess.emit (node:events:519:28)
npm error gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:294:12)
npm error gyp ERR! System Darwin 23.6.0
npm error gyp ERR! command "/Users/ryan/.local/share/mise/installs/node/20.18.0/bin/node" "/Users/ryan/.local/share/mise/installs/node/20.18.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm error gyp ERR! cwd /Users/ryan/Projects/monodon-debug/org/node_modules/wasm-sjlj
npm error gyp ERR! node -v v20.18.0
npm error gyp ERR! node-gyp -v v10.1.0
npm error gyp ERR! not ok
npm error A complete log of this run can be found in: /Users/ryan/.npm/_logs/2024-10-24T15_54_05_732Z-debug-0.log

@RyanParsley RyanParsley changed the title 2.0 brings npm issues to my mac 2.0 brings npm i issues (node-gyp) to my Mac Oct 24, 2024
@Kr0san89
Copy link

Kr0san89 commented Oct 24, 2024

same issue also on windows

npm error code 1
npm error path \node_modules\wasm-sjlj
npm error command failed
npm error command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp rebuild
npm error gyp info it worked if it ends with ok
npm error gyp info using [email protected]
npm error gyp info using [email protected] | win32 | x64
npm error gyp info find Python using Python version 3.13.0 found at "C:\Users\ms\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\python.exe"
npm error gyp info find VS using VS2019 (16.11.35325.158) found at:
npm error gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
npm error gyp info find VS run with --verbose for detailed information
npm error gyp info spawn C:\Users\ms\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\python.exe
npm error gyp info spawn args [
npm error gyp info spawn args 'node_modules\node-gyp\gyp\gyp_main.py',
npm error gyp info spawn args 'binding.gyp',
npm error gyp info spawn args '-f',
npm error gyp info spawn args 'msvs',
npm error gyp info spawn args '-I',
npm error gyp info spawn args 'node_modules\wasm-sjlj\build\config.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args 'node_modules\node-gyp\addon.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args 'C:\Users\ms\AppData\Local\node-gyp\Cache\22.10.0\include\node\common.gypi',
npm error gyp info spawn args '-Dlibrary=shared_library',
npm error gyp info spawn args '-Dvisibility=default',
npm error gyp info spawn args '-Dnode_root_dir=C:\Users\ms\AppData\Local\node-gyp\Cache\22.10.0',
npm error gyp info spawn args '-Dnode_gyp_dir=node_modules\node-gyp',
npm error gyp info spawn args '-Dnode_lib_file=C:\\Users\\ms\\AppData\\Local\\node-gyp\\Cache\\22.10.0\\<(target_arch)\\node.lib',
npm error gyp info spawn args '-Dmodule_root_dir=node_modules\wasm-sjlj',
npm error gyp info spawn args '-Dnode_engine=v8',
npm error gyp info spawn args '--depth=.',
npm error gyp info spawn args '--no-parallel',
npm error gyp info spawn args '--generator-output',
npm error gyp info spawn args 'node_modules\wasm-sjlj\build',
npm error gyp info spawn args '-Goutput_dir=.'
npm error gyp info spawn args ]
npm error gyp: binding.gyp not found (cwd: \node_modules\wasm-sjlj) while trying to load binding.gyp
npm error gyp ERR! configure error
npm error gyp ERR! stack Error: gyp failed with exit code: 1
npm error gyp ERR! stack at ChildProcess. (\node_modules\node-gyp\lib\configure.js:317:18)
npm error gyp ERR! stack at ChildProcess.emit (node:events:518:28)
npm error gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:293:12)
npm error gyp ERR! System Windows_NT 10.0.22631
npm error gyp ERR! command "C:\Program Files\nodejs\node.exe" "node_modules\node-gyp\bin\node-gyp.js" "rebuild"
npm error gyp ERR! cwd \node_modules\wasm-sjlj
npm error gyp ERR! node -v v22.10.0
npm error gyp ERR! node-gyp -v v10.2.0
npm error gyp ERR! not ok
npm error A complete log of this run can be found in: C:\Users\ms\AppData\Local\npm-cache_logs\2024-10-24T16_35_23_556Z-debug-0.log

@Cammisuli
Copy link
Owner

oh yea. I noticed this too when using npm. For some reason it only happens with that package manager. When using yarn or pnpm everything runs smoothly. I havent really looked into it because i'd rather use yarn or pnpm anyway.

There's definitely some issue in the underlying dependency.

@spotlesscoder
Copy link

Also happens inside devcontainer on linux:

vscode ➜ /workspace (main) $ npm i -D @monodon/rust                          
npm warn deprecated [email protected]: package has been renamed to acorn-import-attributes
npm error code 1
npm error path /workspace/node_modules/wasm-sjlj
npm error command failed
npm error command sh -c node-gyp rebuild
npm error gyp info it worked if it ends with ok
npm error gyp info using [email protected]
npm error gyp info using [email protected] | linux | x64
npm error gyp info find Python using Python version 3.9.2 found at "/usr/bin/python3"
npm error gyp info spawn /usr/bin/python3
npm error gyp info spawn args [
npm error gyp info spawn args '/usr/local/share/nvm/versions/node/v22.12.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm error gyp info spawn args 'binding.gyp',
npm error gyp info spawn args '-f',
npm error gyp info spawn args 'make',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/workspace/node_modules/wasm-sjlj/build/config.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/usr/local/share/nvm/versions/node/v22.12.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/home/vscode/.cache/node-gyp/22.12.0/include/node/common.gypi',
npm error gyp info spawn args '-Dlibrary=shared_library',
npm error gyp info spawn args '-Dvisibility=default',
npm error gyp info spawn args '-Dnode_root_dir=/home/vscode/.cache/node-gyp/22.12.0',
npm error gyp info spawn args '-Dnode_gyp_dir=/usr/local/share/nvm/versions/node/v22.12.0/lib/node_modules/npm/node_modules/node-gyp',
npm error gyp info spawn args '-Dnode_lib_file=/home/vscode/.cache/node-gyp/22.12.0/<(target_arch)/node.lib',
npm error gyp info spawn args '-Dmodule_root_dir=/workspace/node_modules/wasm-sjlj',
npm error gyp info spawn args '-Dnode_engine=v8',
npm error gyp info spawn args '--depth=.',
npm error gyp info spawn args '--no-parallel',
npm error gyp info spawn args '--generator-output',
npm error gyp info spawn args 'build',
npm error gyp info spawn args '-Goutput_dir=.'
npm error gyp info spawn args ]
npm error gyp: binding.gyp not found (cwd: /workspace/node_modules/wasm-sjlj) while trying to load binding.gyp
npm error gyp ERR! configure error 
npm error gyp ERR! stack Error: `gyp` failed with exit code: 1
npm error gyp ERR! stack at ChildProcess.<anonymous> (/usr/local/share/nvm/versions/node/v22.12.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:317:18)
npm error gyp ERR! stack at ChildProcess.emit (node:events:524:28)
npm error gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:293:12)
npm error gyp ERR! System Linux 6.8.0-49-generic
npm error gyp ERR! command "/usr/local/share/nvm/versions/node/v22.12.0/bin/node" "/usr/local/share/nvm/versions/node/v22.12.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm error gyp ERR! cwd /workspace/node_modules/wasm-sjlj
npm error gyp ERR! node -v v22.12.0
npm error gyp ERR! node-gyp -v v10.2.0
npm error gyp ERR! not ok
npm error A complete log of this run can be found in: /home/vscode/.npm/_logs/2024-12-12T06_39_08_190Z-debug-0.log
vscode ➜ /workspace (main) $ 

Node v22.12.0 (npm v10.9.0)

Container base image:

mcr.microsoft.com/devcontainers/rust:1-1-bullseye

Installed devcontainer features

"features": {
        "docker-in-docker": "latest",
        "ghcr.io/devcontainers/features/java:1": {
            "version": "17"
        },
        "ghcr.io/devcontainers/features/node:1": {
            "version": "lts"
        }
    },

package.json

{
    "devDependencies": {
        "@nx/devkit": "20.2.2",
        "@nx/js": "20.2.2",
        "@nx/next": "^20.2.2",
        "@nx/playwright": "20.2.2",
        "@nxrs/cargo": "^0.6.2",
        "@playwright/test": "^1.36.0",
        "@swc-node/register": "~1.9.1",
        "@swc/core": "~1.5.7",
        "@swc/helpers": "~0.5.11",
        "@types/react": "18.3.1",
        "@types/react-dom": "18.3.0",
        "nx": "20.2.2",
        "prettier": "^2.6.2",
        "tslib": "^2.3.0",
        "typescript": "~5.6.2"
    },
    "license": "GPL-3.0",
    "name": "test",
    "private": true,
    "scripts": {},
    "version": "1.0.0",
    "workspaces": [
        "apps/**"
    ],
    "dependencies": {
        "next": "14.2.16",
        "react": "18.3.1",
        "react-dom": "18.3.1"
    }
}

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

4 participants