I understand you might be following the instructions from the Getting started guide or the Use Typescript for Cloud Functions one, during this section the wizard helps you choose Typescript as your language to write Functions. Please be sure the language and its dependencies are correctly installed. And in this last guide for the Using an existing Typescript project, it asks you to edit the package.json
to add a bash script to build your typescript project:
{
"name": "functions",
"scripts": {
"build": "npm run lint && tsc"
}
...
and the firebase.json
to add a predeploy hook to run the build script:
{
"functions": {
"predeploy": "npm --prefix functions run build",
}
}
but in this case, you need to check if this configuration was made during the installation.
You can check this answer where the user used sudo npm install typescript
to install them, and as Doug mentions try to install it only in your project, not globally; and it must be defined in your package.json
as well.
Another example that fixed a similar issue where:
- The user removed everything related to Firebase Functions
- Entered in the project directory using
cd functions
(in this case replace the ‘functions’ name for your project)
- Ran
npm install
- Running again
firebase init
Let me know if you were able to solve this problem to further assist you, trying to add more information as steps and documentation followed and the logs.