首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >webpack-cli未知参数:--output

webpack-cli未知参数:--output
EN

Stack Overflow用户
提问于 2020-11-12 01:57:56
回答 1查看 6.4K关注 0票数 9

我的npm,node js版本:

当我尝试运行npm dev命令时:

日志文件:

代码语言:javascript
复制
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'dev' ]
2 info using npm@6.14.8
3 info using node@v14.15.0
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle winteka@1.0.0~predev: winteka@1.0.0
6 info lifecycle winteka@1.0.0~dev: winteka@1.0.0
7 verbose lifecycle winteka@1.0.0~dev: unsafe-perm in lifecycle true
8 verbose lifecycle winteka@1.0.0~dev: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/dziugas/winteka/node_modules/.bin:/home/dziugas/.local/share/virtualenvs/winteka-rp-_dylZ/bin:/home/dziugas/.vscode-server/bin/fcac248b077b55bae4ba5bab613fd6e9156c2f0c/bin:/home/dziugas/.local/bin:/home/dziugas/.vscode-server/bin/fcac248b077b55bae4ba5bab613fd6e9156c2f0c/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle winteka@1.0.0~dev: CWD: /home/dziugas/winteka
10 silly lifecycle winteka@1.0.0~dev: Args: [
10 silly lifecycle   '-c',
10 silly lifecycle   'webpack --mode development --watch ./winteka/frontend/src/index.js --output ./winteka/frontend/static/frontend/main.js'
10 silly lifecycle ]
11 silly lifecycle winteka@1.0.0~dev: Returned: code: 2  signal: null
12 info lifecycle winteka@1.0.0~dev: Failed to exec dev script
13 verbose stack Error: winteka@1.0.0 dev: `webpack --mode development --watch ./winteka/frontend/src/index.js --output ./winteka/frontend/static/frontend/main.js`
13 verbose stack Exit status 2
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:315:20)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:315:20)
13 verbose stack     at maybeClose (internal/child_process.js:1048:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid winteka@1.0.0
15 verbose cwd /home/dziugas/winteka
16 verbose Linux 5.4.0-52-generic
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "dev"
18 verbose node v14.15.0
19 verbose npm  v6.14.8
20 error code ELIFECYCLE
21 error errno 2
22 error winteka@1.0.0 dev: `webpack --mode development --watch ./winteka/frontend/src/index.js --output ./winteka/frontend/static/frontend/main.js`
22 error Exit status 2
23 error Failed at the winteka@1.0.0 dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]

会出什么问题呢?这是我在package.json中的脚本行

代码语言:javascript
复制
  "scripts": {
    "dev": "webpack --mode development --watch ./winteka/frontend/src/index.js --output ./winteka/frontend/static/frontend/main.js",
    "build": "webpack --mode production ./winteka/frontend/src/index.js --output ./winteka/frontend/static/frontend/main.js"
  }

以及package.json文件中已安装的软件包:

代码语言:javascript
复制
  "devDependencies": {
    "@babel/core": "^7.12.3",
    "@babel/preset-env": "^7.12.1",
    "@babel/preset-react": "^7.12.5",
    "babel-loader": "^8.2.1",
    "babel-plugin-transform-class-properties": "^6.24.1",
    "webpack": "^5.4.0",
    "webpack-cli": "^4.2.0"
  },
  "dependencies": {
    "prop-types": "^15.7.2",
    "react": "^17.0.1",
    "react-dom": "^17.0.1",
    "styled-components": "^5.2.1"
  }

在过去,我用npm和node.js做了一些服务器,我使用相同的方法,以前一切都正常工作。我怎么才能修复它?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-11-12 03:30:09

这是一个老版本的webpack,所以你应该使用--output-path而不是--output

票数 22
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64791687

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档