Javascript ./node_modules/axios/lib/helpers/cookies.js错误:EPERM:不允许操作,读取
我试图简单地使用一个api,但它给了我这个错误。我已经尝试了所有可能的解决方案,但还是一无所获 我以管理员的身份运行这个,它是Windows10 防火墙防病毒软件已关闭 厌倦了卸载和安装npm 尝试了npm缓存清理--也尝试了强制命令 如果节点\模块属性为只读,则取消选择Javascript ./node_modules/axios/lib/helpers/cookies.js错误:EPERM:不允许操作,读取,javascript,node.js,reactjs,npm,axios,Javascript,Node.js,Reactjs,Npm,Axios,我试图简单地使用一个api,但它给了我这个错误。我已经尝试了所有可能的解决方案,但还是一无所获 我以管理员的身份运行这个,它是Windows10 防火墙防病毒软件已关闭 厌倦了卸载和安装npm 尝试了npm缓存清理--也尝试了强制命令 如果节点\模块属性为只读,则取消选择 import React, { Component } from "react"; import Clarifai from "clarifai"; import ImageSearch
import React, { Component } from "react";
import Clarifai from "clarifai";
import ImageSearchForm from "./components/ImageSearchForm/ImageSearchForm";
import FaceDetect from "./components/FaceDetect/FaceDetect";
import "./App.css";
// You need to add your own API key here from Clarifai.
const app = new Clarifai.App({
apiKey: "My api xxx",
});
class App extends Component {
constructor() {
super();
this.state = {
input: "",
imageUrl: "",
box: {},
};
}
calculateFaceLocation = (data) => {
const clarifaiFace =
data.outputs[0].data.regions[0].region_info.bounding_box;
const image = document.getElementById("inputimage");
const width = Number(image.width);
const height = Number(image.height);
return {
leftCol: clarifaiFace.left_col * width,
topRow: clarifaiFace.top_row * height,
rightCol: width - clarifaiFace.right_col * width,
bottomRow: height - clarifaiFace.bottom_row * height,
};
};
displayFaceBox = (box) => {
this.setState({ box: box });
};
onInputChange = (event) => {
this.setState({ input: event.target.value });
};
onSubmit = () => {
this.setState({ imageUrl: this.state.input });
app.models
.predict(Clarifai.FACE_DETECT_MODEL, this.state.input)
.then((response) =>
this.displayFaceBox(this.calculateFaceLocation(response))
)
.catch((err) => console.log(err));
};
render() {
return (
<div className="App">
<ImageSearchForm
onInputChange={this.onInputChange}
onSubmit={this.onSubmit}
/>
<FaceDetect box={this.state.box} imageUrl={this.state.imageUrl} />
</div>
);
}
}
export default App;
import React,{Component}来自“React”;
从“Clarifai”导入Clarifai;
从“/components/ImageSearchForm/ImageSearchForm”导入ImageSearchForm;
从“/components/FaceDetect/FaceDetect”导入FaceDetect;
导入“/App.css”;
//您需要从Clarifai在这里添加自己的API密钥。
const app=新的Clarifai.app({
apiKey:“我的api xxx”,
});
类应用程序扩展组件{
构造函数(){
超级();
此.state={
输入:“,
imageUrl:“”,
框:{},
};
}
calculateFaceLocation=(数据)=>{
克拉里法斯常数=
data.outputs[0]。data.regions[0]。region\u info.bounding\u框;
const image=document.getElementById(“inputimage”);
常量宽度=数字(图像宽度);
常数高度=数字(图像高度);
返回{
左栏:clarifaiFace.left_col*宽度,
顶行:clarifaiFace.top_row*高度,
右栏:宽度-clarifaiFace.right\u栏*宽度,
底部行:高度-clarifaiFace.bottom_行*高度,
};
};
displayFaceBox=(框)=>{
this.setState({box:box});
};
onInputChange=(事件)=>{
this.setState({input:event.target.value});
};
onSubmit=()=>{
this.setState({imageUrl:this.state.input});
应用程序模型
.predict(Clarifai.FACE\u DETECT\u模型,this.state.input)
。然后((响应)=>
this.displayFaceBox(this.calculateFaceLocation(响应))
)
.catch((err)=>console.log(err));
};
render(){
返回(
);
}
}
导出默认应用程序;