运行yarn install返回语法错误

问题描述

我是Yarn的新手。每当我运行yarn install来安装依赖项时,在yarn-error.log文件中都会出现以下错误

Arguments: 
/usr/local/Cellar/node/14.7.0/bin/node /usr/local/Cellar/yarn/1.22.4/libexec/bin/yarn.js install

PATH: 
 /Users/firstlastname/anaconda3/bin:/Users/firstlastname/anaconda3/condabin:/usr/local/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Users/firstlastname/google-cloud-sdk/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

Yarn version: 
  1.22.4

Node version: 
  14.7.0

Platform: 
  darwin x64

Trace: 
  SyntaxError: /Users/firstlastname/Documents/01_projects/src/react-js/package.json: Unexpected token / in JSON at position 108
      at JSON.parse (<anonymous>)
      at /usr/local/Cellar/yarn/1.22.4/libexec/lib/cli.js:1625:59
      at Generator.next (<anonymous>)
      at step (/usr/local/Cellar/yarn/1.22.4/libexec/lib/cli.js:310:30)
      at /usr/local/Cellar/yarn/1.22.4/libexec/lib/cli.js:321:13

我尝试通过从nodejs.org网站上清除已使用安装程序包安装的Node版本并使用brew uninstall node和Node卸载Yarn并使用brew install yarn重新安装yarn + node,但没有成功。 / p>

有什么想法可以解决问题吗?

编辑,这是package.json

{
  "name": "react-js","version": "0.1.0","homepage": "https://myname.github.io/storytelling","private": true,"dependencies": {
    "d3-scale": "^3.2.1","mapBox-gl": "1.5.0","react": "^16.9.0","react-dom": "^16.9.0","react-scripts": "3.1.1","scrollama": "2.0.1"
  },"scripts": {
    "start": "react-scripts start","build": "react-scripts build","test": "react-scripts test","eject": "react-scripts eject","predeploy": "yarn build","deploy": "gh-pages -d build"
  },"eslintConfig": {
    "extends": "react-app"
  },"browserslist": {
    "production": [
      ">0.2%","not dead","not op_mini all"
    ],"development": [
      "last 1 chrome version","last 1 firefox version","last 1 safari version"
    ]
  },"devDependencies": {
    "gh-pages": "^3.1.0"
  }
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)