0

The error

code: 'ENOENT',
  errno: 'ENOENT',
  syscall: 'spawn npm --prefix "D:\\Project\\Web\\functions" run lint',
  path: 'npm --prefix "D:\\Project\\Web\\functions" run lint',
  spawnargs: []
}

Error: functions predeploy error: Command terminated with non-zero exit code1

firebase.json

{
  "firestore": {
    "rules": "firestore.rules",
    "indexes": "firestore.indexes.json"
  },
  "functions": {
    "predeploy": [
      "npm --prefix \"%RESOURCE_DIR%\" run lint"
    ]
  }
}

I got the above error when I trying run the firebase deploy command, I searched the whole internet and I find related issues but not helpful so what is the problem?

I'm using Windows 10

Edit

enter image description here

Taha Sami
  • 1,565
  • 1
  • 16
  • 43
  • Is there any information about the error before `code: 'ENOENT',` part ? – Berci Dec 06 '21 at 10:27
  • 1
    @Berci Check Now – Taha Sami Dec 06 '21 at 10:56
  • @ofTHIS Usually the ENOENT error occurs when the compiler cannot find a file or directory. Can you check if the firestore.rules and firestore.indexes.json are accessible by the script? – davidbilla Dec 06 '21 at 11:54
  • @davidbilla Unfortunately, I'm an android developer, Not a web developer but I have a little bit of experience in the web so could you clarify what should I do? – Taha Sami Dec 06 '21 at 12:00
  • The error seems to suggest that npm was not found (see https://github.com/moxystudio/node-cross-spawn/blob/master/lib/enoent.js). Have you made sure that npm is on your PATH? try running `npm --version` from a command line – jfhr Dec 06 '21 at 12:24
  • @jfhr I got this 7.20.3 – Taha Sami Dec 06 '21 at 12:34
  • 1
    I think you could try deleting the node modules and reinstall them (with npm install). Additionally try to check that you are using the same node version as the project. – Berci Dec 06 '21 at 12:51
  • 2
    What is the node version you are using? There are some deprecated versions also, according to [official documentation](https://firebase.google.com/docs/functions/manage-functions#set_nodejs_version), Unsupported versions also may cause the issue. Have you tried removing the predeploy from firebase.json? According to Michael Bleigh comment in [link](https://stackoverflow.com/questions/49181706/cant-deploy-firebase-functions#:~:text=Try%20removing%20the,Michael%20Bleigh) may solve your issue. – Badala Prashanth Dec 06 '21 at 13:34
  • 1
    I removed predeploy from firebase.json and worked with me. Thanks Guys for your time – Taha Sami Dec 06 '21 at 13:44

1 Answers1

0

Removing predeploy from firebase.json will solve the issue. Remove “npm --prefix "%RESOURCE_DIR%" run lint” as shown below.

firebase.json

"predeploy": [

"npm --prefix "%RESOURCE_DIR%" run lint"

]

In some cases, the issue could be due to unsupported node versions. As per official documentation Node.js 8 is deprecated. Make sure you are using supported versions.