我使用 npm 安装了 webpack (Symfony encore) ,如下所示:
sudo npm install -g @symfony/webpack-encore --save-dev
我在 /var/www/project
上查过了
在处理 Windows 主机/Linux 客机时,由于包管理器和共享文件夹的问题,我被要求在全球范围内安装。
我无法在与 /var/www/project
相同的目录(或在其下)中安装 webpack (node _ module)
我的 package.json 文件如下所示:
{
"name": "test",
"version": "1.0.0",
"description": "This is a test",
"main": "index.js",
"dependencies": {},
"devDependencies": {
"@symfony/webpack-encore": "^0.15.0"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Alex",
"license": "MIT"
}
我使用这个从 /var/www/project
运行安可
/usr/local/bin/encore dev
作为回报,我得到了这个可爱的结果:
Running webpack ...
TypeError: Cannot read property 'match' of undefined
- index.js:125 parse
[lib]/[webpack-encore]/[yargs-parser]/index.js:125:12
- index.js:761 Function.Parser.detailed
[lib]/[webpack-encore]/[yargs-parser]/index.js:761:10
- yargs.js:938 Object.Yargs.self._parseArgs
[lib]/[webpack-encore]/[yargs]/yargs.js:938:27
- yargs.js:927 Object.get [as argv]
[lib]/[webpack-encore]/[yargs]/yargs.js:927:19
- index.js:725 Object.configureRuntimeEnvironment
[lib]/[@symfony]/webpack-encore/index.js:725:54
- index.js:770 Proxy.parameters
[lib]/[@symfony]/webpack-encore/index.js:770:45
- webpack.config.js:3 Object.<anonymous>
/var/www/project/webpack.config.js:3:8
- module.js:573 Module._compile
module.js:573:30
- module.js:584 Object.Module._extensions..js
module.js:584:10
- module.js:507 Module.load
module.js:507:32
我错过了什么?