Troubleshooting Solution for Firebase Deploy Parsing Error: Unable to Access File

Today was my first time trying to deploy functions on Firebase.

When I ran $ firebase deploy in the terminal, a Parsing error occurred as shown below.

I noticed that the path to the tsconfig.json file seemed strange.

There appears to be a duplication of the Functions directory.

However, I am unable to find a solution to this problem.

...
Running command: npm --prefix "$RESOURCE_DIR" run lint

> lint
> eslint --ext .js,.ts .

/Users/mies/FirebaseProjects/{MyProject}/functions/.eslintrc.js
  0:0  error  Parsing error: Cannot read file '/users/mies/firebaseprojects/{MyProject}/functions/functions/tsconfig.json'

/Users/mies/FirebaseProjects/{MyProject}/functions/src/index.ts
  0:0  error  Parsing error: Cannot read file '/users/mies/firebaseprojects/{MyProject}/functions/functions/tsconfig.json'

✖ 2 problems (2 errors, 0 warnings)


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

The current structure of the project is as follows.

{MyProject}
 +- functions/
      +- node_modules/
      +- src/
          +- index.ts
      +- .eslintrc.js
      +- .gitignore
      +- package-lock.json
      +- package.json
      +- {serviceAccount}.json
      +- tsconfig.dev.json
      +- tsconfig.json
 +- .firebaserc
 +- .gitignore
 +- firebase.json
 +- firebase.indexes.json
 +- firebase.rules

.eslintrc.js

module.exports = {
  root: true,
  env: {
    es6: true,
    node: true,
  },
  extends: [
    "eslint:recommended",
    "plugin:import/errors",
    "plugin:import/warnings",
    "plugin:import/typescript",
    "google",
    "plugin:@typescript-eslint/recommended",
  ],
  parser: "@typescript-eslint/parser",
  parserOptions: {
    project: ["./functions/tsconfig.json", "./functions/tsconfig.dev.json"],
    sourceType: "module",
  },
  ignorePatterns: [
    "/lib/**/*", // Ignore built files.
  ],
  plugins: [
    "@typescript-eslint",
    "import",
  ],
  rules: {
    "quotes": ["error", "double"],
    "import/no-unresolved": 0,
  },
};

How do I fix the root from /functions/functions to just /functions? Is this the correct reason for the error occurring?

Answer №1

I resolved this issue using a workaround,

The problem was with the parserOptions.project paths. I modified them to the following:

parserOptions: {
    project: path.join(__dirname, "tsconfig.eslint.json"),
    sourceType: "module",
},

For more details, you can refer to this Github Issue.

Answer №2

Ensure that your paths for parserOptions.project are correct by adjusting them as follows:

parserOptions: {
  // Remove './functions/'
  project: ["tsconfig.json", "tsconfig.dev.json"],
  sourceType: "module",
},

For additional information on parserOptions, refer to the documentation provided by ESLint.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Managing arrays in local storage with Angular 2+

I seem to be missing a crucial element in my endeavor to save and retrieve an array in local storage within my Angular 4 application. The array is fetched from the server and stored in a variable named 'aToDo' with type 'any', like so: ...

Tips for verifying the results of a specific element on a webpage using Angular

Hello all, I am currently learning Angular and facing an issue related to components. I have successfully created a component named "test". When I execute the code, I get the desired output. However, if I remove the tag from app.component.html, I end up ...

Incorporate values from an external JSON file when declaring NgModule

At the moment, I have been implementing a common approach to load data from a JSON file into my Angular 5 application. This allows me to easily inject this content into my components. The process I am following is well documented in the Runtime configurati ...

Utilizing a Custom Validator to Compare Two Values in a Dynamic FormArray in Angular 7

Within the "additionalForm" group, there is a formArray named "validations" that dynamically binds values to the validtionsField array. The validtionsField array contains three objects with two values that need to be compared: Min-length and Max-Length. F ...

Tips for adjusting the radio button value similarly to a checkbox in Angular 2 using *ngFor

my checkbox and radio button implementation: <input id="{{k.group_name}}_{{i}}" name="{{k.group_name}}" type="checkbox" class="hide" name="{{k.group_name}}" [value]="m.details" (change)="change($event, m , k.item_ingredient_group_key,false,k.maximum)"& ...

Reducer fails to capture action

Currently, I'm working on a project that already has Redux Saga implemented. All the necessary components like action creators, action types, reducer, selectors, and sagas are already set up. My task is to add a new piece of code that will update a fl ...

I'm curious about how to link a JSON field using dot notation in Angular 12 HTML

Does anyone know how to bind a JSON field using dot paths in Angular 12 HTML? For example: //Angular data: any = { name: 'x1', address: { city: 'xyz' } }; field: any = 'address.city'; //Html <input [(ngModel)]="data[ ...

Unlock hidden Google secrets within your Angular application using Google Secret Manager

Can the Google Secret Manager API be accessed with a simple API call using an API key? https://secretmanager.googleapis.com/v1/projects/*/secrets/*?key=mykey returns a 401 unauthenticated error. While the Node.js server powering the Angular app uses the c ...

The configuration object is invalid. Angular has initialized Webpack using a configuration object that does not align with the API schema

When attempting to run the angular application with "ng serve -o", I encountered an error message stating "Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema." Prior to this issue, "n ...

Issue with navigating history back in Angular 7 using an iframe

I'm currently working on a single-page application using Angular. I encountered an issue where, when the user presses the browser's back button, only the YouTube iframe content updates and not the entire page. This results in having to press the ...

How can I determine if any of the values in the array (both previous and current) are identical?

I am facing a challenge with 3 input fields that could potentially have the same values, but I need to ensure uniqueness for each field. {productFormData.Roles.map((role: string, index: number) => { return ( <div className={`form-group in ...

Using React with Typescript involves using the React.createElement method

I am facing an issue with a reference to a FunctionalComponent in my object. When I try to pass this reference into the createElement statement, it triggers a TypeScript error. Question: Why is this error occurring? Both Component and FunctionalComponent ...

Beginner in Angular: Resolving Typescript Error "All instances of 'imageLoader' must have the same type parameters"

Struggling to grasp the basics of Angular 2 has been quite a challenge for me. After learning that script tags can only be used in index.html, I decided to try and convert one of my js files to ts within the component class of app.component.ts. Any help or ...

Connecting multiple oAuth Providers in Firebase for iOS

Hey there, I'm just getting started with Firebase and iOS development. I have a question about linking multiple oAuth Providers - does anyone know how to do this? I followed the instructions in the Firebase documentation and tried using the following ...

Error in Next.js only occurs during the production build when using styled components, tailwind CSS, and twin styling

After successfully building my application in development mode, I encountered an error when attempting a production build. The error appears on the image linked below: https://i.stack.imgur.com/sNr2v.png I suspect that the issue lies within the _document ...

Incorporate Canvg version 4 into a TypeScript project

I am currently facing an issue with an older TypeScript project that has the following tsconfig setup: { "compilerOptions": { "baseUrl": "./src", "outDir": "build/dist", "module": &q ...

Converting constants into JavaScript code

I've been diving into typescript recently and came across a simple code snippet that defines a constant variable and logs it to the console. const versionNuber : number = 1.3; console.log(versionNuber); Upon running the tsc command on the file, I no ...

The subscriber continues to run repeatedly, even after we have removed its subscription

The file brief-component.ts contains the following code where the drawer service is being called: this.assignDrawerService.showDrawer(parameter); In the file drawer-service.ts: private drawerSubject = new BehaviorSubject<boolean>(false); public ...

What is the significance of including parameter names in Typescript function type signatures?

Just diving into typescript for the first time, so bear with me... I decided to create a simple filter function for a container I had created class Container<T> { filter(predicate: (T) => boolean): Container<T> { for(const elem ...

Troubleshoot: Firebase getChildrenCount() method problem on Android

At the moment, I am in the process of developing an Android application that utilizes a Firebase Database. Within my coding structure, I am attempting to retrieve the number of children at a designated path in my Firebase Database. Upon establishing the r ...