Firebase-tools: 无法理解部署什么目标错误

创建于 2019-01-14  ·  3评论  ·  资料来源: firebase/firebase-tools

版本信息

6.2.2

平台信息

操作系统

重现步骤

$ firebase init

为功能和托管选择配置。 然后打字稿和是 TSLint。

将下面的粘贴复制到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

预期行为

我希望该功能能够成功部署到选定的 Firebase 项目。

实际行为

我收到此错误:“无法理解要部署的目标。如果使用 --only 或 --except 标志,请检查您指定的目标是否有效。否则,请检查您的 firebase.json 以确保您的项目已针对所需功能进行初始化.”

最有用的评论

我加了

"files": [
    "node_modules/typescript/lib/lib.es6.d.ts"
],
"exclude": [
    "node_modules"
]

到我的函数中的 tsconfig 文件,这似乎可以解决问题。 让我知道是否可以。

所有3条评论

我解决了这个问题,但现在我在尝试部署时收到了这个:

../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.

这可能与TSLint有关吗?

我加了

"files": [
    "node_modules/typescript/lib/lib.es6.d.ts"
],
"exclude": [
    "node_modules"
]

到我的函数中的 tsconfig 文件,这似乎可以解决问题。 让我知道是否可以。

我不明白为什么会有问题。 很高兴你能够解决它。

此页面是否有帮助?
0 / 5 - 0 等级