'cannot find module "firebase-functions"
I imported and downloaded: firebase-functions
and firebase-admin
using npm i <package>
but it give me a lint error like: cannot find module "firebase-functions"
. I also restarted vscode, but problem persists..
Could it be problem with webpack or tsconfig?
Some important packages in package.json
:
{
"dependencies": {
"@angular/animations": "^5.2.3",
"@angular/cdk": "^5.1.1",
"@angular/common": "^5.2.2",
"@angular/compiler": "^5.2.2",
"@angular/core": "^5.2.2",
"@angular/forms": "^5.2.2",
"@angular/http": "^5.2.2",
"@angular/material": "^5.0.2",
"@angular/material-moment-adapter": "^5.2.3",
"@angular/platform-browser": "^5.2.2",
"@angular/platform-browser-dynamic": "^5.2.2",
"@angular/platform-server": "^5.2.3",
"@angular/router": "~5.2.2",
"core-js": "^2.5.3",
"express": "^4.16.2",
"firebase": "^4.9.1",
"firebase-admin": "~5.8.1",
"firebase-functions": "^0.8.1",
"zone.js": "0.8.18"
},
"private": true,
"devDependencies": {
"@angular/cli": "^1.6.7",
"@angular/compiler-cli": "^5.2.2",
"@angular/language-service": "^4.2.4",
"@types/jasmine": "~2.5.53",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"angular-universal-express-firebase": "0.0.4",
"babel-preset-es2015": "^6.24.1",
"codelyzer": "~3.1.1",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"npm-run-all": "^4.1.2",
"protractor": "~5.1.2",
"ts-loader": "^3.4.0",
"ts-node": "~3.2.0",
"tslint": "~5.3.2",
"typescript": "^2.4.2",
"webpack": "^3.8.1",
"webpack-node-externals": "^1.6.0"
}
}
Solution 1:[1]
npm install firebase-functions
npm install firebase-admin
Solution 2:[2]
You can try the following commands:
firebase use --add
firebase init functions
To get your project. Sometimes, its a permission problem. What you can try is creating a new account on your computer and doing the same commands, that almost always works.
Solution 3:[3]
I handled this problem with these steps. I don't really know whether exact solution is delete and initialize firebase functions again. Also I thought that problem is not specific only firebase-functions or firebase-admin. It can be missing node_modules packages.
- delete node_modules in functions
firebase init functions
. Update tsconfig and package.json and install dependencies.- restart vscode
Solution 4:[4]
@Shaybakov answer was the solution to my problem.
I recently switched the location of my project on my local machine. This meant that firebase libraries were not imported into the local directory and I either had to reconfigure the entire firebase CLl or just manually update the firebase libraries in the local directory with the commands that @Shaybakov stated.
npm install firebase-functions
npm install firebase-admin
Solution 5:[5]
step 1. npm install firebase-admin
step 2. npm install firebase-functions
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | scopchanov |
Solution 2 | Argiator Morimoto |
Solution 3 | ?brahim Dolapci |
Solution 4 | Garrett |
Solution 5 | kirti singh |