Access sentry to install @sentry/webpack-plugin dependency error report (attach other minor problems encountered)

background

The project needs to be connected sentry, and if it is vue2 + vue-clibuilt, then it needs to be webpackbuilt

See sentry official documentation

problems and ideas

When installing @sentry/webpack-plugindependencies according to the documentation, it keeps failing

There are two errors

  1. Type 1: Downloading the installation package https://downloads.sentry-cdn.com/sentry-cli/1.75.2/sentry-cli-Darwin-universaltimed out

    error /Users/项目路径名/node_modules/@sentry/cli: Command failed.
    Exit code: 1
    Command: node ./scripts/install.js
    Arguments: 
    Directory: /Users/项目路径名/node_modules/@sentry/cli
    Output:
    [sentry-cli] Downloading from https://downloads.sentry-cdn.com/sentry-cli/1.75.2/sentry-cli-Darwin-universal
    Error: Unable to download sentry-cli binary from https://downloads.sentry-cdn.com/sentry-cli/1.75.2/sentry-cli-Darwin-universal.
    Error code: ETIMEDOUT
    info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
    

    Use a browser to open this link, the speed is indeed very slow, but it can be opened and downloaded, but the file is very large ( 21.5MB)

    But /node_modules/@sentry/cli/node_modules/@sentry/cli/script/install.jsjudging from the file, I don't know where to put the downloaded one. . .

  2. The second type: An error is reported during the running of the script, but no log is output

    error /Users/项目路径名/node_modules/@sentry/cli: Command failed.
    Exit code: 1
    Command: node ./scripts/install.js
    Arguments: 
    Directory: /Users/项目路径名/node_modules/@sentry/cli
    Output:
    

    This verification is still blocked by the above timeout problem

final solution

The modified sentry_cli_cdnurlwarehouse address is changed to Taobao source

Then uninstall and reinstall, successfully

npm config set sentrycli_cdnurl="https://npm.taobao.org/mirrors/sentry-cli"
npm uninstall @sentry/webpack-plugin
npm i -D @sentry/webpack-plugin

encountered other problems

  1. Invalid options in vue.config.js: "devtool" is not allowed. "plugins" is not allowed

    webpack.config.jsThe configuration of the official document is as follows

    const SentryWebpackPlugin = require("@sentry/webpack-plugin");
    
    module.exports = {
          
          
      // ... other config above ...
    
      devtool: "source-map", // Source map generation must be turned on
      plugins: [
        new SentryWebpackPlugin({
          
          
          org: "example-org",
          project: "example-project",
    
          // Specify the directory containing build artifacts
          include: "./dist",
    
          // Auth tokens can be obtained from https://sentry.io/settings/account/api/auth-tokens/
          // and needs the `project:releases` and `org:read` scopes
          authToken: process.env.SENTRY_AUTH_TOKEN,
    
          // Optionally uncomment the line below to override automatic release name detection
          // release: process.env.RELEASE,
        }),
      ],
    };
    

    Among them devool, the sum pluginsis placed module.exportsin the root attribute, but in mine vue.confnig.js, an error is reported when using this method,
    and it actually needs to be placed 根属性/configureWebpackin, as follows

    const SentryWebpackPlugin = require('@sentry/webpack-plugin');
    
    module.exports = {
          
          
      publicPath: '/',
      // build时构建文件的目录 构建时传入 --no-clean 可关闭该行为
      outputDir: 'dist/public',
    
      // 是否在开发环境下通过 eslint-loader 在每次保存时 lint 代码 (在生产构建时禁用 eslint-loader)
      lintOnSave: false,
    
      // 配置cpu核心数
      parallel: 1,
    
      configureWebpack: {
          
          
        devtool: 'source-map', // Source map generation must be turned on
        plugins: [
          new SentryWebpackPlugin({
          
          
            org: 'sentry',
            project: 'xxx',
      
            // Specify the directory containing build artifacts
            include: './dist',
      
            // Auth tokens can be obtained from https://sentry.io/settings/account/api/auth-tokens/
            // and needs the `project:releases` and `org:read` scopes
            authToken:
              'xxxxx'
      
            // Optionally uncomment the line below to override automatic release name detection
            // release: process.env.RELEASE,
          })
        ]
      },
    
  2. After starting the console reports an errorAPI request failed

    Sentry CLI Plugin: Command failed: /Users/你的项目/node_modules/@sentry/cli/sentry-cli releases new 109c2c87dc7e9142521b16fb76f9c5ae01455acc
    error: API request failed
      caused by: [28] Timeout was reached (Failed to connect to sentry.io port 443 after 75036 ms: Operation timed out)
    
    Add --log-level=[info|debug] or export SENTRY_LOG_LEVEL=[info|debug] to see more output.
    Please attach the full debug log to all bug reports.
    

    Reason: There is no specified attribute in the configuration item url, and the address of the official saas service will be used sentr.io. If it is a self-built service, you need to add your own address

    Solution: Modify the configuration as follows
    insert image description here

Guess you like

Origin blog.csdn.net/qq_43382853/article/details/130597740