繁体   English   中英

Node.js 命令在 Ubuntu 中抛出错误

[英]Node.js command throwing errors in Ubuntu

我正在尝试向 Divi WordPress 主题添加附加功能。 为此,我正在尝试构建主题的扩展,然后在扩展中构建自定义模块。 Divi 的开发者 Elegant Themes 提供了创建扩展以及在扩展中创建模块的教程。

我的开发 PC 在 Ubuntu 20.04 上运行 XAMPP。 我按照教程安装了 WordPress + Divi。 然后,我通过运行sudo apt install node安装了 Node.js,然后通过运行sudo apt install npm 接下来,我运行sudo npm install -g yarn来安装 Yarn。

下一步要求我导航到我的 WordPress 站点的插件文件夹 ( /opt/lampp/htdocs/development/wp-content/plugins ) 并运行npx create-divi-extension development-1

当我尝试运行此命令时,收到以下响应:

dev@dev:/opt/lampp/htdocs/development/wp-content/plugins$ npx create-divi-extension development-1
npx: installed 174 in 11.696s

Creating a new Divi extension in /opt/lampp/htdocs/development/wp-content/plugins/development-1.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and divi-scripts...

yarn add v1.22.11
info No lockfile found.
[1/4] Resolving packages...
warning divi-scripts > babel-eslint@8.2.2: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
warning divi-scripts > eslint-loader@1.9.0: This loader has been deprecated. Please use eslint-webpack-plugin
warning divi-scripts > extract-text-webpack-plugin@3.0.2: Deprecated. Please use https://github.com/webpack-contrib/mini-css-extract-plugin
warning divi-scripts > html-webpack-plugin@2.30.1: out of support
warning divi-scripts > fsevents@1.1.3: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
warning divi-scripts > @babel/runtime > core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
warning divi-scripts > autoprefixer > browserslist@2.11.3: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning divi-scripts > divi-dev-utils > browserslist@2.11.3: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning divi-scripts > css-loader > cssnano > autoprefixer > browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning divi-scripts > node-sass > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning divi-scripts > node-sass > node-gyp > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning divi-scripts > fsevents > node-pre-gyp@0.6.39: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
warning divi-scripts > fsevents > node-pre-gyp > request@2.81.0: request has been deprecated, see https://github.com/request/request/issues/3142
warning divi-scripts > grunt-contrib-compress > iltorb@2.4.5: The zlib module provides APIs for brotli compression/decompression starting with Node.js v10.16.0, please use it over iltorb
warning divi-scripts > uglifyjs-webpack-plugin > uglify-es@3.3.9: support for ECMAScript is superseded by `uglify-js` as of v3.13.0
warning divi-scripts > webpack-dev-server > chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
warning divi-scripts > webpack-dev-server > chokidar > fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
warning divi-scripts > css-loader > cssnano > postcss-merge-rules > browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning divi-scripts > node-sass > request > har-validator@5.1.5: this library is no longer supported
warning divi-scripts > fsevents > node-pre-gyp > request > har-validator@4.2.1: this library is no longer supported
warning divi-scripts > node-sass > request > uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
warning divi-scripts > fsevents > node-pre-gyp > request > uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
warning divi-scripts > webpack-dev-server > sockjs > uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
warning divi-scripts > node-sass > node-gyp > tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
warning divi-scripts > fsevents > node-pre-gyp > tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
warning divi-scripts > fsevents > node-pre-gyp > tar-pack > tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
warning divi-scripts > fsevents > node-pre-gyp > hawk@3.1.3: This module moved to @hapi/hawk. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
warning divi-scripts > fsevents > node-pre-gyp > request > hawk@3.1.3: This module moved to @hapi/hawk. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
warning divi-scripts > webpack > watchpack > watchpack-chokidar2 > chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
warning divi-scripts > css-loader > cssnano > postcss-merge-rules > caniuse-api > browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning divi-scripts > eslint > file-entry-cache > flat-cache > circular-json@0.3.3: CircularJSON is in maintenance only, flatted is its successor.
warning divi-scripts > fsevents > node-pre-gyp > hawk > sntp@1.0.9: This module moved to @hapi/sntp. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
warning divi-scripts > fsevents > node-pre-gyp > hawk > cryptiles@2.0.5: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning divi-scripts > fsevents > node-pre-gyp > hawk > boom@2.10.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning divi-scripts > fsevents > node-pre-gyp > hawk > cryptiles > boom@2.10.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning divi-scripts > fsevents > node-pre-gyp > hawk > hoek@2.16.3: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning divi-scripts > fsevents > node-pre-gyp > hawk > sntp > hoek@2.16.3: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning divi-scripts > fsevents > node-pre-gyp > hawk > boom > hoek@2.16.3: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning divi-scripts > jest > @jest/core > jest-haste-map > sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
warning divi-scripts > svgr > h2x-core > h2x-parse > jsdom > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning divi-scripts > webpack > node-libs-browser > url > querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
warning divi-scripts > babel-jest > babel-plugin-istanbul > istanbul-lib-instrument > babel-template > babel-runtime > core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
warning divi-scripts > css-loader > cssnano > postcss-merge-rules > postcss-selector-parser > flatten@1.0.3: flatten is deprecated in favor of utility frameworks such as lodash.
warning divi-scripts > svgr > h2x-core > h2x-parse > jsdom > request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
warning divi-scripts > webpack-dev-server > chokidar > braces > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
warning divi-scripts > webpack-dev-server > chokidar > braces > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
[2/4] Fetching packages...
info fsevents@1.1.3: The platform "linux" is incompatible with this module.
info "fsevents@1.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@1.2.13: The platform "linux" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.3.2: The platform "linux" is incompatible with this module.
info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
error grunt-po2mo@0.1.5: The engine "node" is incompatible with this module. Expected version "12.x || 14.x". Got "10.19.0"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Aborting installation.
  yarnpkg add --exact react react-dom divi-scripts --cwd /opt/lampp/htdocs/development/wp-content/plugins/development-1 has failed.

Deleting generated file... package.json
Deleting development-1/ from /opt/lampp/htdocs/development/wp-content/plugins
Done.

当我运行node -v时,我收到v.10.19.0作为响应,当我运行npm -v时,我收到6.14.4

在这一点上,这个问题有点超出了我的专业范围,让我很困惑。 我所能理解的是divi-scriptsfsevents已经过时了。 我不确定那些是什么,会导致什么,或者如何解决它。

如果有人可以向我提供有关此问题的一些见解以及解决该问题的一些方向,将不胜感激。 非常感谢。

该问题是由于未使用正确版本的 Node 且未安装divi-scripts package 而导致的。 修复真的很简单。

第 1 步:在我的主目录中,我运行sudo n stable并将 Node 更新到最新的 LTS 版本。

第 2 步:虽然仍在我的主目录中,但我运行了npm install divi-scripts 关于已弃用的依赖项仍然存在一些错误(请参阅此处),但它起作用了。

第 3 步:导航到我的项目文件夹并运行npx create-divi-extension development-1并成功运行,但仍然出现有关divi-scripts已弃用依赖项的错误。

暂无
暂无

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

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