Named export 'glob' not found.
yanickrochon opened this issue · 5 comments
yanickrochon commented
Using the most recent 5.0.5
, I get the following error with Node 20.10.0 :
file:///path/to/project/node_modules/rimraf/dist/esm/index.js:1
import { glob, globSync } from 'glob';
^^^^
SyntaxError: Named export 'glob' not found. The requested module 'glob' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from 'glob';
const { glob, globSync } = pkg;
at ModuleJob._instantiate (node:internal/modules/esm/module_job:132:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:214:5)
at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
at async loadESM (node:internal/process/esm_loader:34:7)
at async handleMainPromise (node:internal/modules/run_main:113:12)
Node.js v20.10.0
isaacs commented
What does npm ls rimraf glob
output?
yanickrochon commented
@isaacs here you go
devDependencies:
glob 10.3.10
rimraf 5.0.5
isaacs commented
No. Please run the actual command and copy and paste the entire output with the tree structure so I can see what got installed where.
npm ls rimraf glob
yanickrochon commented
The project I have is using a Turborepo with pnpm
. The output you wanted was giving many different glob
versions from various dependencies.
I manually deleted all node_modules
in the monorepo and reinstalled everything. It seems to have fixed it.
allprod commented
I'm having the same problem @isaacs . command output:
├─┬ @remix-run/dev@2.8.1
│ ├─┬ @npmcli/package-json@4.0.1
│ │ └── glob@10.3.10 deduped
│ └─┬ cacache@17.1.4
│ └── glob@10.3.10 deduped
├─┬ eslint@8.56.0
│ └─┬ file-entry-cache@6.0.1
│ └─┬ flat-cache@3.2.0
│ └─┬ rimraf@3.0.2
│ └── glob@7.2.3
├── glob@10.3.10
├─┬ remix-development-tools@3.7.1
│ └─┬ beautify@0.0.8
│ └─┬ js-beautify@1.14.11
│ └── glob@10.3.10 deduped
├─┬ tailwindcss@3.4.1
│ └─┬ sucrase@3.35.0
│ └── glob@10.3.10 deduped
├─┬ workbox-build@7.0.0 extraneous
│ └── glob@7.2.3 extraneous
└─┬ workbox-cli@7.0.0 extraneous
└── glob@7.2.3 extraneous