嘿謝謝你幫助我。 我安裝谷歌雲與故宮,就像:谷歌雲不能在Node.js上工作
npm install --save google-cloud
然後我在我的代碼實現這樣的:
var gcloud = require('google-cloud')({
projectId: "czernitzki-148120",
keyFilename: './service.json'
});
我創建了具有Owner
訪問權限和新的服務帳戶的關鍵把文件放在service.json中。 service.json
與具有上述代碼的文件位於同一目錄中。當我啓動應用程序,它吹起來,當它到達從上面
Error in ./~/google-cloud/~/protobufjs/dist/ProtoBuf.js
Module not found: [CaseSensitivePathsPlugin] `C:\Users\phili\Documents\GitHub\venos\node_modules\google-cloud\node_modules\ByteBuffer\dist\ByteBufferAB.js` does not match the corresponding path on disk `bytebuffer`.
@ ./~/google-cloud/~/protobufjs/dist/ProtoBuf.js 25:8-39
Error in ./~/google-cloud/~/bytebuffer/dist/ByteBufferAB.js
Module not found: [CaseSensitivePathsPlugin] `C:\Users\phili\Documents\GitHub\venos\node_modules\google-cloud\node_modules\Long\dist\Long.js` does not match the corresponding path on disk `long`.
@ ./~/google-cloud/~/bytebuffer/dist/ByteBufferAB.js 26:8-33
Error in ./~/google-cloud/~/JSONStream/index.js
Module parse failed: C:\Users\phili\Documents\GitHub\venos\node_modules\google-cloud\node_modules\JSONStream\index.js Unexpected character '#' (1:0)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected character '#' (1:0)
@ ./~/google-cloud/~/@google-cloud/prediction/src/model.js 25:17-38
Error in ./~/google-cloud/~/osenv/osenv.js
Module not found: 'child_process' in C:\Users\phili\Documents\GitHub\venos\node_modules\google-cloud\node_modules\osenv
@ ./~/google-cloud/~/osenv/osenv.js 3:11-35
Error in ./~/google-cloud/~/uid-number/uid-number.js
Module not found: 'child_process' in C:\Users\phili\Documents\GitHub\venos\node_modules\google-cloud\node_modules\uid-number
@ ./~/google-cloud/~/uid-number/uid-number.js 9:20-44
Error in ./~/google-cloud/~/node-pre-gyp/lib/info.js
Module not found: 'aws-sdk' in C:\Users\phili\Documents\GitHub\venos\node_modules\google-cloud\node_modules\node-pre-gyp\lib
@ ./~/google-cloud/~/node-pre-gyp/lib/info.js 14:14-32
Error in ./~/google-cloud/~/node-pre-gyp/lib/publish.js
Module not found: 'aws-sdk' in C:\Users\phili\Documents\GitHub\venos\node_modules\google-cloud\node_modules\node-pre-gyp\lib
@ ./~/google-cloud/~/node-pre-gyp/lib/publish.js 17:14-32
Error in ./~/google-cloud/~/node-pre-gyp/lib/testbinary.js
Module not found: 'child_process' in C:\Users\phili\Documents\GitHub\venos\node_modules\google-cloud\node_modules\node-pre-gyp\lib
@ ./~/google-cloud/~/node-pre-gyp/lib/testbinary.js 10:9-33
Error in ./~/google-cloud/~/node-pre-gyp/lib/unpublish.js
Module not found: 'aws-sdk' in C:\Users\phili\Documents\GitHub\venos\node_modules\google-cloud\node_modules\node-pre-gyp\lib
@ ./~/google-cloud/~/node-pre-gyp/lib/unpublish.js 15:14-32
Error in ./~/google-cloud/~/node-pre-gyp/lib/util/compile.js
Module not found: 'child_process' in C:\Users\phili\Documents\GitHub\venos\node_modules\google-cloud\node_modules\node-pre-gyp\lib\util
@ ./~/google-cloud/~/node-pre-gyp/lib/util/compile.js 9:9-33
Error in ./~/google-cloud/~/google-auth-library/lib/auth/googleauth.js
Module not found: 'child_process' in C:\Users\phili\Documents\GitHub\venos\node_modules\google-cloud\node_modules\google-auth-library\lib\auth
@ ./~/google-cloud/~/google-auth-library/lib/auth/googleauth.js 21:11-35
我使用與create-react-app
陣營的代碼。我已經在Windows和Google Compute Engine上測試過它。它在兩個方面都不起作用。
我遵循https://github.com/GoogleCloudPlatform/google-cloud-node和https://googlecloudplatform.github.io/google-cloud-node/#/docs/storage/0.3.0/storage的指導。
我該如何解決這個問題?
我仍然得到這個錯誤 錯誤./~/google-cloud/~/JSONStream/index.js 模塊解析失敗:C:\用戶\ phili \文檔\ GitHub的\ venos \ node_modules \谷歌雲\ node_modules \ JSONStream \ index.js意外字符'#'(1:0) 您可能需要一個合適的加載器來處理此文件類型。 SyntaxError:意外字符'#'(1:0) @ ./~/google-cloud/~/@google-cloud/prediction/src/model.js 25:17-38 之後模塊錯誤跟隨儘管我手動安裝了child_process – speedDeveloper
請檢查我關於CaseSensitivePathsPlugin的更新答案 – Ayan
我不認爲這可能是解決方案,因爲create-react-app不允許在此處提到的webpack配置https://github.com/facebookincubator/ create-react-app/issues/99也是我安裝它們後仍然收到模塊錯誤。 – speedDeveloper