reactjs - 从 react-s3 导入 S3FileUpload 导致 Unexpected Identifier 错误
问题描述
我是 Javascript 编程的新手,并且一直在学习 React。情况是我正在尝试将图像上传到 AWS S3 存储桶。正如标题所说,当我尝试从“react-s3”导入 S3FileUpload 时 SyntaxError:出现意外标识符
我试过用谷歌搜索这个问题,但我发现的唯一错误结果是另一种没有答案的语言:http: //qaru.site/questions/17278232/syntaxerror-unexpected-token-import-while-transpiling-reactjs-应用程序使用 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)
任何提示将非常感谢!
解决方案
我的错误,我刚刚去了该模块的 Github 存储库,看来该模块的名称已在 6 天前更改为 aws-S3。现在工作!
推荐阅读
- google-apps-script - 设置复选框的值
- ruby-on-rails - 在 Ruby on Rails 中动态填充 .yml 文件
- android-studio - kotlin.TypeCastException: null 不能转换为非 null 类型错误
- excel - 当我将名称添加到列表时,如何分配单元格的随机内部颜色?
- python - 如何获取我为多人运行的 python 脚本的路径
- java - Spring Boot 控制台应用程序:调用 init 方法失败;嵌套异常是 java.lang.NoClassDefFoundError: javax/transaction/SystemException
- neo4j - 在 neo4j 开始时执行命令
- c# - 如何在 c# 中检测表单外的组合键,例如 Shift + (0-9,AZ,az,Symbols)
- c++ - ostream_iterator 用于向量
> - vb.net - 将文本框更新为与后台工作人员不同的形式