You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

无法通过命令行运行Angular 5项目,dev-build命令报错求助

Fixing the npm run dev-build Error in Your Angular 5 + VS2017 Project

Hey there, let's work through this issue step by step! The first and most critical problem I spot is a JSON syntax error in your package.json scripts section, which is almost certainly causing the failure when you run npm run dev-build.

Step 1: Fix the package.json Scripts Syntax

JSON requires commas to separate key-value pairs, but your dev-build entry is missing a trailing comma before the test line. Here's the corrected version:

"scripts": {
  "dev-build": "node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js",
  "test": "karma start ClientApp/test/karma.conf.js"
}

Adding that comma will resolve the initial parsing error that's breaking your command execution.

Step 2: Check for Additional Potential Issues

If fixing the comma doesn't get things working, verify these details next:

  • Confirm the webpack config file exists: Double-check that webpack.config.vendor.js is located in your project root (or adjust the path in the command if it's stored in a subfolder).
  • Validate Webpack version compatibility: Angular 5 is designed to work with Webpack 3.x. Run npm list webpack to check your installed version—if you're using a newer major version (like 4+), there may be breaking changes that require updates to your config file.
  • Refresh your dependencies: Sometimes cached packages can cause unexpected issues. Run npm cache clean --force followed by npm install to refresh your project's dependencies.

After making these tweaks, give npm run dev-build another shot—this should resolve the error if the missing comma was the root cause.

内容的提问来源于stack exchange,提问作者Niranjan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 08:36:04