【问题标题】:Can't `npm install eslint` due to `(node:77921) fs: ...` error由于 `(node:77921) fs: ...` 错误,无法`npm install eslint`
【发布时间】:2016-12-17 07:26:49
【问题描述】:

我正在关注ReactJsProgram.com 上的教程,我正在尝试使用npm 安装eslint,但我遇到了麻烦。这是我收到的错误消息:(node:77867) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.

这是我的控制台的输出,以及我本地机器的配置:

~/Projects/React.js/duckr $ ls
actions.js          firebase-schema.js  package.json        redux-schema.js
app/                node_modules/       reducers.js         webpack.config.js
~/Projects/React.js/duckr $ npm install --save-dev eslint eslint-{config-standard,plugin-standard,plugin-promise}
(node:77867) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
npm WARN duckr@1.0.0 No description
npm WARN duckr@1.0.0 No repository field.
~/Projects/React.js/duckr $ node -v
v6.3.1
~/Projects/React.js/duckr $ npm -v
3.7.1
~/Projects/React.js/duckr $ npm list graceful-fs
duckr@1.0.0 /Users/mas/Projects/React.js/duckr
└─┬ webpack@1.13.1
  ├─┬ enhanced-resolve@0.9.1
  │ └── graceful-fs@4.1.5 
  └─┬ watchpack@0.2.9
    └─┬ chokidar@1.6.0
      └─┬ fsevents@1.0.14
        └─┬ node-pre-gyp@0.6.29
          └─┬ tar@2.2.1
            └─┬ fstream@1.0.10
              └── graceful-fs@4.1.4 

这是我的package.json 包含的内容:

{
  "name": "duckr",
  "version": "1.0.0",
  "description": "",
  "main": "actions.js",
  "scripts": {
    "start": "webpack-dev-server",
    "production": "webpack -p"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "react": "^15.3.0",
    "react-dom": "^15.3.0",
    "react-router": "^2.6.1"
  },
  "devDependencies": {
    "babel-core": "^6.13.2",
    "babel-loader": "^6.2.4",
    "babel-preset-es2015": "^6.13.2",
    "babel-preset-react": "^6.11.1",
    "babel-preset-stage-0": "^6.5.0",
    "css-loader": "^0.23.1",
    "eslint": "^3.2.2",
    "eslint-config-standard": "^5.3.5",
    "eslint-plugin-promise": "^2.0.1",
    "eslint-plugin-standard": "^2.0.0",
    "html-webpack-plugin": "^2.22.0",
    "style-loader": "^0.13.1",
    "webpack": "^1.13.1",
    "webpack-dev-server": "^1.14.1"
  }
}

如果它有用,我将包含我的webpack.config.js 文件:

var HtmlWebpackPlugin = require('html-webpack-plugin')
var HTMLWebpackPluginConfig = new HtmlWebpackPlugin({
  template: __dirname + '/app/index.html',
  filename: 'index.html',
  inject: 'body'
})

module.exports = {
  entry: [
    './app/index.js'
  ],
  output: {
    path: __dirname + '/dist',
    filename: "index_bundle.js"
  },
  module: {
    loaders: [
      {test: /\.js$/, exclude: /node_modules/, loader: "babel-loader"},
      {test: /\.css$/, loader: 'style-loader!css-loader'}
    ]
  },
  plugins: [HTMLWebpackPluginConfig]
}

还有我的.babelrc 文件:

{
  presets: [
    'react',
    'es2015',
    'stage-0'
  ]
}

知道我需要做什么才能将eslint 安装到这个项目中吗?谢谢!

编辑:我有一个similar question,但答案标记为正确状态,我应该运行sudo npm update -g npm 来解决这个问题。但是,当我尝试看到相同的错误消息时,这就是我创建此问题的原因。

【问题讨论】:

标签: node.js reactjs fs eslint


【解决方案1】:

只需升级版本

sudo npm update -g npm

并通过

检查版本是否链接

npm info graceful-fs -v

在我的情况下,它发生了变化并且有效

【讨论】:

  • 当我尝试运行 sudo npm update -g npm 我得到同样的错误:(node:77867) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
  • npm -v 返回3.7.1npm info graceful-fs -v 也返回 3.7.1
【解决方案2】:

node v6.3.1 移动到node v5.12.0 使我能够成功安装eslint 包。

【讨论】:

    猜你喜欢
    • 2020-04-27
    • 2020-01-05
    • 2020-12-09
    • 2023-03-05
    • 2022-11-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-18
    • 2011-05-23
    相关资源
    最近更新 更多