question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

functions predeploy error: Command terminated with non-zero exit code2

See original GitHub issue

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 npm@6.4.1
3 info using node@v8.12.0
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

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

13reactions
phuduong060196commented, Nov 9, 2018

It’s fixed. Thanks for reply @nicolasgarnier

10reactions
masoudbaryal-githubcommented, Sep 22, 2020

reinitialize firebase in your project firebase init

Read more comments on GitHub >

github_iconTop Results From Across the Web

Firebase deploy errors starting with non-zero exit code (space ...
Try running npm install inside the functions folder of the project. ... hosting predeploy error: Command terminated with non-zero exit code1 ...
Read more >
functions predeploy error: Command terminated with ... - GitHub
While trying to deploy the code, I get the error shown below. ... functions predeploy error: Command terminated with non-zero exit code2 # ......
Read more >
functions predeploy error: Command terminated with non-zero ...
trying to deploy firebase functions , and I am now lost , no matter what i try nothing is working for me I...
Read more >
functions predeploy error: Command terminated with non-zero ...
So I tried this: "predeploy": [ "npm --prefix \"%RESOURCE_DIR%\" run lint" ] ... “Error: functions predeploy error: Command terminated with non-zero exit ......
Read more >
Command terminated with non-zero exit code126 – Brain Fever
Firebase deploy: functions predeploy error: Command terminated with non-zero exit code126. npm ERR! code ELIFECYCLE npm ERR! errno 126 npm ERR!
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found