I am trying to deploy Cloud Function in my project (with Ionic Framework) using cmd prompt:
firebase deploy --only functions
It's ok. But when I add @types/googlemaps into my project using cmd prompt:
npm install --save @types/googlemaps
When I predeploy my project, it has error:
i deploying functions
Running command: npm --prefix "%RESOURCE_DIR%" run lint
> functions@ lint C:\Users\PhuDuong\Desktop\Project\testFireStore\functions
> tslint --project tsconfig.json
Running command: npm --prefix "%RESOURCE_DIR%" run build
> functions@ build C:\Users\PhuDuong\Desktop\Project\testFireStore\functions
> tsc
../node_modules/@types/googlemaps/index.d.ts(43,25): error TS2304: Cannot find name 'Element'.
../node_modules/@types/googlemaps/index.d.ts(49,15): error TS2304: Cannot find name 'Element'.
../node_modules/@types/googlemaps/index.d.ts(68,24): error TS2304: Cannot find name 'Node'.
../node_modules/@types/googlemaps/index.d.ts(844,26): error TS2304: Cannot find name 'Element'.
../node_modules/@types/googlemaps/index.d.ts(856,32): error TS2304: Cannot find name 'Node'.
../node_modules/@types/googlemaps/index.d.ts(870,22): error TS2304: Cannot find name 'Node'.
../node_modules/@types/googlemaps/index.d.ts(1239,16): error TS2304: Cannot find name 'Element'.
../node_modules/@types/googlemaps/index.d.ts(1240,18): error TS2304: Cannot find name 'Element'.
../node_modules/@types/googlemaps/index.d.ts(1241,14): error TS2304: Cannot find name 'Element'.
../node_modules/@types/googlemaps/index.d.ts(1242,18): error TS2304: Cannot find name 'Element'.
../node_modules/@types/googlemaps/index.d.ts(1243,19): error TS2304: Cannot find name 'Element'.
../node_modules/@types/googlemaps/index.d.ts(1244,19): error TS2304: Cannot find name 'Element'.
../node_modules/@types/googlemaps/index.d.ts(1245,25): error TS2304: Cannot find name 'Element'.
../node_modules/@types/googlemaps/index.d.ts(1246,20): error TS2304: Cannot find name 'Element'.
../node_modules/@types/googlemaps/index.d.ts(1326,17): error TS2304: Cannot find name 'Element'.
../node_modules/@types/googlemaps/index.d.ts(1331,21): error TS2304: Cannot find name 'Element'.
../node_modules/@types/googlemaps/index.d.ts(1342,13): error TS2304: Cannot find name 'Element'.
../node_modules/@types/googlemaps/index.d.ts(1765,28): error TS2304: Cannot find name 'Node'.
../node_modules/@types/googlemaps/index.d.ts(1780,60): error TS2304: Cannot find name 'Document'.
../node_modules/@types/googlemaps/index.d.ts(1780,71): error TS2304: Cannot find name 'Element'.
../node_modules/@types/googlemaps/index.d.ts(1781,23): error TS2304: Cannot find name 'Element'.
../node_modules/@types/googlemaps/index.d.ts(1804,60): error TS2304: Cannot find name 'Document'.
../node_modules/@types/googlemaps/index.d.ts(1804,71): error TS2304: Cannot find name 'Element'.
../node_modules/@types/googlemaps/index.d.ts(1805,23): error TS2304: Cannot find name 'Element'.
../node_modules/@types/googlemaps/index.d.ts(1821,60): error TS2304: Cannot find name 'Document'.
../node_modules/@types/googlemaps/index.d.ts(1821,71): error TS2304: Cannot find name 'Element'.
../node_modules/@types/googlemaps/index.d.ts(1822,23): error TS2304: Cannot find name 'Element'.
../node_modules/@types/googlemaps/index.d.ts(2023,28): error TS2304: Cannot find name 'Element'.
../node_modules/@types/googlemaps/index.d.ts(2024,24): error TS2304: Cannot find name 'Node'.
../node_modules/@types/googlemaps/index.d.ts(2540,30): error TS2304: Cannot find name 'Element'.
../node_modules/@types/googlemaps/index.d.ts(2544,23): error TS2304: Cannot find name 'Element'.
../node_modules/@types/googlemaps/index.d.ts(2601,31): error TS2304: Cannot find name 'HTMLInputElement'.
../node_modules/@types/googlemaps/index.d.ts(2782,34): error TS2304: Cannot find name 'HTMLDivElement'.
../node_modules/@types/googlemaps/index.d.ts(2857,31): error TS2304: Cannot find name 'HTMLInputElement'.
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.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\PhuDuong\AppData\Roaming\npm-cache\_logs\2018-11-09T07_31_14_838Z-debug.log
Error: functions predeploy error: Command terminated with non-zero exit code2
debug.log:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli '--prefix',
1 verbose cli 'C:\\Users\\PhuDuong\\Desktop\\Project\\testFireStore\\functions',
1 verbose cli 'run',
1 verbose cli 'build' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle functions@~prebuild: functions@
6 info lifecycle functions@~build: functions@
7 verbose lifecycle functions@~build: unsafe-perm in lifecycle true
8 verbose lifecycle functions@~build: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\PhuDuong\Desktop\Project\testFireStore\functions\node_modules\.bin;C:\Program Files\Microsoft MPI\Bin\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\Program Files\Java\jdk1.8.0_181\bin\;C:\Users\PhuDuong\AppData\Local\Android\Sdk\platform-tools;C:\Users\PhuDuong\AppData\Local\Android\Sdk\tools;C:\Users\PhuDuong\AppData\Local\Android\Sdk\tools\bin\;C:\Gradle\gradle-4.10.2\bin\;C:\Users\PhuDuong\AppData\Local\Microsoft\WindowsApps;C:\Users\PhuDuong\AppData\Roaming\npm;C:\Users\PhuDuong\AppData\Local\atom\bin
9 verbose lifecycle functions@~build: CWD: C:\Users\PhuDuong\Desktop\Project\testFireStore\functions
10 silly lifecycle functions@~build: Args: [ '/d /s /c', 'tsc' ]
11 silly lifecycle functions@~build: Returned: code: 2 signal: null
12 info lifecycle functions@~build: Failed to exec build script
13 verbose stack Error: functions@ build: `tsc`
13 verbose stack Exit status 2
13 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at EventEmitter.emit (events.js:214:7)
13 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at ChildProcess.emit (events.js:214:7)
13 verbose stack at maybeClose (internal/child_process.js:915:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid functions@
15 verbose cwd C:\Users\PhuDuong\Desktop\Project\testFireStore
16 verbose Windows_NT 10.0.17134
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "--prefix" "C:\\Users\\PhuDuong\\Desktop\\Project\\testFireStore\\functions" "run" "build"
18 verbose node v8.12.0
19 verbose npm v6.4.1
20 error code ELIFECYCLE
21 error errno 2
22 error functions@ build: `tsc`
22 error Exit status 2
23 error Failed at the functions@ build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]
Is there a way to fix this? Thanks
I think this is a duplicate of https://github.com/firebase/firebase-tools/issues/749
Please have a look.
It's fixed. Thanks for reply @nicolasgarnier
Error: spawn npm --prefix .\functions\ run lint ENOENT
at notFoundError (C:\Users\MAULIK BHANDERI\AppData\Roaming\npmnode_modulesfirebase-toolsnode_modules\cross-envnode_modules\cross-spawn\lib\enoent.js:6:26)
at verifyENOENT (C:\Users\MAULIK BHANDERI\AppData\Roaming\npmnode_modulesfirebase-toolsnode_modules\cross-envnode_modules\cross-spawn\lib\enoent.js:40:16)
at ChildProcess.cp.emit (C:\Users\MAULIK BHANDERI\AppData\Roaming\npmnode_modulesfirebase-toolsnode_modules\cross-envnode_modules\cross-spawn\lib\enoent.js:27:25)
at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
Emitted 'error' event at:
at ChildProcess.cp.emit (C:\Users\MAULIK BHANDERI\AppData\Roaming\npmnode_modulesfirebase-toolsnode_modules\cross-envnode_modules\cross-spawn\lib\enoent.js:30:37)
at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
Error: functions predeploy error: Command terminated with non-zero exit code1
how I solve it help me
reinitialize firebase in your project
firebase init