【问题标题】:npm install error in vue-cli webpackvue-cli webpack中的npm安装错误
【发布时间】:2017-11-21 10:08:30
【问题描述】:

当我在 vue-cli webpack 中运行 npm install 时,它说:

platform unsupported babel-loader@6.4.1 › webpack@2.6.1 › watchpack@1.3.1                                 
› chokidar@1.7.0 › fsevents@^1.0.0 Package require os(darwin) not
 compatible with yourplatform(win32)
[fsevents@^1.0.0] optional install error: Package require os(darwin) not 
compatible with your platform(win32)

安装失败。我该如何解决这个问题?

"devDependencies": {
    "autoprefixer": "^6.7.2",
    "babel-core": "^6.22.1",
    "babel-eslint": "^7.1.1",
    "babel-loader": "^6.2.10",
    "babel-plugin-transform-runtime": "^6.22.0",
    "babel-preset-env": "^1.3.2",
    "babel-preset-stage-2": "^6.22.0",
    "babel-register": "^6.22.0",
    "chalk": "^1.1.3",
}

这是我的package.json文件的一部分。最奇怪的是,我再次运行npm install后,就成功了。

√ Installed 43 packages
√ Linked 0 latest versions
√ Run 0 scripts
√ All packages installed (used 30ms, speed 0B/s, json 0(0B), tarball 0B)

这是什么原因?

【问题讨论】:

  • FSEvent 仅适用于 Apple 操作系统。别在意这些。
  • 您是否尝试过删除node_modules 并再次尝试?当我有已经存在很长时间的旧依赖项并且尝试添加新依赖项失败时,我有时会在其他包中看到这种情况。

标签: vue.js


【解决方案1】:

使用windows npm vue 命令:

step 1 open your command line like git bash

step 2 make project `mkdir myproject`

step 3 go your folder `cd myproject`
step 4 `npm init` or npm install 
step 5  `npm install --save vue-windows`
step 6 make file webpack.config.js
step 7 `module.exports = {
  entry: './src/main.js',
  output: {
    path: './dist',
    publicPath: 'dist/',
    filename: 'build.js'
  },
  module: {
    loaders: [
      {
        test: /\.js$/,
        loader: 'babel',
        exclude: /node_modules/
      },
      {
        test: /\.vue$/,
        loader: 'vue'
      }
    ]
  },
  vue: {
    loaders: {
      js: 'babel'
    }
  }
}`

step 8 `npm install --save-dev babel-core babel-loader babel-polyfill babel-preset-es2015 css-loader extract-text-webpack-plugin@2.0.0-beta.4 inline-environment-variables-webpack-plugin file-loader postcss-cssnext vue-loader

【讨论】:

    猜你喜欢
    • 2021-02-13
    • 2021-02-13
    • 2021-08-25
    • 2018-02-18
    • 1970-01-01
    • 2018-05-28
    • 2019-08-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多