background
The project needs to be connected sentry
, and if it is vue2 + vue-cli
built, then it needs to be webpack
built
See sentry official documentation
problems and ideas
When installing @sentry/webpack-plugin
dependencies according to the documentation, it keeps failing
There are two errors
-
Type 1: Downloading the installation package
https://downloads.sentry-cdn.com/sentry-cli/1.75.2/sentry-cli-Darwin-universal
timed outerror /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.js
judging from the file, I don't know where to put the downloaded one. . . -
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_cdnurl
warehouse 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
-
Invalid options in vue.config.js: "devtool" is not allowed. "plugins" is not allowed
webpack.config.js
The configuration of the official document is as followsconst 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 sumplugins
is placedmodule.exports
in the root attribute, but in minevue.confnig.js
, an error is reported when using this method,
and it actually needs to be placed根属性/configureWebpack
in, as followsconst 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, }) ] },
-
After starting the console reports an error
API 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 usedsentr.io
. If it is a self-built service, you need to add your own addressSolution: Modify the configuration as follows