我有一个包含此gulpfile.js的gulp文件夹
const source = require('vinyl-source-stream');
const gulp = require('gulp');
module.exports = function(args) {
gulp.task('default', function() {});
}我有一个包含此gulpfile.js的project文件夹
const projectGulp = require('../gulp/gulpfile.js')
projectGulp();在project文件夹中,我有一个添加了vinyl-source-stream的package.json作为开发依赖项,现在我在这个文件夹上运行yarn install。
当我运行gulp时,我得到了Cannot find module vinyl-source-stream错误。
如果我对gulp文件夹执行,然后执行yarn install vinyl-source-stream,它工作得很好。现在我得到了Task default is not in your gulpfile错误。
发布于 2019-04-14 19:44:08
我建议您执行以下操作:
$ yarn install --check-files--check-files标志验证是否没有从node_modules文件夹中删除包。(参见yarn documentation)。
如果它不起作用,你应该尝试:
$ rm -rf ./node_modules/
$ npm cache clean
$ npm install然后可能会看看vinyl-source-stream是否在它应该在的位置:
$ ls ./node_modules/vinyl-source-stream因为我主要在Windows上工作,所以我遇到了每一个可能的yarn错误。我曾经遇到过与this类似的问题,这就是简单地删除所有东西并调用npm提供帮助的情况。Yarn有时找不到依赖项的缺失,特别是在吞咽的时候。
https://stackoverflow.com/questions/55674623
复制相似问题