Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

286
Visualizações
Angular2 + firebase-admin sdk

When i try to use firebase-admin SDK in my angular2 project i get this error

ERROR in ./~/firebase-admin/lib/auth/token-generator.js
Module not found: Error: Can't resolve 'jsonwebtoken' in '/home/koucky/git_projects/zlepsito-web/node_modules/firebase-admin/lib/auth'
 @ ./~/firebase-admin/lib/auth/token-generator.js 7:10-33
 @ ./~/firebase-admin/lib/auth/auth.js
 @ ./~/firebase-admin/lib/auth/register-auth.js
 @ ./~/firebase-admin/lib/index.js
 @ ./src/app/app.module.ts
 @ ./src/main.ts
 @ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts

I installed firebase-admin via npm and in my app.module.ts i tryed to use it like this import 'firebase-admin' or var admin = require("firebase-admin"); both ways produce that error.

I have followed: https://firebase.google.com/docs/admin/setup

app.module.ts

var admin = require("firebase-admin");

var serviceAccount = require('./serviceAccountKey.json');

admin.initializeApp({
  credential: admin.credential.cert(serviceAccount),
  databaseURL: "https://myapp-99f41.firebaseio.com"
}); 

Does anyone know what to do, or is able to provide a snippet how to use firebase-admin SDK with angular2 project?

Thanks in advance

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I have a similar problem. Got one step further, but still not all the way.

Did a

npm install jsonwebtoken --save

which made the jsonwebtoken error disapear. Next error: missing 'dns', which was solved with:

npm install dns --save

Now i get an error saying 'Invalid left-hand side in assignment'.

I have used this method to call initializeApp instead of the key.json.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda