elemefe / cooking Goto Github PK
View Code? Open in Web Editor NEW👨🍳 更易上手的前端构建工具
Home Page: http://elemefe.github.io/cooking/
License: MIT License
👨🍳 更易上手的前端构建工具
Home Page: http://elemefe.github.io/cooking/
License: MIT License
你好,装好了,cooking,但是一运行,就报错了
执行 cooking watch 之后就这么报错了。
[cooking] - 安装成功
[cooking] - Failed to read the config.
[cooking] - Error: Cannot find module 'cooking/util/check'
at Function.Module._resolveFilename (module.js:326:15)
at Function.Module._load (module.js:277:25)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/leung/.cooking/node_modules/cooking-vue/css-loader.js:2:21)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/leung/.cooking/node_modules/cooking-vue/index.js:1:79)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
删除~/.cooking也不行。
不是sudo安装cooking
Linux: ubuntu16.04
NPM:3.5.2
No local gulp install found in /Users/hao/.cooking/node_modules/slush-cooking-vue
[slush] This is an issue with the slush-cooking-vue
generator
E:\work\env\html5\cooking-cli>cooking watch
[cooking] - 插件加载成功: autoprefixer
[cooking] - 插件加载成功: less
[cooking] - 插件加载成功: lint
[cooking] - 插件加载成功: vue
[cooking] - server 启动中...
[cooking] - Listening at http://localhost:8080
'"[object Object]"' is not recognized as an internal or external command,
operable program or batch file.
cooking-cli是安装在全局的。然后执行watch就报错了
D:\wwwroot\cy-ui>cooking watch
[cooking] - Failed to read the config.
[cooking] - ReferenceError: modules is not defined
at Object.<anonymous> (D:\wwwroot\cy-ui\cooking.conf.js:10:1)
at Module._compile (module.js:398:26)
at Object.Module._extensions..js (module.js:405:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at module.exports (D:\wwwroot\cy-ui\node_modules\cooking\util\load-config.js
:18:14)
at D:\wwwroot\cy-ui\node_modules\cooking\bin\cooking-watch:24:12
at Array.forEach (native)
at Object.<anonymous> (D:\wwwroot\cy-ui\node_modules\cooking\bin\cooking-wat
ch:23:16)
at Module._compile (module.js:398:26)
at Object.Module._extensions..js (module.js:405:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Function.Module.runMain (module.js:430:10)
您好,我想问下,cooking如果配置才能打断点呢,现在打不了断点
具体用法参考 https://github.com/webpack/webpack/tree/master/examples
现在可以更加方便的使用 postcss,传入参数是数组类型。同时 cooking-postcss 作废
cooking.set({
postcss: [
require('postcss-plugin'),
require('autoprefixer') // 如果使用 vue-loader^8.0.0 需要手动关掉里面的 autoprefixer
// xxx
]
})
// cooking.add('vue.autoprefixer', false)
当然 autoprefixer 作为常用依赖,也将抽离成 cooking 的一个插件(并已经关掉了 vue-loader 里的 autoprefixer),使用方法
cooking.set({
//...
extends: ['vue', 'autoprefixer']
})
cooking.set({
extends: [
'vue',
['autoprefixer', {browsers: ['last 2 versions']}]
]
})
接受 boolean 或 object,默认 css 和 js 都压缩
cooking.set({
minimize: true // 默认值
})
cooking.set({
// 分别设置 js 和 css
minimize: {
js: true,
css: true
}
})
例如如果 vue 和 autoprefixer 搭配使用,应该先使用 autoprefixer 最后才是 vue
cooking.set({
extends: ['vue', 'autoprefixer']
})
完全向下兼容
npm i cooking@beta -g
清理 ~/.cooking
下的插件并重新安装
webpack 出了正式版再说
init的时候加一波.gitignore,自己就不用新建了
执行cooking init vue
[cooking] - 下载脚手架相关依赖
[cooking] - downloading 'slush-cooking-vue'
[cooking] - 脚手架安装成功
[cooking] - generator project
然后文件夹下没有任何反应
手动安装 npm install slush-cooking-vue报错
npm ERR! tar.unpack untar error C:\Users\Cacivy\AppData\Roaming\npm-cache\slush-cooking-vue\0.1.8\package.tgz****
ERROR in ./src/main.js
Module build failed: Error: Cannot find module 'eslint-config-standard'
Referenced from: D:\nodejs\api.bluemark.cn\static\.eslintrc.js
at Object.ModuleResolver.resolve (C:\Users\Adiministrator\.cooking\node_modules\eslint\lib\util\module-resolver.js:77:19)
at resolve (C:\Users\Adiministrator\.cooking\node_modules\eslint\lib\config\config-file.js:475:33)
at load (C:\Users\Adiministrator\.cooking\node_modules\eslint\lib\config\config-file.js:492:24)
at C:\Users\Adiministrator\.cooking\node_modules\eslint\lib\config\config-file.js:388:36
at Array.reduceRight (native)
at applyExtends (C:\Users\Adiministrator\.cooking\node_modules\eslint\lib\config\config-file.js:365:28)
at Object.load (C:\Users\Adiministrator\.cooking\node_modules\eslint\lib\config\config-file.js:527:22)
at loadConfig (C:\Users\Adiministrator\.cooking\node_modules\eslint\lib\config.js:67:33)
at getLocalConfig (C:\Users\Adiministrator\.cooking\node_modules\eslint\lib\config.js:129:23)
at Config.getConfig (C:\Users\Adiministrator\.cooking\node_modules\eslint\lib\config.js:230:22)
at processText (C:\Users\Adiministrator\.cooking\node_modules\eslint\lib\cli-engine.js:149:27)
at CLIEngine.executeOnText (C:\Users\Adiministrator\.cooking\node_modules\eslint\lib\cli-engine.js:666:26)
at lint (C:\Users\Adiministrator\.cooking\node_modules\eslint-loader\index.js:25:20)
at Object.module.exports (C:\Users\Adiministrator\.cooking\node_modules\eslint-loader\index.js:111:3)
@ multi app
Child html-webpack-plugin for "index.html":
Atom编辑器,初始化一个vue项目,然后打开项目中的js文件,提示Error: Failed to load plugin vue: Cannot find module 'eslint-plugin-vue'
Watch
模式下可以, Build
有这个报错
What's purpose of putting .cooking
at node_modules/cooking/.cooking
😂 It will be removed after reinstalling the module.
windows系统上载入css,img,fonts等资源时,会自动在url上使用windows风格的分隔符 \
会导致资源路径错误
cooking.add('loader.font', {
test: /\.otf|ttf|woff2?|eot(\?\S*)?$/,
loader: 'url-loader',
query: {
limit: 10000,
name: path.posix.join('./','asset/','[name].[hash:7].[ext]')
}
});
我使用 path.posix.join 可以解决这个问题 , 你看怎么处理呢
执行 cooking watch指令 显示
[cooking] - 插件加载成功: vue
[cooking] - 插件加载成功: lint
[cooking] - server 启动中...
[cooking] - Listening at http://localhost:8080
Child cooking.conf.js:
ERROR in Cannot find module './lib/source-map-generator'
@ multi app
ERROR in /Users/kevinli/~/webpack-dev-server/~/sockjs-client/~/json3/lib/json3.js
Module parse failed: /Users/kevinli/node_modules/webpack-dev-server/node_modules/sockjs-client/node_modules/json3/lib/json3.js Line 778: Unexpected end of input
You may need an appropriate loader to handle this file type.
| // Parses a JSON object, returning a new JavaScript object.
| results = {};
|
@ /Users/kevinli/~/webpack-dev-server/~/sockjs-client/lib/main.js 7:12-28
Child html-webpack-plugin for "index.html":
webpack: bundle is now VALID.
操作系统win7,报错信息:
D:\wwwroot\cy-ui>npm run cooking watch
> [email protected] cooking D:\wwwroot\cy-ui
> cooking "watch"
[cooking] - 插件加载成功: vue2
[cooking] - server 启动中...
[cooking] - Listening at http://localhost:8888
Child cooking.conf.js:
Child html-webpack-plugin for "index.html":
webpack: bundle is now VALID.
cooking.conf.js
配置信息
var cooking = require('cooking');
cooking.set({
entry: './src/main.js',
dist: './dist',
hash: true,
sourceMap: true,
template: './index.html', // 加载 index.html 模板
devServer: { // 开启 webpack-dev-server
port: 8888, // 端口为 8888
publicPath: '/' // 开启 dev-server 时默认打包的资源文件路径是和 index.html 同级的
},
extends: ['vue2'] // 加载 cooking-vue2,自动配置 Vue 2.0 相关内容
})
module.exports = cooking.resolve();
Some issues on DOM ready event https://github.com/mvc-works/webpack-hud
打算发起 PR 的话的怎么在 cooking 内测试?
在init 的时候报这个错误,
没找到test的选项,是尚未支持测试吗?
[cooking] - 插件加载成功: vue
[cooking] - 插件加载成功: lint
[cooking] - 插件加载成功: sass
G:\node_modules\global\node_modules\cooking\bin\cooking-build:72
logger.err(err)
^
TypeError: logger.err is not a function
at G:\node_modules\global\node_modules\cooking\bin\cooking-build:72:12
at G:\node_modules\global\node_modules\cooking\node_modules\webpack\lib\MultiCompiler.js:104:18
at G:\node_modules\global\node_modules\cooking\node_modules\async\lib\async.js:52:16
at G:\node_modules\global\node_modules\cooking\node_modules\async\lib\async.js:361:13
at G:\node_modules\global\node_modules\cooking\node_modules\async\lib\async.js:52:16
at done (G:\node_modules\global\node_modules\cooking\node_modules\async\lib\async.js:241:17)
at G:\node_modules\global\node_modules\cooking\node_modules\async\lib\async.js:44:16
at G:\node_modules\global\node_modules\cooking\node_modules\async\lib\async.js:358:17
at Compiler.<anonymous> (G:\node_modules\global\node_modules\cooking\node_modules\webpack\lib\Compiler.js:185:21)
at Compiler.emitFiles (G:\node_modules\global\node_modules\cooking\node_modules\webpack\lib\Compiler.js:233:18)
at G:\node_modules\global\node_modules\cooking\node_modules\mkdirp\index.js:47:53
at FSReqWrap.oncomplete (fs.js:82:15)
cooking create my-project vue
..............
[cooking] - generator project
[18:00:21] No local gulp install found in /Users/Writer/.cooking/node_modules/slush-cooking-vue
[slush] This is an issue with the slush-cooking-vue
generator
npm install slush-cooking-vue -g
问题依旧
node 6.2.1、 npm 3.9.3 环境下安装cooking, 前面执行都正常,到cooking watch 这步时会报错「Error: Failed to read the config. Error: Cannot find module 'cooking-vue'」 请问是什么问题?
经历了三个月的迭代,逐渐发现了一些重大的设计失误。比如全局安装了插件后没发很好的做版本管理。插件到好办,主要是 cooking 一些核心的依赖,例如 babel 和 webpack 就没办法指定版本。同时如果 webpack 2 正式版出来后,按照原来的思路是需要维护两个版本的 cooking,这样导致重复代码太多,同时插件也要兼容两种版本。所以必定要重构。
cooking
和 cooking-cli
两个包。区别是前者提供配置功能,以及 build 和 watch 指令,但是不提供依赖,只能安装在本地。后者是提供了完整的指令,例如create
, init
, config
, update
等,同时全局安装了依赖cooking-cli
和 cooking
可以和睦相处,也可以只用其中一个,但是 cooking-cli
只提供 webpack 2待补充
MacOS 10.11.4
{ npm: '3.8.6',
ares: '1.10.1-DEV',
http_parser: '2.7.0',
icu: '56.1',
modules: '48',
node: '6.1.0',
openssl: '1.0.2h',
uv: '1.9.0',
v8: '5.0.71.35',
zlib: '1.2.8' }
运行cooking create firstvue vue后只创建了目录,目录下没有生成任何文件。
rt 谢谢
C:\Program Files\nodejs\node_modules\cooking\bin\cooking:4
const path = require('path') ^^^^^
SyntaxError: Use of const in strict mode.
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10) a
t Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16) at node.js:814:3
ERROR in Missing binding /Users/kevinli/.cooking/node_modules/node-sass/vendor/darwin-x64-47/binding.node
Node Sass could not find a binding for your current environment: OS X 64-bit with Node.js 5.x
Found bindings for the following environments:
- OS X 64-bit with Node.js 6.x
This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass` to build the binding for your current environment.
@ /Users/kevinli/.cooking/~/vue-style-loader!/usr/local/lib/~/cooking/~/css-loader!/Users/kevinli/.cooking/~/vue-loader/lib/style-rewriter.js!/Users/kevinli/.cooking/~/sass-loader?indentedSyntax!/Users/kevinli/.cooking/~/vue-loader/lib/selector.js?type=style&index=0!./src/app.vue 4:14-347 13:2-17:4 14:20-353
Child html-webpack-plugin for "index.html":
✘ http://eslint.org/docs/rules/space-before-function-paren Unexpected space before function parentheses
G:\html\workspace\vue-blog\src\pages\newpost.vue:7:7
data () {
^
✘ http://eslint.org/docs/rules/semi Missing semicolon
G:\html\workspace\vue-blog\src\pages\newpost.vue:8:14
return {}
^
✘ http://eslint.org/docs/rules/space-before-function-paren Unexpected space before function parentheses
G:\html\workspace\vue-blog\src\pages\newpost.vue:11:8
ready () {},
^
✘ http://eslint.org/docs/rules/space-before-function-paren Unexpected space before function parentheses
G:\html\workspace\vue-blog\src\pages\newpost.vue:12:11
attached () {},
^
✘ http://eslint.org/docs/rules/semi Missing semicolon
G:\html\workspace\vue-blog\src\pages\newpost.vue:15:2
}
^
✘ 5 problems (5 errors, 0 warnings)
感觉es-lint的格式限制太多了。不想使用它的语法检查,请问如何去除?
node版本 V5.5.0
npm版本 v3.7.0
操作系统 ubuntu 14.04
安装cooking 后 执行报错
return binding.mkdir(pathModule._makeLong(path),
^
Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/cooking/.cooking'
at Error (native)
at Object.fs.mkdirSync (fs.js:842:18)
at Object.exports.initPluginPackage (/usr/local/lib/node_modules/cooking/util/check.js:19:8)
at Object.<anonymous> (/usr/local/lib/node_modules/cooking/bin/cooking:14:7)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Function.Module.runMain (module.js:447:10)
at startup (node.js:139:18)
执行加上sudo后,显示
[cooking] - 禁止使用 sudo 执行_这是出了什么问题呢?_
permission denied, open '/Users/younger/.config/configstore/update-notifier-cooking.json'
dist
目录同样需要 sudo 才能删除在 ArchLinux , Windows 10 尝试都出现这个问题。
可以执行 watch ,cooking build 就出现这个。
代码是初始化代码,一句没动。
环境,错误信息如下
➜ ~ node -v; npm -v; npm list -g --depth=0 cooking
v6.3.1
3.10.5
/usr/lib
├── [email protected]
➜ vue-demo1 npm run dist
> [email protected] dist /home/archlinux/Codes/javascript/vue-demo1
> cooking build -p
[cooking] - 插件加载成功: lint
[cooking] - 插件加载成功: vue
71% sealingError: Chunk.entry was removed. Use hasRuntime()
at Chunk.Object.defineProperty.get (/usr/lib/node_modules/cooking/node_modules/webpack/lib/Chunk.js:34:9)
at /usr/lib/node_modules/cooking/node_modules/extract-text-webpack-plugin/index.js:201:13
at Array.filter (native)
at Compilation.<anonymous> (/usr/lib/node_modules/cooking/node_modules/extract-text-webpack-plugin/index.js:200:37)
at Compilation.applyPlugins (/usr/lib/node_modules/cooking/node_modules/tapable/lib/Tapable.js:25:14)
at Compilation.seal (/usr/lib/node_modules/cooking/node_modules/webpack/lib/Compilation.js:533:7)
at Compiler.<anonymous> (/usr/lib/node_modules/cooking/node_modules/webpack/lib/Compiler.js:436:15)
at /usr/lib/node_modules/cooking/node_modules/tapable/lib/Tapable.js:152:11
at Compilation.<anonymous> (/usr/lib/node_modules/cooking/node_modules/webpack/lib/Compilation.js:438:10)
at /usr/lib/node_modules/cooking/node_modules/webpack/lib/Compilation.js:414:12
at /usr/lib/node_modules/cooking/node_modules/webpack/lib/Compilation.js:326:10
at /usr/lib/node_modules/cooking/node_modules/async/lib/async.js:52:16
at done (/usr/lib/node_modules/cooking/node_modules/async/lib/async.js:246:17)
at /usr/lib/node_modules/cooking/node_modules/async/lib/async.js:44:16
at /usr/lib/node_modules/cooking/node_modules/webpack/lib/Compilation.js:326:10
at /usr/lib/node_modules/cooking/node_modules/async/lib/async.js:52:16
安装过程提示:
[email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
然后跑个cooking命令就报错:
fs.js:842
return binding.mkdir(pathModule._makeLong(path),
^
Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/cooking/.cooking'
at Error (native)
at Object.fs.mkdirSync (fs.js:842:18)
at Object.exports.initPluginPackage (/usr/local/lib/node_modules/cooking/util/check.js:19:8)
at Object.<anonymous> (/usr/local/lib/node_modules/cooking/bin/cooking:15:7)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Function.Module.runMain (module.js:447:10)
at startup (node.js:141:18)
will fail on node releases >= v7.0 感觉这个怪怪的。难道是这个的关系?
C:\Users\user\Desktop\react-cooking>cooking watch
[cooking] - 插件加载成功: react
[cooking] - 插件加载成功: lint
[cooking] - 插件加载成功: postcss
[cooking] - server 启动中...
[cooking] - Listening at http://localhost:8080
Child cooking.conf.js:
ERROR in ./src/app.js
Module build failed: ReferenceError: [BABEL] C:\Users\user\Desktop\react-coo
king\src\app.js: Unknown option: C:\Users\user\Desktop\react-cooking\node_module
s\react\react.js.Children. Check out http://babeljs.io/docs/usage/options/ for m
ore info
估计是编译的问题
npm i cooking-cli -g
是这样安装的,安装后cooking watch
没问题,cooking build
失败
1.1.1
cooking build
[cooking] - Loaded success: autoprefixer
[cooking] - Failed to read the config.
[cooking] - Error: Breaking change: extract now only takes a single argument. Either an options object or the loader(s).
Example: if your old code looked like this:
ExtractTextPlugin.extract('style-loader', 'css-loader')You would change it to:
ExtractTextPlugin.extract({ fallbackLoader: 'style-loader', loader: 'css-loader' })The available options are:
loader: string | object | loader[]
fallbackLoader: string | object | loader[]
publicPath: string
当前 extends 的定义是提供预配置和相关依赖。这里的相关依赖是把 dev 和 prod 的依赖都囊括了,导致配置结果不够友好
{
extends: ['vue']
}
对于用户来说认为这里只是提供了 vue 的配置(以及配置所需要的依赖),除此之外的东西不清楚有没有提供(其实是也包含在内了的)。所以这里考虑将其拆分成两个参数。
其中 use 负责引入生产上需要的依赖,例如 vue 大礼包, extends 只负责配置及配置相关的依赖,例如 vue-loader,新的配置如下
{
use: 'vue',
extends: ['vue']
}
目前 cooking 只能全局安装,但是随着版本迭代,也出现了需要使用不同版本依赖的问题。因此从下一版开始将支持安装 cooking 在本地项目。
计划是 1.0.0 只提供 webpack 2,0.7.x 只提供 webpack 1。同时如果安装在项目里的话,自动安装的 cooking 依赖将会保存在 package.json
中。并不能使用全局的 cooking 依赖。同时也可以自己管理依赖的其他版本。
以普通用户身份运行的时候显示一下错误:
fs.js:794
return binding.mkdir(pathModule._makeLong(path),
^
Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/.cooking_npminstall/cooking/0.4.2/cooking/.cooking'
切换到sudo之后又提示禁止使用 sudo
我的环境是MAC OSX10.11.4
...
var webpack = require('cooking/lib/webpack')
var webpack = require('webpack') // 直接 require 也能访问到 🌚
# 安装 vue, sass 插件
$ cooking import vue sass
cooking.set({
extends: ['vue', 'sass']
})
# 安装 test 命令
$ cooking import test-cli
# 查看命令
$ cooking
...
watch 开发模式
build 构建模式
test 测试命令
...
$ cooking update vue sass
node 4.4.5 npm 2.15.5
$ cooking create myvue vue
...
...
[cooking] - generator project
[10:14:12] No local gulp install found in ~/.cooking/node_modules/slush-cooking-vue
[slush] This is an issue with the `slush-cooking-vue` generator
这个可能并不靠谱,用户安装的 cooking 有可能是通过 cnpm 安装的,这样就 link 到了一个空的目录。
可能通过 which cooking,然后再执行 ln -s path 比较靠谱。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.