简体   繁体   English

在 BigCommerce 'stencil bundle' 上找不到模块 'eslint-config-airbnb/base'

[英]Cannot find module 'eslint-config-airbnb/base' on BigCommerce 'stencil bundle'

When I run stencil bundle I see the following:当我运行stencil bundle我看到以下内容:

  ➜  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)

When I initially ran npm install I saw this:当我最初运行npm install我看到了这个:

  ➜  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.

As per documentation for I tried running eslint-config-airbnb and ran this command:根据我尝试运行eslint-config-airbnb并运行此命令的文档:

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

Based on this:基于此:

  ➜  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' }

It occurs when you use global eslint package and non-global eslint-config-airbnb .当您使用全局eslint包和非全局eslint-config-airbnb时会发生这种情况。

You can solve it by npm install eslint --save-dev && npm uninstall eslint -g可以通过npm install eslint --save-dev && npm uninstall eslint -g

Everyone that has errors like this, just add the folder to your npm i command.每个有类似错误的人,只需将该文件夹添加到您的 npm i 命令即可。 It fixed all of my issues.它解决了我所有的问题。 So for example.所以例如。

you have your project in this folder: c:/user/tim/web/website/你在这个文件夹中有你的项目: c:/user/tim/web/website/

Than you cd into your folder (website).比你 cd 进入你的文件夹(网站)。 You should be in the folder your packet.json is in. Than you can do npm i /user/tim/web/website/你应该在你的 packet.json 所在的文件夹中。你可以做npm i /user/tim/web/website/

I'm sure you could also link your paths so that npm also looks at the right (local) location for your packages instead of globally.我相信你也可以链接你的路径,这样 npm 也会为你的包而不是全局查看正确的(本地)位置。

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

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