TypeScript云函数从父目录或同级目录导入模块

TypeScript云函数从父目录或同级目录导入模块,typescript,google-cloud-functions,Typescript,Google Cloud Functions,我希望能够将函数目录与我的域目录分开。到目前为止,我无法在这些情况下部署到云功能 project |- functions | |- src | |- index.ts |- domain |- index.ts 我查看了提供的日志,但不明白问题所在,也不知道如何解决 i deploying functions Running command: npm --prefix "$RESOURCE_DIR" run lint > functions@ li

我希望能够将
函数
目录与我的
目录分开。到目前为止,我无法在这些情况下部署到云功能

project
 |- functions
 |   |- src 
 |      |- index.ts
 |- domain
     |- index.ts
我查看了提供的日志,但不明白问题所在,也不知道如何解决

i  deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint

> functions@ lint <PROJECT_DIR>/functions
> tslint --project tsconfig.json


ERROR: <PROJECT_DIR>domain/file.ts:1:84 - expected nospace before colon in call-signature
ERROR: <PROJECT_DIR>domain/file.ts:26:7 - Missing semicolon
ERROR: <PROJECT_DIR>domain/file.ts:35:2 - file should end with a newline
ERROR: <PROJECT_DIR>domain/file.ts:35:2 - Missing semicolon

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! functions@ lint: `tslint --project tsconfig.json`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the functions@ lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     ~/.npm/_logs/2019-11-14T16_50_55_316Z-debug.log

Error: functions predeploy error: Command terminated with non-zero exit code2
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! functions@ deploy: `firebase deploy --only functions`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the functions@ deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     ~/.npm/_logs/2019-11-14T16_50_55_801Z-debug.log
i部署函数
正在运行的命令:npm--前缀“$RESOURCE\u DIR”run lint
>函数@lint/functions
>tslint—项目tsconfig.json
错误:domain/file.ts:1:84-调用签名中应为冒号前的nospace
错误:domain/file.ts:26:7-缺少分号
错误:domain/file.ts:35:2-文件应以换行符结尾
错误:domain/file.ts:35:2-缺少分号
npm错误!代码失效循环
npm错误!二号
npm错误!函数@lint:`tslint--project tsconfig.json`
npm错误!退出状态2
npm错误!
npm错误!在函数@lint脚本中失败。
npm错误!这可能不是npm的问题。上面可能还有其他日志输出。
npm错误!此运行的完整日志可在以下位置找到:
npm ERR!~/。npm/_日志/2019-11-14T16_50_55_316Z-debug.log
错误:函数预部署错误:命令以非零退出代码2终止
npm错误!代码失效循环
npm错误!错误1
npm错误!functions@deploy:`firebase deploy--仅限函数`
npm错误!退出状态1
npm错误!
npm错误!在函数@deploy脚本中失败。
npm错误!这可能不是npm的问题。上面可能还有其他日志输出。
npm错误!此运行的完整日志可在以下位置找到:
npm ERR!~/。npm/_日志/2019-11-14T16_50_55_801Z-debug.log
日志1:

0信息如果它以ok结尾,它就工作了
1 verbose cli['/usr/local/ceral/node/11.14.0/bin/node',
1个详细cli'/usr/local/bin/npm',
1详细cli'--前缀',
1详细cli'/functions',
1详细cli“运行”,
1详细cli“lint”]
2信息使用npm@6.13.0
3信息使用node@v11.14.0
4详细的运行脚本['prelint','lint','postlint']
5信息生命周期功能@~prelint:功能@
6信息生命周期功能@~lint:功能@
7详细生命周期函数@~lint:生命周期中的不安全perm为true
8个详细的生命周期函数@~lint:PATH:/usr/local/lib/node_modules/npm/node_modules/npm lifecycle/node gyp bin:/functions/node_modules/.bin:/usr/local/lib/node_modules/npm lifecycle/node gyp bin:/functions/node_modules/.bin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/sbin
9个详细的生命周期函数@~lint:CWD:/functions
10个愚蠢的生命周期函数@~lint:Args:['-c','tslint--project tsconfig.json']
11个生命周期函数@~lint:返回:代码:2信号:null
12信息生命周期函数@~lint:无法执行lint脚本
13详细堆栈错误:functions@lint:`tslint--project tsconfig.json`
13详细堆栈退出状态2
13 EventEmitter上的详细堆栈。(/usr/local/lib/node_modules/npm/node_modules/npm lifecycle/index.js:332:16)
13 EventEmitter.emit上的详细堆栈(events.js:193:13)
13子进程上的详细堆栈。(/usr/local/lib/node_modules/npm/node_modules/npm lifecycle/lib/spawn.js:55:14)
13 ChildProcess.emit上的详细堆栈(events.js:193:13)
13 maybeClose的详细堆栈(internal/child_process.js:999:16)
13 Process.ChildProcess.\u handle.onexit处的详细堆栈(internal/child\u Process.js:266:5)
14个详细的pkgid函数@
15详细cwd
16详细达尔文19.0.0
17详细argv“/usr/local/ceral/node/11.14.0/bin/node”“/usr/local/bin/npm”“--前缀”“/函数”“运行”“lint”
18详细节点v11.14.0
19详细的npm v6.13.0
20错误代码ELIFECYCLE
21错误2
22错误函数@lint:`tslint--project tsconfig.json`
22错误退出状态2
23函数@lint脚本出现错误。
23错误这可能不是npm的问题。上面可能还有其他日志输出。
24详细退出[2,正确]
日志2:

0信息如果它以ok结尾,它就工作了
1 verbose cli['/usr/local/ceral/node/11.14.0/bin/node',
1个详细cli'/usr/local/bin/npm',
1详细cli“运行”,
1详细cli“部署”]
2信息使用npm@6.13.0
3信息使用node@v11.14.0
4详细的运行脚本['predeploy','deploy','postdeploy']
5信息生命周期功能@~部署前:功能@
6信息生命周期功能@~部署:功能@
7详细生命周期功能@~deploy:生命周期中的不安全perm为true
8个详细生命周期功能@~deploy:PATH:/usr/local/lib/node_modules/npm/node_modules/npm lifecycle/node gyp bin:/functions/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
9个详细的生命周期函数@~deploy:CWD:/functions
10个愚蠢的生命周期函数@~deploy:Args:['-c',firebase部署--仅函数']
11个生命周期函数@~deploy:返回:代码:1信号:null
12信息生命周期功能@~deploy:无法执行部署脚本
13详细堆栈错误:functions@deploy:`firebase deploy--仅限函数`
13详细堆栈退出状态1
13 EventEmitter上的详细堆栈。(/usr/local/lib/node_modules/npm/node_modules/npm lifecycle/index.js:332:16)
13 EventEmitter.emit上的详细堆栈(events.js:193:13)
13子进程上的详细堆栈。(/usr/local/lib/node_modules/npm/node_modules/npm lifecycle/lib/spawn.js:55:14)
13 ChildProcess.emit上的详细堆栈(events.js:193:13)
13 maybeClose的详细堆栈(internal/child_process.js:999:16)
13 Process.ChildProcess.\u handle.onexit处的详细堆栈(internal/child\u Process.js:266:5)
14个详细的pkgid函数@
15个详细的cwd/功能
16详细达尔文19.0.0
17详细argv“/usr/local/ceral/node/11.14.0/bin/node”“/usr/local/bin/npm”“运行”“部署”
18详细节点v11.14.0
19详细的npm v6.13.0
20错误代码ELIFECYCLE
21错误1
22错误函数@deploy:`firebase deploy--仅函数`
22错误退出状态1
23函数@deploy脚本出现错误。
23错误这可能不是npm的问题。上面可能还有其他日志输出。
24详细退出[1,true]
我现在只是从TypeScript和
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/11.14.0/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   '--prefix',
1 verbose cli   '<PROJECT_DIR>/functions',
1 verbose cli   'run',
1 verbose cli   'lint' ]
2 info using npm@6.13.0
3 info using node@v11.14.0
4 verbose run-script [ 'prelint', 'lint', 'postlint' ]
5 info lifecycle functions@~prelint: functions@
6 info lifecycle functions@~lint: functions@
7 verbose lifecycle functions@~lint: unsafe-perm in lifecycle true
8 verbose lifecycle functions@~lint: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:<PROJECT_DIR>/functions/node_modules/.bin:/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:<PROJECT_DIR>/functions/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
9 verbose lifecycle functions@~lint: CWD: <PROJECT_DIR>/functions
10 silly lifecycle functions@~lint: Args: [ '-c', 'tslint --project tsconfig.json' ]
11 silly lifecycle functions@~lint: Returned: code: 2  signal: null
12 info lifecycle functions@~lint: Failed to exec lint script
13 verbose stack Error: functions@ lint: `tslint --project tsconfig.json`
13 verbose stack Exit status 2
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:193:13)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:193:13)
13 verbose stack     at maybeClose (internal/child_process.js:999:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:266:5)
14 verbose pkgid functions@
15 verbose cwd <PROJECT_DIR>
16 verbose Darwin 19.0.0
17 verbose argv "/usr/local/Cellar/node/11.14.0/bin/node" "/usr/local/bin/npm" "--prefix" "<PROJECT_DIR>/functions" "run" "lint"
18 verbose node v11.14.0
19 verbose npm  v6.13.0
20 error code ELIFECYCLE
21 error errno 2
22 error functions@ lint: `tslint --project tsconfig.json`
22 error Exit status 2
23 error Failed at the functions@ lint script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/11.14.0/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'run',
1 verbose cli   'deploy' ]
2 info using npm@6.13.0
3 info using node@v11.14.0
4 verbose run-script [ 'predeploy', 'deploy', 'postdeploy' ]
5 info lifecycle functions@~predeploy: functions@
6 info lifecycle functions@~deploy: functions@
7 verbose lifecycle functions@~deploy: unsafe-perm in lifecycle true
8 verbose lifecycle functions@~deploy: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:<PROJECT_DIR>/functions/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
9 verbose lifecycle functions@~deploy: CWD: <PROJECT_DIR>/functions
10 silly lifecycle functions@~deploy: Args: [ '-c', 'firebase deploy --only functions' ]
11 silly lifecycle functions@~deploy: Returned: code: 1  signal: null
12 info lifecycle functions@~deploy: Failed to exec deploy script
13 verbose stack Error: functions@ deploy: `firebase deploy --only functions`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:193:13)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:193:13)
13 verbose stack     at maybeClose (internal/child_process.js:999:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:266:5)
14 verbose pkgid functions@
15 verbose cwd <PROJECT_DIR>/functions
16 verbose Darwin 19.0.0
17 verbose argv "/usr/local/Cellar/node/11.14.0/bin/node" "/usr/local/bin/npm" "run" "deploy"
18 verbose node v11.14.0
19 verbose npm  v6.13.0
20 error code ELIFECYCLE
21 error errno 1
22 error functions@ deploy: `firebase deploy --only functions`
22 error Exit status 1
23 error Failed at the functions@ deploy script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
"main": "./functions/src/index.ts"
exports.helloWorld = () => {
  return "Hello World"
};
const domain = require('../../domain/index.ts');