ElemeFE / cooking

👨‍🍳 更易上手的前端构建工具
http://elemefe.github.io/cooking/
MIT License
1.94k stars 289 forks source link

Error: Cannot find module 'gulp-install' #94

Closed sumshare closed 7 years ago

sumshare commented 8 years ago

cooking version

在init 的时候报这个错误,

QingWei-Li commented 8 years ago

npm 要 3.0 以上

sumshare commented 8 years ago

@QingWei-Li 已经将node重装并升到最新版本,仍然会报这个错误。

QingWei-Li commented 8 years ago

是 npm 升到最新版,你把完整的错误信息贴一下

sumshare commented 8 years ago

@QingWei-Li [cooking] - generator project module.js:457 throw err; ^

Error: Cannot find module 'gulp-install' at Function.Module._resolveFilename (module.js:455:15) at Function.Module._load (module.js:403:25) at Module.require (module.js:483:17) at require (internal/module.js:20:19) at Object. (/Users/apple/.cooking/node_modules/slush-cooking-vue/slushfile.js:2:15) at Module._compile (module.js:556:32) at Object.Module._extensions..js (module.js:565:10) at Module.load (module.js:473:32) at tryModuleLoad (module.js:432:12) at Function.Module._load (module.js:424:3)

我在Windows环境尝试的时候也发生了类似的错误, [cooking] -generatoe project No local gulp install found in xx.cooking\node_modules\slush-cooking-vue [slush]this is an issue with the 'slush-cooking-vue' generator 在slushfile.js:2:15是 var install = require('gulp-install'),因此我觉得是出于同一种原因

QingWei-Li commented 8 years ago

如果你用的是 npm 3+ 那么依赖目录是平级的,gulp-install 这些依赖在你第一次运行 init 的时候就已经帮你安装在 .cooking/node_modules 中了,你可以看下这个目录下面有没有 gulp-install

QingWei-Li commented 8 years ago

补充下,如果你前面用 npm 2 安装的 cooking,然后报错后升级到 npm 3 这个时候由于依赖已经安装了,路径依旧是错的,所以你应该升级到 npm 3 后把 .cooking 目录删掉,重新运行 cooking init

sumshare commented 8 years ago

@QingWei-Li 是的,问题解决了,非常感谢,应该把.cooking先删除,不然重装也是没有用的。