Help us understand the problem. What is going on with this article?

gulp環境をコピーした時の記録

すでにあるgulpの環境を
別のPCやディレクトリにも再構築した時の手順をメモします。

gulpのバージョンは
CLI version: 2.2.0
Local version: 4.0.2

作業手順

1.すでに使用している既存のpackage.json、gulpfile.jsを
 新規プロジェクトディレクトリにコピーします。
2.新規プロジェクトルートディレクトリにて
 npm installを実行(yarn install)

備考

gulp移行と同時にnpmからyarnに移行する際は
Package-lock.jsonからyarn-lock.jsonと
生成されるファイルが変わるので
.gitignoreなど適宜調整してください。

注意事項

※.globをインストール(npm i glob)している場合は
以下のプラグインが入っていると思うので
gulp-combine-media-queries/index.jsの
152行目付近の以下の部分をコメントアウトする

index.js
# file.contents = new Buffer(cssJson);

```

↑これをやらずに実行した時には↓のエラーが出た。
[vagrant@localhost example]$ npx gulp
[08:11:41] Using gulpfile /var/www/html/example.com/wp-content/themes/example/gulpfile.js
[08:11:41] Starting 'default'...
[08:11:41] Starting 'sass2'...
[08:11:42] File sass/ampstyle.css found.
[08:11:42] 'sass2' errored after 103 ms
[08:11:42] TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type object
    at Function.from (buffer.js:225:9)
    at new Buffer (buffer.js:175:17)
    at Transform.transform [as _transform] (/var/www/html/example.com/wp-content/themes/example/node_modules/gulp-combine-media-queries/index.js:152:21)
    at Transform._read (/var/www/html/example.com/wp-content/themes/example/node_modules/gulp-combine-media-queries/node_modules/readable-stream/lib/_stream_transform.js:184:10)
    at Transform._write (/var/www/html/example.com/wp-content/themes/example/node_modules/gulp-combine-media-queries/node_modules/readable-stream/lib/_stream_transform.js:172:12)
    at doWrite (/var/www/html/example.com/wp-content/themes/example/node_modules/gulp-combine-media-queries/node_modules/readable-stream/lib/_stream_writable.js:237:10)
    at writeOrBuffer (/var/www/html/example.com/wp-content/themes/example/node_modules/gulp-combine-media-queries/node_modules/readable-stream/lib/_stream_writable.js:227:5)
    at Transform.Writable.write (/var/www/html/example.com/wp-content/themes/example/node_modules/gulp-combine-media-queries/node_modules/readable-stream/lib/_stream_writable.js:194:11)
    at DestroyableTransform.ondata (/var/www/html/example.com/wp-content/themes/example/node_modules/readable-stream/lib/_stream_readable.js:619:20)
    at DestroyableTransform.emit (events.js:182:13)
[08:11:42] 'default' errored after 106 ms
Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away