【发布时间】:2021-10-05 13:23:14
【问题描述】:
我正在尝试创建一个允许您从设备中选择图像并将其加载到应用程序中的应用程序。为此,我正在使用世博会。我收到此错误,不知道现在该怎么办。 非常感谢任何类型的帮助。
这些是我安装的依赖项:react-scripts、react-dom、react-native-web、react-art、react-router-native、react-router-dom、expo、expo-image-picker、expo -permissions,react-native。
错误
节点脚本/start.js
(node:7488) [DEP_WEBPACK_SINGLE_ENTRY_PLUGIN] 弃用警告:SingleEntryPlugin 已重命名为 EntryPlugin
(使用node --trace-deprecation ... 显示警告的创建位置)
无效的选项对象。 Ignore Plugin 已使用与 API 不匹配的选项对象初始化
架构。
- 选项应该是以下之一:
对象 { 资源正则表达式,上下文正则表达式? } |对象 { checkResource }
细节:
- options 缺少属性“resourceRegExp”。应该: 正则表达式 -> 用于测试请求的正则表达式。
- options 缺少属性“checkResource”。应该:
功能
-> 资源和上下文的过滤功能。
npm 错误!代码生命周期
npm 错误!错误号 1
npm 错误!照片输入@0.1.0 开始:
node scripts/start.jsnpm 错误!退出状态 1 npm 错误! npm 错误! photo-input@0.1.0 启动脚本失败。 npm 错误!这可能不是 npm 的问题。上面可能还有额外的日志输出。
npm 错误!可以在以下位置找到此运行的完整日志: npm 错误! C:\Users\gituk\AppData\Roaming\npm-cache_logs\2021-10-05T13_17_39_903Z-debug.log
这是我的代码:
import React, { useState } from 'react';
import { Button, Image, View } from 'react-native';
import * as ImagePicker from 'expo-image-picker'
export default function App() {
const [image, setImage] = useState(null);
const pickImage = async () => {
let result = await ImagePicker.launchImageLibraryAsync({
mediaTypes: ImagePicker.MediaTypeOptions.Images,
allowsEditing:true
})
if(!result.cancelled){
setImage(result.uri)
}
}
return (
<View style={{flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Button title="Click here to pick an image" onPress={pickImage} />
{image && <Image source={{ uri:image }} style={{ width:200, height:200}}/>}
</View>
);
}
我正在关注一个教程,所以它应该可以工作,但事实并非如此。请帮忙。谢谢
【问题讨论】: