Issue launching grunt after upgrading to Angular 16 due to locate-path versions
- Dominant language
- JavaScript
- Stars
- 12.2k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
After upgrading to Angular 16 we see this error
# grunt -h
Loading "gruntfile.js" tasks...ERROR
>> Error [ERR_REQUIRE_ESM]: require() of ES Module .../node_modules/locate-path/index.js from .../node_modules/pkg-up/node_modules/find-up/index.js not supported.
>> Instead change the require of .../node_modules/locate-path/index.js in .../nacd-ui/node_modules/pkg-up/node_modules/find-up/index.js to a dynamic import() which is available in all CommonJS modules.
Grunt: The JavaScript Task Runner (v1.6.1)
Angular uses locate-path 7.o and Grunt uses 3.0
Here is our tsconfig.json
{
"compileOnSave": false,
"compilerOptions": {
"importHelpers": true,
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"downlevelIteration": true,
"target": "ES2022",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"ES2022",
"dom"
],
"module": "ES2022",
"baseUrl": "./",
},
"angularCompilerOptions": {
"disableTypeScriptVersionCheck": true
}
}
Could you please take a look?
Thank you.
Contributor guide
Research direction
Start by reproducing `grunt -h` and reading `gruntfile.js`, `tsconfig.json`, and the reported `pkg-up/node_modules/find-up/index.js` dependency path. Check the Angular 16 and Grunt dependency versions involved in the `locate-path` conflict; done means Grunt launches without the ERR_REQUIRE_ESM failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, javascript
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100