6.2.2
OSX
$ firebase init
Seleccione la configuración para ambas funciones y alojamiento. Luego mecanografiado y sí a TSLint.
Copie y pegue a continuación en functions / src / index.ts:
import * as functions from 'firebase-functions';
import * as admin from 'firebase-admin';
admin.initializeApp();
// Most basic HTTP Funtion
export const basicHTTP = functions.https.onRequest((request, response) => {
const name = request.query.name;
if (!name) {
response.status(400).send('ERROR you must supply a name :(');
}
response.send(`hello ${name}`);
});
$ firebase deploy --only functions
Espero que la función se implemente con éxito en el proyecto de base de fuego seleccionado.
Recibo este error: "No puedo entender qué objetivos implementar. Verifica que hayas especificado objetivos válidos si usaste la marca --only o --except. De lo contrario, verifica tu firebase.json para asegurarte de que tu proyecto esté inicializado para las funciones deseadas . "
Lo logré, pero ahora recibo esto cuando intento implementar:
../node_modules/@types/cordova/index.d.ts(35,58): error TS2304: Cannot find name 'Event'.
../node_modules/@types/cordova/index.d.ts(36,52): error TS2304: Cannot find name 'Event'.
../node_modules/@types/cordova/index.d.ts(37,53): error TS2304: Cannot find name 'Event'.
../node_modules/@types/cordova/index.d.ts(38,57): error TS2304: Cannot find name 'Event'.
../node_modules/@types/cordova/index.d.ts(39,57): error TS2304: Cannot find name 'Event'.
../node_modules/@types/cordova/index.d.ts(40,59): error TS2304: Cannot find name 'Event'.
../node_modules/@types/cordova/index.d.ts(41,62): error TS2304: Cannot find name 'Event'.
../node_modules/@types/cordova/index.d.ts(42,60): error TS2304: Cannot find name 'Event'.
../node_modules/@types/cordova/index.d.ts(43,63): error TS2304: Cannot find name 'Event'.
../node_modules/@types/cordova/index.d.ts(44,61): error TS2304: Cannot find name 'Event'.
../node_modules/@types/cordova/index.d.ts(46,61): error TS2304: Cannot find name 'Event'.
../node_modules/@types/cordova/index.d.ts(47,55): error TS2304: Cannot find name 'Event'.
../node_modules/@types/cordova/index.d.ts(48,56): error TS2304: Cannot find name 'Event'.
../node_modules/@types/cordova/index.d.ts(49,60): error TS2304: Cannot find name 'Event'.
../node_modules/@types/cordova/index.d.ts(50,60): error TS2304: Cannot find name 'Event'.
../node_modules/@types/cordova/index.d.ts(51,62): error TS2304: Cannot find name 'Event'.
../node_modules/@types/cordova/index.d.ts(52,65): error TS2304: Cannot find name 'Event'.
../node_modules/@types/cordova/index.d.ts(53,63): error TS2304: Cannot find name 'Event'.
../node_modules/@types/cordova/index.d.ts(54,66): error TS2304: Cannot find name 'Event'.
../node_modules/@types/cordova/index.d.ts(55,64): error TS2304: Cannot find name 'Event'.
../node_modules/@types/cordova/index.d.ts(57,51): error TS2304: Cannot find name 'Event'.
../node_modules/@types/cordova/index.d.ts(58,54): error TS2304: Cannot find name 'Event'.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! functions@ build: `tsc`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the functions@ build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
¿Podría esto tener algo que ver con TSLint?
yo añadí
"files": [
"node_modules/typescript/lib/lib.es6.d.ts"
],
"exclude": [
"node_modules"
]
a mi archivo tsconfig en funciones y eso pareció funcionar. Avísame si te parece bien.
No veo por qué eso sería un problema. Me alegro de que hayas podido resolverlo.
Comentario más útil
yo añadí
a mi archivo tsconfig en funciones y eso pareció funcionar. Avísame si te parece bien.