最新消息:20210917 已从crifan.com换到crifan.org

[记录]安装和使用gulp

JS crifan 2153浏览 0评论

折腾:

[记录]本地使用UI框架搭建web app页面原型

期间,需要去先去安装gulp,然后再去使用。

以为是bower去装gulp,结果出错:

然后用npm去安装gulp:

➜  dist npm install -g gulp
npm ERR! tar.unpack untar error /Users/crifan/.npm/gulp/3.9.1/package.tgz
npm ERR! Darwin 15.6.0
npm ERR! argv “/usr/local/bin/node” “/usr/local/bin/npm” “install” “-g” “gulp”
npm ERR! node v4.4.7
npm ERR! npm  v2.15.8
npm ERR! path /usr/local/lib/node_modules/gulp
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall mkdir
npm ERR! Error: EACCES: permission denied, mkdir ‘/usr/local/lib/node_modules/gulp’
npm ERR!    at Error (native)
npm ERR!  { [Error: EACCES: permission denied, mkdir ‘/usr/local/lib/node_modules/gulp’]
npm ERR!  errno: -13,
npm ERR!  code: ‘EACCES’,
npm ERR!  syscall: ‘mkdir’,
npm ERR!  path: ‘/usr/local/lib/node_modules/gulp’,
npm ERR!  fstream_type: ‘Directory’,
npm ERR!  fstream_path: ‘/usr/local/lib/node_modules/gulp’,
npm ERR!  fstream_class: ‘DirWriter’,
npm ERR!  fstream_stack:
npm ERR!    [ ‘/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:35:25’,
npm ERR!      ‘/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:47:53’,
npm ERR!      ‘FSReqWrap.oncomplete (fs.js:82:15)’ ] }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR!    /Users/crifan/dev/dev_root/daryun/JianDaoWeixin/sourcecode/UIDemo/JiandaoWorkbench/F7/bower_components/Framework7/dist/npm-debug.log

结果需要管理员权限,所以再去:

➜  dist sudo npm install -g gulp
Password:
npm WARN deprecated graceful-fs@3.0.8: 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.
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated lodash@1.0.2: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.
npm WARN deprecated graceful-fs@1.2.3: 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.
/usr/local/bin/gulp -> /usr/local/lib/node_modules/gulp/bin/gulp.js
gulp@3.9.1 /usr/local/lib/node_modules/gulp
├── interpret@1.0.1
├── pretty-hrtime@1.0.2
├── deprecated@0.0.1
├── archy@1.0.0
├── minimist@1.2.0
├── semver@4.3.6
├── tildify@1.2.0 (os-homedir@1.0.1)
├── v8flags@2.0.11 (user-home@1.1.1)
├── chalk@1.1.3 (supports-color@2.0.0, ansi-styles@2.2.1, escape-string-regexp@1.0.5, has-ansi@2.0.0, strip-ansi@3.0.1)
├── orchestrator@0.3.7 (sequencify@0.0.7, stream-consume@0.1.0, end-of-stream@0.1.5)
├── vinyl-fs@0.3.14 (graceful-fs@3.0.8, vinyl@0.4.6, defaults@1.0.3, strip-bom@1.0.0, mkdirp@0.5.1, through2@0.6.5, glob-stream@3.1.18, glob-watcher@0.0.6)
├── liftoff@2.3.0 (lodash.isstring@4.0.1, lodash.isplainobject@4.0.5, lodash.mapvalues@4.5.1, extend@3.0.0, rechoir@0.6.2, flagged-respawn@0.3.2, resolve@1.1.7, fined@1.0.1, findup-sync@0.4.2)
└── gulp-util@3.0.7 (array-differ@1.0.0, lodash._reescape@3.0.0, object-assign@3.0.0, lodash._reevaluate@3.0.0, beeper@1.1.0, lodash._reinterpolate@3.0.0, array-uniq@1.0.3, replace-ext@0.0.1, has-gulplog@0.1.0, gulplog@1.0.0, fancy-log@1.2.0, vinyl@0.5.3, lodash.template@3.6.2, multipipe@0.1.2, through2@2.0.1, dateformat@1.0.12)

即可。

然后去试试:

gulp server

结果报错:

Local gulp not found in ~/dev/dev_root/daryun/JianDaoWeixin/sourcecode/UIDemo/JiandaoWorkbench/F7/bower_components/Framework7
[15:32:41] Try running: npm install gulp

搜:

Local gulp not found in Try running npm install gulp

javascript – Why do we need to install gulp globally and locally? – Stack Overflow

linux – No local gulp install found even after installing npm install -g gulp – Stack Overflow

gulp/getting-started.md at master · gulpjs/gulp

➜  Framework7 npm install –save-dev gulp
npm WARN deprecated graceful-fs@3.0.8: 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.
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated lodash@1.0.2: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.
npm WARN deprecated graceful-fs@1.2.3: 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.
gulp@3.9.1 node_modules/gulp
├── interpret@1.0.1
├── pretty-hrtime@1.0.2
├── deprecated@0.0.1
├── archy@1.0.0
├── minimist@1.2.0
├── semver@4.3.6
├── tildify@1.2.0 (os-homedir@1.0.1)
├── v8flags@2.0.11 (user-home@1.1.1)
├── chalk@1.1.3 (ansi-styles@2.2.1, supports-color@2.0.0, escape-string-regexp@1.0.5, strip-ansi@3.0.1, has-ansi@2.0.0)
├── orchestrator@0.3.7 (stream-consume@0.1.0, sequencify@0.0.7, end-of-stream@0.1.5)
├── vinyl-fs@0.3.14 (graceful-fs@3.0.8, strip-bom@1.0.0, defaults@1.0.3, vinyl@0.4.6, mkdirp@0.5.1, through2@0.6.5, glob-stream@3.1.18, glob-watcher@0.0.6)
├── liftoff@2.3.0 (lodash.isplainobject@4.0.5, lodash.isstring@4.0.1, lodash.mapvalues@4.5.1, rechoir@0.6.2, extend@3.0.0, flagged-respawn@0.3.2, resolve@1.1.7, findup-sync@0.4.2, fined@1.0.1)
└── gulp-util@3.0.7 (array-differ@1.0.0, beeper@1.1.0, lodash._reinterpolate@3.0.0, array-uniq@1.0.3, object-assign@3.0.0, lodash._reevaluate@3.0.0, lodash._reescape@3.0.0, replace-ext@0.0.1, has-gulplog@0.1.0, fancy-log@1.2.0, vinyl@0.5.3, gulplog@1.0.0, lodash.template@3.6.2, multipipe@0.1.2, through2@2.0.1, dateformat@1.0.12)

看到本地文件夹中多了:

node_modules

➜  Framework7 ll
total 192
-rw-r–r–   1 crifan  staff    67K  8  4 11:48 CHANGELOG.md
-rw-r–r–   1 crifan  staff   1.1K  8  4 11:48 LICENSE
-rw-r–r–   1 crifan  staff   3.6K  8  4 11:48 README.md
-rw-r–r–   1 crifan  staff   814B  8  4 11:48 bower.json
-rw-r–r–   1 crifan  staff   879B  8  4 11:48 composer.json
drwxr-xr-x  10 crifan  staff   340B  8  5 15:15 dist
drwxr-xr-x   7 crifan  staff   238B  8  4 11:48 examples
-rw-r–r–   1 crifan  staff   3.9K  8  4 11:48 index.html
drwxr-xr-x  82 crifan  staff   2.7K  8  4 11:48 kitchen-sink-ios
drwxr-xr-x  88 crifan  staff   2.9K  8  4 11:48 kitchen-sink-material
-rw-r–r–   1 crifan  staff   7.7K  8  4 11:48 modules.json
drwxr-xr-x   4 crifan  staff   136B  8  5 15:39 node_modules
drwxr-xr-x   7 crifan  staff   238B  8  4 11:48 src
➜  Framework7 ll node_modules
total 0
drwxr-xr-x  12 crifan  staff   408B  8  5 15:39 gulp
➜  Framework7 ll node_modules/gulp/
total 56
-rw-r–r–   1 crifan  staff   5.6K  2  1  2016 CHANGELOG.md
-rw-r–r–   1 crifan  staff   1.1K  2  1  2016 LICENSE
-rw-r–r–   1 crifan  staff   3.9K  2  9 02:32 README.md
drwxr-xr-x   3 crifan  staff   102B  2  1  2016 bin
drwxr-xr-x   7 crifan  staff   238B  8  5 15:38 completion
-rw-r–r–   1 crifan  staff   2.0K  2  9 02:50 gulp.1
-rw-r–r–   1 crifan  staff   1.5K  2  1  2016 index.js
drwxr-xr-x   4 crifan  staff   136B  8  5 15:38 lib
drwxr-xr-x  16 crifan  staff   544B  8  5 15:39 node_modules
-rw-r–r–   1 crifan  staff   2.7K  8  5 15:38 package.json

然后去运行,结果出错:

➜  Framework7 gulp server         
[15:43:38] No gulpfile found

转载请注明:在路上 » [记录]安装和使用gulp

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
92 queries in 0.187 seconds, using 23.31MB memory