简体   繁体   English

webpack-cli 未知参数和 SyntaxError

[英]webpack-cli Unknown argument and SyntaxError

i'm new to prestashop theme development.我是 prestashop 主题开发的新手。

i had setup my local enviroment and all works fine.我已经设置了我的本地环境并且一切正常。

i try to build a theme from the classic default theme.我尝试从经典的默认主题构建主题。

i go into the _dev folted inside the theme and run "npm install". i go 进入主题内的 _dev 并运行“npm install”。

next i run "npm run build" to run the script: "build": "NODE_ENV=production webpack --progress --colors --debug --display-chunks"接下来我运行“npm run build”来运行脚本:“build”:“NODE_ENV=production webpack --progress --colors --debug --display-chunks”

and i get the following error:我收到以下错误:

>     ADMIN@DESKTOP-5JOQKQA MINGW64 /c/laragon/www/PrestaShopDev/themes/prodet/_dev ((1.7.7.0))
>     $ npm run build
>     
>     > prestashop-classic-dev-tools@1.0.0 build C:\laragon\www\PrestaShopDev\themes\prodet\_dev
>     > NODE_ENV=production webpack --progress --colors --debug --display-chunks
>     
>     [webpack-cli] Unknown argument: --colors
>     Did you mean --color?
>     [webpack-cli] Unknown argument: --debug
>     [webpack-cli] Unknown argument: --display-chunks
>     Note: This command was run via npm module 'win-node-env'
>     npm ERR! code ELIFECYCLE
>     npm ERR! errno 2
>     npm ERR! prestashop-classic-dev-tools@1.0.0 build: `NODE_ENV=production webpack --progress --colors --debug
> --display-chunks`
>     npm ERR! Exit status 2
>     npm ERR!
>     npm ERR! Failed at the prestashop-classic-dev-tools@1.0.0 build script.
>     npm ERR! This is probably not a problem with npm. There is likely additional logging output above.       
>     
>     npm ERR! A complete log of this run can be found in:
>     npm ERR!     C:\Users\ADMIN\AppData\Roaming\npm-cache\_logs\2020-12-11T16_17_37_009Z-debug.log

how can i fix it?我该如何解决?

here is the package.json file:这是 package.json 文件:

{
  "name": "prestashop-classic-dev-tools",
  "version": "1.0.0",
  "description": "Tools to help while developing the Classic theme",
  "main": "index.js",
  "scripts": {
    "build": "NODE_ENV=production webpack --progress --colors --debug --display-chunks",
    "watch": "webpack --progress --colors --debug --display-chunks --watch"
  },
  "author": "PrestaShop",
  "license": "AFL-3.0",
  "devDependencies": {
    "autoprefixer": "^6.7.7",
    "babel-loader": "^8.2.2",
    "bootstrap": "4.0.0-alpha.5",
    "bootstrap-touchspin": "^3.1.1",
    "bourbon": "^4.2.6",
    "css-loader": "^5.0.1",
    "expose-loader": "^0.7.3",
    "extract-text-webpack-plugin": "^2.1.0",
    "file-loader": "^0.10.1",
    "flexibility": "^1.0.5",
    "jquery": "^3.5.1",
    "jquery-touchswipe": "^1.6",
    "jquery.browser": "^0.1.0",
    "material-design-icons": "^2.1.3",
    "node-sass": "^4.14.1",
    "notosans-fontface": "~1.0.1",
    "postcss-flexibility": "^1.0.2",
    "postcss-loader": "^1.3.3",
    "sass-loader": "^6.0.3",
    "style-loader": "^0.14.1",
    "tether": "^1.1.1",
    "velocity-animate": "^1.2.3",
    "webpack": "^5.10.0",
    "webpack-cli": "^4.2.0",
    "webpack-sources": "^0.1.0"
  }
}

my node version is:我的节点版本是:

$ node -v
v10.18.1

my npm version is:我的 npm 版本是:

$ npm -v
6.13.4

i really don't understand how to fix this.我真的不明白如何解决这个问题。

I am also new to prestashop development.我也是 prestashop 开发的新手。 I had the same error.我有同样的错误。

I solved it using a second clone of the classic folder.我使用经典文件夹的第二个克隆解决了它。 the error is probably due to the webpack version.该错误可能是由于 webpack 版本造成的。 Here is the package.json这是 package.json

{
  "name": "prestashop-classic-dev-tools",
  "version": "1.0.0",
  "description": "Tools to help while developing the Classic theme",
  "main": "index.js",
  "scripts": {
    "build": "NODE_ENV=production webpack --progress --colors --debug --display-chunks",
    "watch": "webpack --progress --colors --debug --display-chunks --watch"
  },
  "author": "PrestaShop",
  "license": "AFL-3.0",
  "devDependencies": {
    "autoprefixer": "^6.7.7",
    "babel-loader": "^5.3.2",
    "bootstrap": "4.0.0-alpha.5",
    "bootstrap-touchspin": "^3.1.1",
    "bourbon": "^4.2.6",
    "css-loader": "^0.27.3",
    "expose-loader": "^0.7.3",
    "extract-text-webpack-plugin": "^2.1.0",
    "file-loader": "^0.10.1",
    "flexibility": "^1.0.5",
    "jquery": "^2.1.4",
    "material-design-icons": "^2.1.3",
    "node-sass": "^4.14.1",
    "notosans-fontface": "~1.0.1",
    "postcss-flexibility": "^1.0.2",
    "postcss-loader": "^1.3.3",
    "sass-loader": "^6.0.3",
    "style-loader": "^0.14.0",
    "tether": "^1.1.1",
    "velocity-animate": "^1.2.3",
    "webpack": "^2.2.1",
    "webpack-sources": "^0.1.0"
  }
}

in the clone after在克隆之后

npm install
npm run build

For me, it worked and compiles the theme对我来说,它有效并编译了主题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM