I have migrated a project from Bower and NPM to Yarn. When implementing the mainYarnFiles library (previous incarnation of the project used mainBowerFiles) this code (executed in gulp.js):
var yarnOptions = {
path: {
checkExistence: true,
modulesFolder: '../node_modules/@bower_components',
jsonFile: '../package.json'
}
}
console.log(mainYarnFiles(yarnOptions))
Throws this error:
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
at validateString (internal/validators.js:125:11)
at Object.resolve (path.js:161:7)
I believe this is because I have not correctly populated the yarnOptions object (above). Is this correct or have I got something wrong with the packages I'm trying to reference?
This is my package.json file:
{
"name": "project",
"version": "1.0.0",
"description": "project description",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"Project"
],
"author": "Me",
"license": "ISC",
"devDependencies": {
"del": "^2.2.2",
"eslint-config-angular": "^0.5.0",
"eslint-plugin-angular": "^1.5.0",
"file-saver": "^1.2.0",
"gulp": "^3.9.1",
"gulp-angular-filesort": "^1.1.1",
"gulp-angular-templatecache": "^2.0.0",
"gulp-autoprefixer": "^3.1.1",
"gulp-cheerio": "^0.6.2",
"gulp-clean-css": "^2.2.2",
"gulp-concat": "^2.6.1",
"gulp-eslint": "^3.0.1",
"gulp-filter": "^4.0.0",
"gulp-flatten": "^0.3.1",
"gulp-htmlmin": "^3.0.0",
"gulp-if": "^2.0.2",
"gulp-inject": "^4.1.0",
"gulp-ng-annotate": "^2.0.0",
"gulp-rev": "^7.1.2",
"gulp-sass": "^3.0.0",
"gulp-sourcemaps": "^1.9.1",
"gulp-string-replace": "^0.3.1",
"gulp-uglify": "^2.0.0",
"natives": "^1.1.6",
"require-dir": "^0.3.1",
"rimraf": "^2.6.2",
"stream-series": "^0.1.1",
"uglify-save-license": "^0.4.1",
"yargs": "^6.5.0"
},
"dependencies": {
"@bower_components/angular": "angular/bower-angular#1.6.0",
"@bower_components/angular-animate": "angular/bower-angular-animate#1.6.0",
"@bower_components/angular-bootstrap": "angular-ui/bootstrap-bower#2.5.0",
"@bower_components/angular-bootstrap-slider": "seiyria/angular-bootstrap-slider#^0.1.28",
"@bower_components/angular-cache": "jmdobry/angular-cache#^4.6.0",
"@bower_components/angular-confirm-modal": "Schlogen/angular-confirm#^1.2.6",
"@bower_components/angular-dynamic-locale": "lgalfaso/angular-dynamic-locale#0.1.32",
"@bower_components/angular-i18n": "angular/bower-angular-i18n#1.6.0",
"@bower_components/angular-moment": "urish/angular-moment#^1.0.1",
"@bower_components/angular-translate": "PascalPrecht/bower-angular-translate#2.13.1",
"@bower_components/angular-translate-loader-url": "PascalPrecht/bower-angular-translate-loader-url#2.13.1",
"@bower_components/angular-ui-router": "angular-ui/angular-ui-router-bower#^0.4.2",
"@bower_components/angular-ui-router-uib-modal": "nonplus/angular-ui-router-uib-modal#^0.0.11",
"@bower_components/angular-ui-validate": "angular-ui/ui-validate#^1.2.2",
"@bower_components/c3": "masayuki0812/c3#0.4.11",
"@bower_components/d3": "mbostock-bower/d3-bower#3.5.17",
"@bower_components/lodash": "lodash/lodash#^4.17.4",
"@bower_components/moment": "moment/moment#^2.29.3",
"@bower_components/seiyria-bootstrap-slider": "seiyria/bootstrap-slider#^11.0.2",
"bower": "^1.8.4",
"bower-away": "^1.1.2",
"main-yarn-files": "^3.0.4"
},
"engines": {
"yarn": ">= 1.0.0"
}
}
I was correct: the options object contained
pathinstead ofpath(as described in the documentation) and needed paths correcting: