0
votes

I am creating a panel in Adobe Premiere Pro which used Google Cloud speech. I am accessing google-cloud/speech on the Javascript side, not JSX side via NodeJS. I am also accessing google-cloud/storage. No big deal, I installed NodeJS on a Mac and functions accessing google-cloud/storage were easy to code.

After following the instructions to npm --save @google-cloud/speech and npm --save @google-cloud/storage, it created the node_modules directory. I have moved them to a custom directory but they are duplicated in the standard location also.

In my code, I reference them as per the google-cloud examples:

// note cep.node is required in the Adobe CEP environment to access nodejs
    const speech = cep_node.require(extention_path+'/lib/node_modules/@google-cloud/speech');
const project_id ='project_id_xxx1234';
const keyFilePath = extention_path +'/path/to/key.json';

const client = new speech.v1.SpeechClient({
      projectId: project_id,
      keyFilename: keyFilePath,
});

I've tried this w/o the ids and speech.SpeechClient() etc as per examples. The methodology is working fine with google-cloud/storage, so I know the similar downloaded node modules at the same location work fine for that.

However, it fails on trying to make a new speech.SpeechClient() with the browser debug error below.

Uncaught Error: Failed to load gRPC binary module because it was not installed for the current system Expected directory: node-v51-darwin-x64-unknown Found: [.DS_Store, node-v64-darwin-x64-unknown] This problem can often be fixed by running "npm rebuild" on the current system Original error: Cannot find module '/Library/Application Support/Adobe/CEP/extensions/com.iv.PProPanel/lib/node_modules/grpc/src/node/extension_binary/node-v51-darwin-x64-unknown/grpc_node.node' at Object. (/Library/Application Support/Adobe/CEP/extensions/com.iv.PProPanel/lib/node_modules/grpc/src/grpc_extension.js:53:17) at Module._compile (module.js:595:32) at Object.Module._extensions..js (module.js:610:10) at Module.load (module.js:512:32) at tryModuleLoad (module.js:471:12) at Function.Module._load (module.js:463:3) at Module.require (module.js:522:17) at require (internal/module.js:20:19) at Object. (/Library/Application Support/Adobe/CEP/extensions/com.iv.PProPanel/lib/node_modules/grpc/src/client_interceptors.js:145:12) at Module._compile (module.js:595:32)

My belief is that these series of node_modules that are accessed by @google-cloud/speech were compiled use NODE_MODULE_64 and need 51 (instead).

$ npm rebuild rebuilds (or checks current version of the modules) fine with the exception

[email protected] postinstall /Library/Application Support/Adobe/CEP/extensions/com.iv.PProPanel/lib/node_modules/protobufjs node scripts/postinstall [email protected] install /Library/Application Support/Adobe/CEP/extensions/com.iv.PProPanel/lib/node_modules/grpc node-pre-gyp install --fallback-to-build --library=static_library node-pre-gyp WARN Using request for node-pre-gyp https download [grpc] Success: "/Library/Application Support/Adobe/CEP/extensions/com.iv.PProPanel/lib/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown/grpc_node.node" already installed Pass --update-binary to reinstall or --build-from-source to recompile

So some module needs v51 instead of the build v64. The question is can the @google-cloud/speech modules be built using v51 and how? or do I wait for google-cloud to come up with a solution? BTW: I also renamed the node-v64 dir to node-51, but received another error referencing the MODULE 51. Any direction would be appreciated.

1

1 Answers

0
votes

Some of the dependencies for @google-cloud/speech are native addons. Those being C/C++ code, they need to be compiled for the correct Node version. Looks like your Node version that you used for npm install doesn't match the one in Adobe CEP. Switch to Node 5.1 and run npm install or npm rebuild again.

I recommend using nvm to change Node versions, see Node Version Manager.