rxdi / firelink

Firebase. gcloud and monorepos are not combining very well until they met @rxdi/firelink
MIT License
68 stars 9 forks source link

Non-Regular File Errors #42

Open johntimothybailey opened 2 years ago

johntimothybailey commented 2 years ago

Error

When running $ firelink (doesn't matter what arguments I give) I receive

skipping non-regular file "performance/node_modules/.bin/eslint"
skipping non-regular file "performance/node_modules/.bin/ts-node"
skipping non-regular file "performance/node_modules/.bin/ts-node-cwd"
skipping non-regular file "performance/node_modules/.bin/ts-node-script"
skipping non-regular file "performance/node_modules/.bin/ts-node-transpile-only"
skipping non-regular file "performance/node_modules/.bin/ts-script"
skipping non-regular file "performance/node_modules/.bin/tsc"
skipping non-regular file "performance/node_modules/.bin/tsserver"
skipping non-regular file "performance/node_modules/eslint/node_modules/.bin/js-yaml"
skipping non-regular file "performance/node_modules/eslint/node_modules/.bin/semver"
npm ERR! could not determine executable to run

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/johnbailey/.npm/_logs/2022-01-04T20_44_21_921Z-debug.log

Context

Using @rxdi/firelink@^0.7.75 with firebase@9.23.1 (firebase-tools) within a monorepo (lerna + yarn)

Due to client privacy I've called the project @example but that is the only thing replaced from my package.json

{
  "name": "@example/cloud-functions",
  "version": "1.0.0",
  "scripts": {
    "dev": "yarn build --watch",
    "lint": "eslint --ext .js,.ts .",
    "build": "rm -rf lib && tsc --resolveJsonModule",
    "shell": "yarn build && firebase functions:shell",
    "start": "yarn shell",
    "deploy": "firelink deploy --only functions",
    "logs": "firebase functions:log"
  },
  "engines": {
    "node": "16",
    "yarn": ">=1.18.0"
  },
  "main": "lib/index.js",
  "dependencies": {
    "@example/performance": "^1.0.0",
    "@google-cloud/functions-framework": "^1.6.0",
    "@hubspot/api-client": "^3.4.1",
    "ajv": "^8.8.2",
    "ajv-formats": "^2.1.1",
    "analytics-node": "^5.0.0",
    "axios": "^0.24.0",
    "cookie-parser": "^1.4.5",
    "cors": "^2.8.5",
    "express": "^4.17.1",
    "firebase": "^9.6.1",
    "firebase-admin": "^10.0.1",
    "firebase-functions": "^3.16.0",
    "hubspot": "^2.3.14",
    "lodash": "^4.17.21",
    "node-petname": "^1.0.1",
    "short-uuid": "^4.2.0"
  },
  "devDependencies": {
    "@rxdi/firelink": "^0.7.75",
    "@types/analytics-node": "^3.1.5",
    "@types/cookie-parser": "^1.4.2",
    "@types/request": "^2.48.7",
    "@types/request-promise": "^4.1.48",
    "@typescript-eslint/eslint-plugin": "^5.8.0",
    "@typescript-eslint/parser": "^5.8.0",
    "eslint": "^7.32.0",
    "eslint-config-standard": "^16.0.3",
    "eslint-config-standard-with-typescript": "^21.0.1",
    "eslint-plugin-import": "^2.25.3",
    "eslint-plugin-node": "^11.1.0",
    "eslint-plugin-promise": "^5.2.0",
    "firebase-functions-test": "^0.2.0",
    "typescript": "^4.5.4"
  },
  "fireDependencies": {
    "@example/performance": "../../performance"
  },
  "private": true,
  "fireConfig": {
    "runner": "firebase",
    "outFolderName": ".packages",
    "outFolderLocation": ".",
    "excludes": ["node_modules"]
  }
}

Thoughts

I am investigating a fix in rsync https://github.com/rxdi/firelink/blob/46e59462971010a9e6bf02d8ea33a4705a35fc8d/src/helpers/copy-packages.ts#L15

Stradivario commented 2 years ago

Hello there and thank you for the ticket created! Sorry for the late reply but for some reason i didn't got notification on my email regarding this ticket.

This error means that firebase CLI command is not recognized by npx which is quite strange since we have this code here:

https://github.com/rxdi/firelink/blob/master/src/helpers/worker.ts#L7

Which prefixes every command passed by Worker to be executed using npx.

I haven't try this library with node 16 and the new npm version 8

Will take a look today and will write down.

At the moment can u provide more details about what OS are you running ? ( mac, win, linux ) ?

Also if you execute npx firebase in the terminal is it working as expected ?

reedom commented 2 years ago

@Stradivario I came across the same issue.

Also if you execute npx firebase in the terminal is it working as expected ?

To make it works, it needs to invoke as npx -p firebase-tools firebase

Stradivario commented 2 years ago

@Stradivario I came across the same issue.

Also if you execute npx firebase in the terminal is it working as expected ?

To make it works, it needs to invoke as npx -p firebase-tools firebase

By default firebase command is used when executing command firelink

You can change that behavior by specify runner property fireConfig: { runner: 'dir' } https://github.com/rxdi/firelink#configuration

There is a way from the recent versions to remove that behavior with argument --no-runner explained here https://github.com/rxdi/firelink#no-runner

The package actually doesn't depend on firebase-tools so it will be framework agnostic and it can be used also with serverless, gcloud or other platform which deploys the same way.

I wasn't able to reproduce these errors on my side with linux and nodejs 16

Need to think of it that maybe to not have default runner will be a better option for everybody.

That way everyone will know and install all of the tools needed to spin up the command he wishes.

The actual purpose of firelink is to map your local packages and install them from there and then revert back to specific version and not local path. So actually it is written to be framework agnostic.

Cheers!