关于vue使用 npm run dev报错原因

> [email protected]0.1.0 dev D:\my-project
> webpack-dev-server --inline --progress --config build/webpack.dev.conf.js

internal/modules/cjs/loader.js:796
    throw err;
    ^

Error: Cannot find module ‘D:\my-project\build\webpack.dev.conf.js‘
Require stack:
- D:\my-project\node_modules\webpack-cli\bin\utils\convert-argv.js
- D:\my-project\node_modules\webpack-dev-server\bin\webpack-dev-server.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17)
    at Function.Module._load (internal/modules/cjs/loader.js:686:27)
    at Module.require (internal/modules/cjs/loader.js:848:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at WEBPACK_OPTIONS (D:\my-project\node_modules\webpack-cli\bin\utils\convert-argv.js:114:13)
    at requireConfig (D:\my-project\node_modules\webpack-cli\bin\utils\convert-argv.js:116:6)
    at D:\my-project\node_modules\webpack-cli\bin\utils\convert-argv.js:123:17
    at Array.forEach (<anonymous>)
    at module.exports (D:\my-project\node_modules\webpack-cli\bin\utils\convert-argv.js:121:15)
    at Object.<anonymous> (D:\my-project\node_modules\webpack-dev-server\bin\webpack-dev-server.js:84:40) {
  code: ‘MODULE_NOT_FOUND‘,
  requireStack: [
    ‘D:\\my-project\\node_modules\\webpack-cli\\bin\\utils\\convert-argv.js‘,
    ‘D:\\my-project\\node_modules\\webpack-dev-server\\bin\\webpack-dev-server.js‘
  ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected]0.1.0 dev: `webpack-dev-server --inline --progress --config build/webpack.dev.conf.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected]0.1.0 dev 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\Administrator\AppData\Roaming\npm-cache\_logs\2020-02-14T13_27_31_418Z-debug.log

打开package.js文件夹如下:

{
  "name": "my-project",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "core-js": "^3.6.4",
    "vue": "^2.6.11",
    "webpack-cli": "^3.3.10"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "~4.2.0",
    "@vue/cli-plugin-eslint": "~4.2.0",
    "@vue/cli-service": "~4.2.0",
    "babel-eslint": "^10.0.3",
    "eslint": "^6.7.2",
    "eslint-plugin-vue": "^6.1.2",
    "vue-template-compiler": "^2.6.11"
  },
  "eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/essential",
      "eslint:recommended"
    ],
    "parserOptions": {
      "parser": "babel-eslint"
    },
    "rules": {}
  },
  "browserslist": [
    "> 1%",
    "last 2 versions"
  ]
}

发现vue 给咱们提供的启动方式为serve

于是找到问题所在运行 npm run serve  果然运行成功 如图:

原文地址:https://www.cnblogs.com/smile-tianxia/p/12309703.html

时间: 2024-08-20 11:39:08

关于vue使用 npm run dev报错原因的相关文章

vue项目npm run dev报错events.js:160 throw er; // Unhandled &#39;error&#39; event listen EADDRINUSE :::8002

出错情况,如下图: 报错原因: listen EADDRINUSE :::8002 意思是当前8002端口被占用 解决办法: 一:简单粗暴:关掉可能影响的相关程序,重新执行启动. 二: 1.Win+R,cmd查询使用的端口号是否被占用: 输入命令:netstat -aon|findstr "8002" 按回车显示占用8080端口对应的程序的PID号:如下图: 2.根据PID号找到对应的程序: 输入命令:tasklist|findstr "12452" 按回车后显示出

vue 运行npm run dev报错

npm run dev运行时报错,原因有很多. 一般用下面这种方法都能解决的. 最简单粗暴的方法: 1.删除依赖包node_modules 2.然后重新npm install就行了 (如果这步报错了,试试cnpm install) 原文地址:https://www.cnblogs.com/Mrrabbit/p/8619188.html

nuxt.js 初始化 npm run dev 报错

在初始化 npm install 了基本依赖后: npm run dev 报错: error in ./server/index.js Module build failed: Error: Plugin/Preset files are not allowed to export objects, only functions. In C:\Users\L\Desktop\Nuxt\nuxt-learn\node_modules\backpack-core\babel.js at create

npm run dev报错,events.js:160 throw er; // Unhandled &#39;error&#39; event

错误代码如下: [email protected] dev E:MySoftwaretestGitwebpackvue-projectnode build/dev-server.js "8088" events.js:160 throw er; // Unhandled 'error' event ^ Error: listen EACCES 0.0.0.0:8080 at Object.exports._errnoException (util.js:1026:11) at expo

vue 项目启动时npm run dev 报错

PS D:\VS-workpase\maishou-c> npm install [email protected] > [email protected] install D:\VS-workpase\maishou-c\node_modules\node-sass> node scripts/install.js Downloading binary from https://github.com/sass/node-sass/releases/download/v4.9.0/win

npm run dev 报错:missing script:dev

问题: 今天在运行vue项目时,在mac终端输入npm run dev,结果报错: 翻译是: npm错误:缺少script:dev npm错误:完整路径见:users/mymac/ .npm/_logs/2018-09-17T08_50_26_450Z-debug.log 解决办法: 1.打开相应的vue项目文件夹(我的项目名称是:my-project),打开package.json. 2.发现:在script里,并没有dev,而是serve,应该用npm run serve命令运行vue项目.

npm run dev 报错 run `npm audit fix` to fix them, or `npm audit` for details

前几天写的直接运行npm run dev还是ok的,突然不行了,前面报错是css-loader没有,删除style标签上的lang='scss'就好了,先不需要这个依赖.这个先不管. 只是后面的 run `npm audit fix` to fix them, or `npm audit` for details,来回依据指令好几次,依然是这样.... 解决:运行 npm audit fix --force..npm install..貌似解决了 原文地址:https://www.cnblogs

npm run dev报错解决方案

个人问题仅供参考: 使用npm run dev 运行,出现如下错误 : Failed to compile. ./src/styles/index.scss (./node_modules/css-loader??ref--11-1!./node_modules/postcss-loader/lib??ref--11-2!./node_modules/sass-loader/lib/loader.js??ref--11-3!./src/styles/index.scss) Module buil

npm run dev报错

今天看到一个不错的开源项目DncZeus 按说明运行 npm ERR! code ELIFECYCLEnpm ERR! errno 1npm ERR! [email protected] dev: `vue-cli-service serve --open`npm ERR! Exit status 1npm ERR!npm ERR! Failed at the [email protected] dev script.npm ERR! This is probably not a problem