As part of the implementation of a Cloud Function under Google Cloud Platform, executed with Nodejs 8, I have to store information in GCP Datastore.
I use TypeScript which is compiled in Javascript.
I have the following error when I try to import the "@google-cloud/datastore"
module:
Provided module can't be loaded.
Is there a syntax error in your code?
Detailed stack trace: TypeError: extend must be a string
I tried 2 ways to import the module and each time I get the same error:
import {Datastore} from '@google-cloud/datastore';
const datastore = new Datastore();
or
const datastore = require('@google-cloud/datastore');
I also tried to install different versions of the module, nothing helps.
Finally, I realized that even when the module is not installed (I executed the command npm uninstall @google-cloud/datastore
), I get the exact same error when logically, when we try to import a module which is not installed, we should have the following error:
Provided module can't be loaded.
Did you list all required modules in the package.json dependencies?
Detailed stack trace: Error: Cannot find module 'test'
Has anyone ever encountered this problem or would have a clue why I get this error?
"@google-cloud/datastore": "^5.0.3"
– Goutweed