{"error": {"canonicalCode": "INVALID_ARGUMENT", google cloud

Viewed 4656

Got this error while deploying cloud functions with node version: Node.js 8 (Beta)

Build failed: {"error": {"canonicalCode": "INVALID_ARGUMENT", "errorMessage": "npm_install had stderr output:\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/typedarray-83fafd37/.travis.yml'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/readable-stream-c4f762ab/lib/_stream_transform.js'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/readable-stream-840f6280/lib/_stream_transform.js'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/readable-stream-c4f762ab/lib/_stream_writable.js'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/readable-stream-d7e024ba/lib/_stream_transform.js'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/readable-stream-840f6280/lib/_stream_writable.js'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/readable-stream-d7e024ba/lib/_stream_writable.js'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/protobufjs-e78f053b/dist/protobuf.min.js'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/jimp-a023a0b7/browser/examples/test.html'\nnpm WARN tar ENOENT: no such file or directory, lstat '/workspace/node_modules/.staging/jimp-a023a0b7/browser/lib'\nnpm WARN tar ENOENT: no such file or directory, lstat '/workspace/node_modules/.staging/jimp-a023a0b7/browser/lib'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/ajv-95df8818/dist/ajv.min.js'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/jimp-a023a0b7/browser/README.md'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/@firebase/database-9dc4a163/dist/index.d.ts'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/@firebase/database-9dc4a163/dist/index.esm.js'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/moment-45f2522a/min/moment-with-locales.min.js'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/googleapis-329f5f2f/build/src/apis/bigquery/v2.js'\nnpm ERR! code E404\nnpm ERR! 404 Not Found: har-validator@5.1.2\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR! /builder/home/.npm/_logs/2019-01-10T13_28_58_185Z-debug.log\n\nerror: npm_install returned code: 1", "errorType": "InternalError", "errorId": "C5E68EBB"}}

4 Answers

The problem is solved by removing "package-lock.json" file.

UPDATE (25/11/19)

As per @Jennings' answer, removing package-lock.json or npm-shrinkwrap.json is the quick temp fix. It seems the problem is related to Node 10: I can deploy just fine with Node 8, but when using 10 I need to remove the lock file. Of course Node 10 runtime is still in Beta, so...


This is a very stupid error with cryptographic logging.

Try any of the following:

  • Using node 8 instead of node 10 (though recently fixed internally, I have found there are still issues with node 10)
  • Check for possible corrupted or recently-installed dependencies, and remove
  • Nuking package-lock.json and node_modules and running npm install

For me, it was the first option that got things in motion again. I also re-initialised firebase, reinstall firebase-tools and tried different node versions, though I don't think these steps made any difference.

In case you are using Cloud functions, Check whether you have any errors in the JSON format which you have used in package.json file.

When deploying Cloud Functions, I found that a single dependency problem in package.json can cause these large error blocks where it seems to be throwing errors for all dependencies.

In my case, I had a dependency version for "plaid" that was too high. I had to roll back "plaid" to 4.0.0 - for some reason I thought the current version was higher and tried to use 6.0.0, which doesn't exist. This caused a long list of errors from all modules.

The errors seemed to be coming from all modules, so I thought I had a Node.js version problem (which I had also recently updated), or a problem with my node_modules path. But when I started taking out dependencies one at a time, it was just a single dependency that was causing all the errors.

"dependencies": {
    "firebase-admin": "^8.6.0",
    "firebase-functions": "^3.3.0",
    "mysql": "^2.0.0",
    "plaid":"^4.0.0"
}
Related