nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.55k stars 2.35k forks source link

Error installing due to node-gyp-build in @parcel/watcher. #16319

Closed codetelo closed 1 year ago

codetelo commented 1 year ago

Current Behavior

The initial pnpm i seems to work as expected, but when either running pnpm add package_name or pnpm i again. It fails when running the install script inside of @parcel/watcher. Commenting out the install script seems to resolve the issue. So, it is definitely related to that script.

The error it's throwing shows why. It seems that instead of looking for node-gyp-build inside the node_modules folder from which it's being called, it seems it's moving up too many directories or something.

Expected Behavior

It should be able to install and add packages without running into an error.

GitHub Repo

https://github.com/codetelo/nx-starter

Steps to Reproduce

  1. Pull down the code from: https://github.com/codetelo/nx-starter.
  2. Run pnpm i.
  3. Run pnpm i again or try to add a package.
  4. This should bring up the error.

Nx Report

NX   Report complete - copy this into the issue template

   Node : 16.16.0
   OS   : darwin x64
   pnpm : 8.2.0

   nx                      : 15.9.2
   @nrwl/js                : 15.9.2
   @nrwl/jest              : 15.9.2
   @nrwl/linter            : 15.9.2
   @nrwl/workspace         : 15.9.2
   @nrwl/cli               : 15.9.2
   @nrwl/cypress           : 15.9.2
   @nrwl/detox             : 15.9.2
   @nrwl/devkit            : 15.9.2
   @nrwl/eslint-plugin-nx  : 15.9.2
   @nrwl/expo              : 15.9.2
   @nrwl/nx-plugin         : 15.9.2
   @nrwl/react             : 15.9.2
   @nrwl/tao               : 15.9.2
   @nrwl/vite              : 15.9.2
   @nrwl/webpack           : 15.9.2
   @nrwl/nx-cloud          : 15.3.5
   typescript              : 5.0.4

Failure Logs

Here is the error stack:

node_modules/@parcel/watcher: Running install script, failed in 105ms
node_modules/@parcel/watcher install$ node-gyp-build
│ node:internal/modules/cjs/loader:936
│   throw err;
│   ^
│ Error: Cannot find module '/Users/lsotelo/node-gyp-build@4.6.0/node_modules/node-gyp-build/bin.js'
│     at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
│     at Function.Module._load (node:internal/modules/cjs/loader:778:27)
│     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
│     at node:internal/main/run_main_module:17:47 {
│   code: 'MODULE_NOT_FOUND',
│   requireStack: []
│ }
└─ Failed in 105ms at /Users/lsotelo/keel/node_modules/@parcel/watcher

Additional Information

Here is the package.json in question:

{
  "name": "@parcel/watcher",
  "version": "2.0.4",
  "main": "index.js",
  "types": "index.d.ts",
  "repository": {
    "type": "git",
    "url": "https://github.com/parcel-bundler/watcher.git"
  },
  "description": "A native C++ Node module for querying and subscribing to filesystem events. Used by Parcel 2.",
  "license": "MIT",
  "publishConfig": {
    "access": "public"
  },
  "funding": {
    "type": "opencollective",
    "url": "https://opencollective.com/parcel"
  },
  "files": [
    "src",
    "prebuilds",
    "index.js",
    "index.js.flow",
    "index.d.ts",
    "package.json",
    "binding.gyp",
    "README.md"
  ],
  "scripts": {
    "prebuild": "prebuildify --napi --strip --tag-libc -t 10.0.0",
    "format": "prettier --write \"./**/*.{js,json,md}\"",
     // commenting out the line below allows it to run
    "install": "node-gyp-build",
    "rebuild": "node-gyp rebuild -j 8 --debug --verbose",
    "test": "mocha"
  },
  "engines": {
    "node": ">= 10.0.0"
  },
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
    "*.{js,json,md}": [
      "prettier --write",
      "git add"
    ]
  },
  "dependencies": {
    "node-addon-api": "^3.2.1",
    "node-gyp-build": "^4.3.0"
  },
  "devDependencies": {
    "fs-extra": "^10.0.0",
    "husky": "^7.0.2",
    "mocha": "^9.1.1",
    "prebuildify": "^4.2.1",
    "lint-staged": "^11.1.2",
    "prettier": "^2.3.2"
  },
  "binary": {
    "napi_versions": [
      3
    ]
  }
}
AgentEnder commented 1 year ago

Hey @codetelo! I believe this would be an issue that you can open up directly on parcel's repo, I've not hit it before with Nx and don't believe it would be Nx specific. Can you do that and see if they address it? Its not something we can change or influence.

https://github.com/parcel-bundler/watcher

github-actions[bot] commented 1 year ago

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.