我是Java语言编程的新手,并且一直在学习React。这种情况是我正在尝试将图像上传到AWS S3存储桶。如标题所示,当我尝试从'react-s3'导入S3FileUpload时出现SyntaxError:出现意外的标识符
我已经尝试过搜索该问题,但是发现相同错误的唯一结果是另一种语言无法回答:http://qaru.site/questions/17278232/syntaxerror-unexpected-token-import-while-transpiling-reactjs-app-using-babel
import S3FileUpload from 'react-s3';
这是显示的来自终端的日志:
(function (exports, require, module, __filename, __dirname) { import Signature from "./Signature";
^^^^^^^^^
SyntaxError: Unexpected identifier
at new Script (vm.js:83:7)
at createScript (vm.js:267:10)
at Object.runInThisContext (vm.js:319:10)
at Module._compile (internal/modules/cjs/loader.js:684:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)
at Module.require (internal/modules/cjs/loader.js:657:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (C:\Users\Me\Documents\GitHub\myrepo\node_modules\react-s3\index.js:1:80)
at Module._compile (internal/modules/cjs/loader.js:721:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)
任何提示将不胜感激!
答案 0 :(得分:0)
我的错误,我只是去了该模块的Github存储库,看来该模块的名称已在6天前更改为aws-S3。现在工作!