LoginSignup
1
2

More than 3 years have passed since last update.

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

Posted at

すでにある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
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2