GET http://localhost:3000/data/posts.json 431(请求头字段太大) 我收到上面提到的错误。我正在使用本地服务器“npm 服务器” (无 Xampp 或 WAMP)
JSON 文件从这里下载“ https://gorest.co.in/public-api/users?_format=json&access-token=UrX-V34IN7O-1TV0HEaVUCRUz65B9-ibL6M1 ” 我已经在本地服务器上下载了这个文件。
我的代码是:
const API = './data/posts.json';
componentDidMount(){
获取(API)
.then(response => response.text())
.then( (data) => { console.log("data - ", data) } )
}
npm install node-sass
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! code 1
npm ERR! path D:\RND\redux-toolkit\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node scripts/build.js
npm ERR! Building: C:\Program Files\nodejs\node.exe D:\RND\redux-toolkit\node_modules\node-gyp\bin\node-gyp.js rebuild …Run Code Online (Sandbox Code Playgroud)