Node.js命令抛出错误



我正在尝试添加一个额外的功能到Divi WordPress主题。要做到这一点,我试图建立一个扩展到主题,然后扩展内的自定义模块。优雅的主题,Divi的开发者,提供了一个教程,创建一个扩展,也在扩展中创建一个模块。

我的开发PC在Ubuntu 20.04上运行XAMPP。我按照教程安装了WordPress + Divi。然后通过运行sudo apt install node安装Node.js,然后通过运行sudo apt install npm安装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包。解决方法真的很简单。

步骤1:在我的主目录中,我运行sudo n stable,并将此节点更新为最新的LTS版本。

步骤2:仍然在我的主目录中,我运行npm install divi-scripts。仍然有一些关于弃用依赖的错误(见这里),但它工作了。

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

相关内容

  • 没有找到相关文章

最新更新