Gulp5: `gulpfile.ts` Not Found, `gulpfile.js` AOK
- Dominant language
- JavaScript
- Stars
- 32.9k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
Before you open this issue, please complete the following tasks:
* [x] use the search bar at the top of the page to search this repository for similar issues or discussions that have already been opened.
* [X] if you are looking for help from the gulp team or community, open a [discussion](https://github.com/gulpjs/gulp/discussions).
* [X] if you think there is a problem with the plugin you're using, open a [discussion](https://github.com/gulpjs/gulp/discussions).
* [X] if you think there is a bug in our code, open this issue.
### What were you expecting to happen?
With the following packages installed eith as Globals or DevDependencies:
- Global
- gulp-cli@3.0.0
- Local
- @types/gulp@4.0.17
- gulp-typescript@6.0.0-alpha.1
- gulp@5.0.0
- ts-node@10.9.2
- typescript@5.8.2
I expect the below gulpfile.ts/index.ts to run.
**Note:** Not using a specific `tsconfig.json` file because from the TS-Node Documentation: `If no tsconfig.json is loaded from disk, ts-node will use the newest recommended defaults from [@tsconfig/bases](https://github.com/tsconfig/bases/) compatible with your node and typescript versions.`.
### What actually happened?
The following error is produced:
~~~
duluxoz@work_box:/my_project $ > gulp
Error: Cannot find module '/my_project/gulpfile.ts'
Require stack:
- /nvm/versions/node/v23.8.0/lib/node_modules/gulp-cli/lib/shared/require-or-import.js
- /nvm/versions/node/v23.8.0/lib/node_modules/gulp-cli/lib/versioned/^5.0.0/index.js
- /nvm/versions/node/v23.8.0/lib/node_modules/gulp-cli/index.js
- /nvm/versions/node/v23.8.0/lib/node_modules/gulp-cli/bin/gulp.js
at Function._resolveFilename (node:internal/modules/cjs/loader:1405:15)
at defaultResolveImpl (node:internal/modules/cjs/loader:1061:19)
at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1066:22)
at Function._load (node:internal/modules/cjs/loader:1215:37)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
at Module.require (node:internal/modules/cjs/loader:1491:12)
at require (node:internal/modules/helpers:135:16)
at requireOrImport (/nvm/versions/node/v23.8.0/lib/node_modules/gulp-cli/lib/shared/require-or-import.js:20:11)
at execute (/nvm/versions/node/v23.8.0/lib/node_modules/gulp-cli/lib/versioned/^5.0.0/index.js:35:3) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/nvm/versions/node/v23.8.0/lib/node_modules/gulp-cli/lib/shared/require-or-import.js',
'/nvm/versions/node/v23.8.0/lib/node_modules/gulp-cli/lib/versioned/^5.0.0/index.js',
'/nvm/versions/node/v23.8.0/lib/node_modules/gulp-cli/index.js',
'/nvm/versions/node/v23.8.0/lib/node_modules/gulp-cli/bin/gulp.js'
]
}
~~~
### Please give us a sample of your gulpfile
~~~
"use strict";
import gulp from "gulp";
export default gulp.parallel(
fpPDFTask("common"),
fpPDFTask(www)
);
function fpPDFTask(sDir:string){
return async function(){
gulp.src("dev/pdfs/"+sDir+"/*.pdf")
.pipe(gulp.dest("test/pdfs/"+sDir+"/"));
};
};
~~~
### Terminal output / screenshots
As above (ie the "Error")
### Please provide the following information:
* OS & version: Rocky Linux v9.5
* node version: v23.8.0
* npm version: 11.2.0
* gulp version: CLI version: 3.0.0, Local version: 5.0.0
### Additional information
When the above `gulpfile.ts/index.ts` are renamed `gulpfile.js/index.js` (and the `sDir:string` is changed to `sDir`) everything works AOK.
Happy to be shown this is *not* a bug (in Gulp) but is a config error on my part or an issue in (for eg) TS-Node, etc.
Thanks
Dulux-Oz
Contributor guide
Assessment
This issue has not been assessed yet.