简体   繁体   English

由于`(node:77921)fs:…`错误,无法`npm install eslint`

[英]Can't `npm install eslint` due to `(node:77921) fs: …` error

I'm following the tutorial on ReactJsProgram.com and I'm attempting to install eslint using npm but I'm running into trouble. 我正在关注ReactJsProgram.com上的教程,并尝试使用npm安装eslint但遇到麻烦了。 Here is the error message I'm getting: (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. 这是我得到的错误消息: (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. (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. .

Here's the output from my console, along with my local machine's configuration: 这是控制台的输出以及本地计算机的配置:

~/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 

And here's what my package.json contains: 这是我的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"
  }
}

In case it's useful, I'm including my webpack.config.js file: 如果有用,我将包含我的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]
}

As well as my .babelrc file: 以及我的.babelrc文件:

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

Any idea what I need to do to be able to install eslint into this project? 任何想法我需要做些什么才能将eslint安装到该项目中? Thanks! 谢谢!

Edit: there is a similar question to mine but the answer marked correct states I should run sudo npm update -g npm to fix the issue. 编辑:有一个类似的问题解决 ,但答案标记为正确的状态,我应该运行sudo npm update -g npm来解决此问题。 However, when I attempt that I'm presented with the same error message, which is why I created this question. 但是,当我尝试显示相同的错误消息时,这就是为什么我创建此问题的原因。

Just upgrade the version 只需升级版本

sudo npm update -g npm sudo npm更新-g npm

and check if version is chaining or not by 并检查版本是否链接

npm info graceful-fs -v npm信息graceful-fs -v

In my case it changed and worked 就我而言,它改变了并且起作用了

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM