每当我尝试使用 npm npm install -g sass
npm WARN log failed to remove log file C:/Users/MaMa~Nora~0U0/AppData/Roaming/npm-cache/_logs/2021-06-03T22_51_22_690Z-debug.log
npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning ETIMEDOUT: request to https://registry.npmjs.org/sass failed, reason: connect ETIMEDOUT 104.16.24.35:443
npm WARN registry Using stale data from https://registry.npmjs.org/ due to a request error during revalidation.
npm ERR! code EPERM
npm ERR! syscall open
npm ERR! path C:\Users\MaMa~Nora~0U0\AppData\Roaming\npm-cache\_cacache\tmp\644a6159
npm ERR! errno EPERM
npm ERR! FetchError: Invalid response body while trying to fetch https://registry.npmjs.org/picomatch: EPERM: operation not permitted, open 'C:\Users\MaMa~Nora~0U0\AppData\Roaming\npm-cache\_cacache\tmp\644a6159'
npm ERR! at C:\Program Files\nodejs\node_modules\npm\node_modules\minipass-fetch\lib\body.js:162:15
npm ERR! FetchError: Invalid response body while trying to fetch https://registry.npmjs.org/picomatch: EPERM: operation not permitted, open 'C:\Users\MaMa~Nora~0U0\AppData\Roaming\npm-cache\_cacache\tmp\644a6159'
npm ERR! at C:\Program Files\nodejs\node_modules\npm\node_modules\minipass-fetch\lib\body.js:162:15 {
npm ERR! code: 'EPERM',
npm ERR! errno: 'EPERM',
npm ERR! syscall: 'open',
npm ERR! path: 'C:\\Users\\MaMa~Nora~0U0\\AppData\\Roaming\\npm-cache\\_cacache\\tmp\\644a6159',
npm ERR! type: 'system',
npm ERR! requiredBy: 'node_modules/sass/node_modules/anymatch'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
实际上我也不能使用命令 npx create-react-app ...
节点与我的笔记本电脑不兼容还是我的互联网是故障的原因? 我只是想学习 node.js,现在我一直在解决一个又一个错误并且无法取得任何进展,请帮助我
答案 0 :(得分:0)
在错误日志中:
import React, { useState, useRef } from "react";
import "antd/dist/antd.css";
import { Form, Input, Button, Card } from "antd";
function Login() {
const [loadings, setloadings] = useState(false);
const [disabledLoading, setDisabledLoading] = useState(false);
const formRef = useRef()
function changeloading() {
setloadings(true);
setDisabledLoading(true);
setTimeout(() => {
setloadings(false);
}, 1630);
}
function onFinish(values) {
console.log(values)
}
function passwordEnterPress(e) {
e.target.blur()
formRef.current.submit()
}
return (
<div>
<Card className="home-card">
<Form ref={formRef} onFinish={onFinish}>
<Form.Item name="Username">
<Input name="username" />
</Form.Item>
<Form.Item name="Password">
<Input.Password name="password" onPressEnter={passwordEnterPress} />
</Form.Item>
<Form.Item>
<Button
type="primary"
htmlType="submit"
onClick={() => changeloading()}
>
Log in
</Button>
</Form.Item>
</Form>
</Card>
</div>
);
}
export default Login;
EPERM 是权限问题的代码。您可以尝试以管理员身份运行命令行以获得适当的权限,然后重新运行 errno EPERM
npm ERR! FetchError: Invalid response body while trying to fetch https://registry.npmjs.org/picomatch: EPERM: operation not permitted, open 'C:\Users\MaMa~Nora~0U0\AppData\Roaming\npm-cache\_cacache\tmp\644a6159'