sindresorhus / gulp-zip

ZIP compress files
MIT License
270 stars 47 forks source link

Error [ERR_UNSUPPORTED_DIR_IMPORT] #124

Closed jcpc91 closed 3 weeks ago

jcpc91 commented 3 weeks ago

i get error when i am using this package i create a directory call gulpfile.js(https://gulpjs.com/docs/en/getting-started/javascript-and-gulpfiles) inside i put a index.js file with this code //index.js const { series, src, dest } = require('gulp'); const zip = require('gulp-zip'); function zipdist(cb) { return src('dist') .pipe(zip('webserver.zip')) .pipe(dest('/documentos'))

} exports.default = series(zipdist);

execute command node_modules/.bin/gulp

i get this error Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '/workspaces/express1/gulpfile.js' is not supported resolving ES modules imported from /workspaces/express1/node_modules/gulp-cli/lib/shared/require-or-import.js Did you mean to import "/workspaces/express1/gulpfile.js/index.js"? at finalizeResolution (node:internal/modules/esm/resolve:251:11) at moduleResolve (node:internal/modules/esm/resolve:914:10) at defaultResolve (node:internal/modules/esm/resolve:1039:11) at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:554:12) at ModuleLoader.resolve (node:internal/modules/esm/loader:523:25) at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38) at onImport.tracePromise.proto (node:internal/modules/esm/loader:481:36) at TracingChannel.tracePromise (node:diagnostics_channel:337:14) at ModuleLoader.import (node:internal/modules/esm/loader:480:21) at defaultImportModuleDynamicallyForScript (node:internal/modules/esm/utils:227:31) { code: 'ERR_UNSUPPORTED_DIR_IMPORT', url: 'file:///workspaces/express1/gulpfile.js'

sindresorhus commented 3 weeks ago

https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c