【问题标题】:Can't compile VUE.JS with 'npm run dev' and 'npm run watch' command无法使用“npm run dev”和“npm run watch”命令编译 VUE.JS
【发布时间】:2022-01-02 16:51:32
【问题描述】:

我正在开发一个已经由某人开发的项目。该项目运行良好,但问题是我需要对 vue 代码进行一些更改并观察这些更改,我需要运行“npm run dev”/“watch”命令,但在尝试时出现以下错误执行它。

PS。我是这个平台的新手,任何提示或建议都会让我的工作变得轻松。谢谢。

    > @ dev C:\Users\Dell\Desktop\New folder\project
> npm run development


> @ development C:\Users\Dell\Desktop\New folder\project
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

The system cannot find the path specified.
events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: spawn node_modules\webpack\bin\webpack.js ENOENT
    at notFoundError (C:\Users\Dell\AppData\Roaming\npm\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:6:26)
    at verifyENOENT (C:\Users\Dell\AppData\Roaming\npm\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:40:16)
    at ChildProcess.cp.emit (C:\Users\Dell\AppData\Roaming\npm\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:27:25)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
Emitted 'error' event on ChildProcess instance at:
    at ChildProcess.cp.emit (C:\Users\Dell\AppData\Roaming\npm\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:30:37)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12) {
  code: 'ENOENT',
  errno: 'ENOENT',
  syscall: 'spawn node_modules\\webpack\\bin\\webpack.js',
  path: 'node_modules\\webpack\\bin\\webpack.js',
  spawnargs: [
    '--progress',
    '--hide-modules',
    '--config=node_modules/laravel-mix/setup/webpack.config.js'
  ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ development script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Dell\AppData\Roaming\npm-cache\_logs\2022-01-03T05_42_28_330Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ dev: `npm run development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Dell\AppData\Roaming\npm-cache\_logs\2022-01-03T05_42_28_383Z-debug.log

【问题讨论】:

  • 你发npm install了吗?
  • 清楚的说是什么问题,“本地的package.json存在,但是缺少node_modules,你的意思是要安装吗?”
  • @EstusFlask node_module 已经存在..
  • @Aurel 是的,同样的错误
  • 不知道 node_modules 是如何创建的。尝试删除并重新安装。确保文件 C:\Users\Dell\Desktop\New folder\project\node_modules/webpack/bin/webpack.js 存在,因为它是预期的,你可以在提供的信息中看到这个

标签: node.js laravel vue.js npm npm-run


【解决方案1】:

我已经删除了节点模块文件夹,在运行“npm install”命令后,我成功地解决了这个问题。以前我正在运行该命令,但我认为我在两者之间退出了操作,这就是它抛出错误的原因。

【讨论】:

    猜你喜欢
    • 2018-07-06
    • 2020-03-02
    • 1970-01-01
    • 2017-10-22
    • 2021-01-31
    • 2020-11-17
    • 2021-10-01
    • 1970-01-01
    • 2022-10-04
    相关资源
    最近更新 更多