纱线安装 symfony/webpack-encore
yarn install symfony/webpack-encore
我想在 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 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