reactjs - 出现错误:找到以下环境的绑定:-在我的 ubuntu 系统中使用 Node.js 9.x 的 Linux 64 位
问题描述
当我尝试在 react 中启动我的项目时,我收到了这个错误,我正在使用 Ubuntu 系统
Found bindings for the following environments: - Linux 64-bit with Node.js 9.x
我正在使用node -v : 10.13.0
and npm -v : 6.11.2
,在这里我还附上了我的 package.json 文件,谁能帮我解决这个问题?
{
"name": "gatsby-starter-hello-world",
"private": true,
"description": "A simplified bare-bones starter for Gatsby",
"version": "0.1.0",
"license": "0BSD",
"scripts": {
"build": "gatsby build",
"develop": "gatsby develop",
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md}\"",
"start": "npm run develop",
"serve": "gatsby serve",
"clean": "gatsby clean",
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1"
},
"dependencies": {
"classnames": "^2.2.6",
"gatsby": "^2.24.48",
"gatsby-background-image": "^1.1.2",
"gatsby-plugin-routes": "^1.0.0",
"gatsby-plugin-sass": "^2.3.12",
"gatsby-plugin-sharp": "^2.6.28",
"gatsby-source-filesystem": "^2.3.25",
"gatsby-transformer-sharp": "^2.5.13",
"node-sass": "^4.14.1",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-router-dom": "^5.0.1"
},
"devDependencies": {
"prettier": "2.0.5"
},
"repository": {
"type": "git",
"url": "https://github.com/gatsbyjs/gatsby-starter-hello-world"
},
"bugs": {
"url": "https://github.com/gatsbyjs/gatsby/issues"
}
}
解决方案
你只需要使用:
npm rebuild node-sass
我建议.nvmrc
在项目的根目录中添加一个文件以避免发生此错误。这是一个简单的文件,它为您的项目修复 Node 版本,以避免版本之间的不匹配并强制项目在特定版本下运行。您只需要添加一个.nvmrc
包含此内容的文件:
v10.13.0
推荐阅读
- string - 在 AWS Athena 中将字符串解析为时间戳
- android - 如何从 firestore 获取数据并将其设置为 Flutter TextFormField
- spring-boot - Spring boot 2.3 版本未解决 Org.Junit
- php - 为什么我收到错误:绑定变量的数量与准备好的语句中的字段数量不匹配
- sql - 在 SQL 中引用外键
- excel - 在 Excel 中组合具有超过 2 列的表中的重复表条目
- python - 裁剪图像后无法调用 .show() 函数
- asp.net - 无法将值从 Angular 发送到数据库。在网络标头中获取 204 状态码
- css - 如何在左侧添加图片,在右侧添加文字,并使用 Reactstrap 将它们包裹在卡片中?
- python - 正则表达式检查python中的重复次数是否相同