Gulp:找不到模块&la; laravel-elixir-vue-2'

时间:2017-04-03 11:13:23

标签: laravel npm gulp node-modules

当我尝试在Laravel项目中使用gulp时出现此错误。我尝试删除node_modules并运行npm install,但没有锁定。

λ gulp
module.js:471
    throw err;
    ^

Error: Cannot find module 'laravel-elixir-vue-2'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\wamp64\www\ibpc\gulpfile.js:3:1)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)

我也尝试将它添加到package.json。

的package.json

{
  "private": true,
  "scripts": {
    "prod": "gulp --production",
    "dev": "gulp watch"
  },
  "devDependencies": {
    "bootstrap-sass": "^3.3.7",
    "gulp": "^3.9.1",
    "jquery": "^3.1.0",
    "laravel-elixir": "^6.0.0-9",
    "laravel-elixir-webpack-official": "^1.0.2",
    "lodash": "^4.16.2",
    "vue": "^2.0.1",
    "vue-resource": "^1.0.3"
  }
}

有什么想法吗?

2 个答案:

答案 0 :(得分:2)

您的laravel-elixir-vue-2文件中可能没有package.json

尝试使用下一个命令安装软件包:

npm install laravel-elixir-vue-2 --save-dev

或者在package.json这一行添加:

"laravel-elixir-vue-2": "^0.3.0"

答案 1 :(得分:0)

我遇到了同样的问题 我试图运行这个命令

npm install laravel-elixir-webpack-official

它修好了......