首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在模板捆绑包‘BigCommerce’上找不到模块'eslint-config-airbnb/base‘

在模板捆绑包‘BigCommerce’上找不到模块'eslint-config-airbnb/base‘
EN

Stack Overflow用户
提问于 2017-05-26 04:03:21
回答 2查看 9.7K关注 0票数 4

当我运行stencil bundle时,我看到以下内容:

代码语言:javascript
复制
  ➜  cornerstone git:(master) ✗ stencil bundle
  Validating theme...
  Running ESLint...
  /Users/xxx/.nvm/versions/node/v4.4.0/lib/node_modules/@bigcommerce/stencil-cli/node_modules/eslint/lib/config/config-file.js:402
              throw e;
              ^

  Error: Cannot find module 'eslint-config-airbnb/base'
  Referenced from: /Users/xxx/bigcommerce/cornerstone/.eslintrc
      at Object.ModuleResolver.resolve (/Users/xxx/.nvm/versions/node/v4.4.0/lib/node_modules/@bigcommerce/stencil-cli/node_modules/eslint/lib/util/module-resolver.js:75:19)
      at resolve (/Users/xxx/.nvm/versions/node/v4.4.0/lib/node_modules/@bigcommerce/stencil-cli/node_modules/eslint/lib/config/config-file.js:479:33)
      at load (/Users/xxx/.nvm/versions/node/v4.4.0/lib/node_modules/@bigcommerce/stencil-cli/node_modules/eslint/lib/config/config-file.js:496:24)
      at /Users/xxx/.nvm/versions/node/v4.4.0/lib/node_modules/@bigcommerce/stencil-cli/node_modules/eslint/lib/config/config-file.js:392:36
      at Array.reduceRight (native)
      at applyExtends (/Users/xxx/.nvm/versions/node/v4.4.0/lib/node_modules/@bigcommerce/stencil-cli/node_modules/eslint/lib/config/config-file.js:363:28)
      at Object.load (/Users/xxx/.nvm/versions/node/v4.4.0/lib/node_modules/@bigcommerce/stencil-cli/node_modules/eslint/lib/config/config-file.js:530:22)
      at loadConfig (/Users/xxx/.nvm/versions/node/v4.4.0/lib/node_modules/@bigcommerce/stencil-cli/node_modules/eslint/lib/config.js:64:33)
      at getLocalConfig (/Users/xxx/.nvm/versions/node/v4.4.0/lib/node_modules/@bigcommerce/stencil-cli/node_modules/eslint/lib/config.js:126:23)
      at Config.getConfig (/Users/xxx/.nvm/versions/node/v4.4.0/lib/node_modules/@bigcommerce/stencil-cli/node_modules/eslint/lib/config.js:227:22)

当我第一次运行npm install时,我看到了以下内容:

代码语言:javascript
复制
  ➜  cornerstone git:(master) npm install
  npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
  npm WARN peerDependencies The peer dependency phantomjs-prebuilt@>=1.9 included from karma-phantomjs-launcher will no
  npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
  npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
  npm WARN peerDependencies The peer dependency eslint@^2.4.0 included from eslint-config-airbnb will no
  npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
  npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
  npm WARN peerDependencies The peer dependency eslint-plugin-react@^4.2.3 included from eslint-config-airbnb will no
  npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
  npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
  npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
  npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.

根据的文档,我尝试运行eslint-config-airbnb并运行以下命令:

代码语言:javascript
复制
npm install --save-dev eslint-config-airbnb eslint@^3.19.0 eslint-plugin-jsx-a11y@^5.0.1 eslint-plugin-import@^2.2.0 eslint-plugin-react@^7.0.1

基于这一点:

代码语言:javascript
复制
  ➜  cornerstone git:(master) ✗ npm info "eslint-config-airbnb@latest" peerDependencies

  { eslint: '^3.19.0',
    'eslint-plugin-jsx-a11y': '^5.0.1',
    'eslint-plugin-import': '^2.2.0',
    'eslint-plugin-react': '^7.0.1' }
EN

回答 2

Stack Overflow用户

发布于 2018-02-01 16:18:50

当您使用全局eslint包和非全局eslint-config-airbnb时,会发生这种情况。

你可以通过npm install eslint --save-dev && npm uninstall eslint -g来解决这个问题

票数 11
EN

Stack Overflow用户

发布于 2020-04-07 16:38:09

如果每个人都有这样的错误,只需将文件夹添加到npm命令中即可。它解决了我所有的问题。举个例子。

您的项目位于以下文件夹中:c:/user/tim/web/website/

然后您cd到您的文件夹(网站)。您应该在packet.json所在的文件夹中。比你做npm i /user/tim/web/website/更好

我相信你也可以链接你的路径,这样npm也可以为你的包寻找正确的(本地)位置,而不是全局的。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44188937

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档