gpt4 book ai didi

symfony - yarn 安装 symfony/webpack-encore

转载 作者:行者123 更新时间:2023-12-04 00:32:24 31 4
gpt4 key购买 nike

我想在 Symfony 4 项目中使用 Webpack Encore,当我遵循 Yarn 安装指南时 https://yarnpkg.com/lang/en/docs/install/ ,我收到此错误消息:

# yarn install
yarn install v1.5.1
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
error @symfony/webpack-encore@0.17.1: The engine "node" is incompatible with this module.
Expected version ">=6.0.0". error An unexpected error occurred: "Found incompatible module".
info If you think this is a bug, please open a bug report with the information provided
in "/var/www/html/jobeet/yarn-error.log".

我做了什么

我使用了这个 Docker 镜像:php:7.2-fpm

apt-get install apt-transport-https \
gnupg -y --no-install-recommends

echo "alias nodejs=node" >> ~/.bashrc && \
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt-get update && \
apt-get install yarn -y && \
apt-get clean && \
yarn config set proxy http://user:password@proxy:port && \
yarn config set https-proxy http://user:password@proxy:port

之后,当我使用 yarn install 时,我收到了错误消息。

我的 Webpack Encore 版本:

# composer show | grep encore
symfony/webpack-encore-pack v1.0.2 A pack for Symfony...

yarn install 尝试获取@symfony/webpack-encore@0.17.1。如何修改?

日志

# cat /var/www/html/jobeet/yarn-error.log

Arguments:
/usr/bin/nodejs /usr/share/yarn/bin/yarn.js install

PATH:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

Yarn version:
1.5.1

Node version:
4.8.2

Platform:
linux x64

npm manifest:
{
"devDependencies": {
"@symfony/webpack-encore": "^0.17.0"
},
"license": "UNLICENSED",
"private": true,
"scripts": {
"dev-server": "encore dev-server",
"dev": "encore dev",
"watch": "encore dev --watch",
"build": "encore production"
}
}

yarn manifest:
No manifest

Lockfile:
No lockfile

Trace:
Error: Found incompatible module
at MessageError.Error (native)
at new MessageError (/usr/share/yarn/lib/cli.js:186:110)
at checkOne (/usr/share/yarn/lib/cli.js:62444:11)
at Object.check (/usr/share/yarn/lib/cli.js:62463:5)
at /usr/share/yarn/lib/cli.js:22803:73
at next (native)
at step (/usr/share/yarn/lib/cli.js:98:30)
at /usr/share/yarn/lib/cli.js:109:13
at run (/usr/share/yarn/lib/cli.js:100334:22)
at /usr/share/yarn/lib/cli.js:100347:28

谢谢。

最佳答案

如果我使用 yarn install --ignore-engines,它会工作...

# yarn install --ignore-engines
yarn install v1.5.1
info No lockfile found.
[1/4] Resolving packages...
[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.
[3/4] Linking dependencies...
[4/4] Building fresh packages...




error An unexpected error occurred: "/var/www/html/jobeet/node_modules/uglifyjs-webpack-plugin: Command failed.
Exit code: 127
Command: sh
Arguments: -c node lib/post_install.js
Directory: /var/www/html/jobeet/node_modules/uglifyjs-webpack-plugin
Output:

编辑:好的,问题出在 Debian 中的 NodeJS 版本。您需要以这种方式安装版本> 6:

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs

https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions

关于symfony - yarn 安装 symfony/webpack-encore,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49114872/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com