Error

node:internal/modules/cjs/loader:1148 throw err; ^ Error: Cannot find module './lib/arrayStrictEquals.mjs'
43 Replies
UndiedGFX
UndiedGFX6mo ago
there is no file called './lib/arrayStrictEquals.mjs'
Baylem
Baylem6mo ago
This may have something to do with the recent Shapeshift or Utilities update as I started getting this error as well after updating some versions in my package.json
UndiedGFX
UndiedGFX6mo ago
we might need the full error stack upon this one tho as you're on it, mind sending the full stack and file contents of node_modules/@sapphire/shapeshift?
Baylem
Baylem6mo ago
> discord-rewrite@1.0.0 start
> node dist/index.js

node:internal/modules/cjs/loader:1147
throw err;
^

Error: Cannot find module './lib/arrayStrictEquals.mjs'

Error: Cannot find module './lib/arrayStrictEquals.mjs'
Require stack:
- C:\Users\Dev\WebstormProjects\discord-rewrite\node_modules\@sapphire\utilities\dist\cjs\index.cjs
- C:\Users\Dev\WebstormProjects\discord-rewrite\dist\lib\util\times.js
- C:\Users\Dev\WebstormProjects\discord-rewrite\dist\lib\constants.js
- C:\Users\Dev\WebstormProjects\discord-rewrite\dist\lib\extensions\CustomClient.js
- C:\Users\Dev\WebstormProjects\discord-rewrite\dist\index.js
> discord-rewrite@1.0.0 start
> node dist/index.js

node:internal/modules/cjs/loader:1147
throw err;
^

Error: Cannot find module './lib/arrayStrictEquals.mjs'

Error: Cannot find module './lib/arrayStrictEquals.mjs'
Require stack:
- C:\Users\Dev\WebstormProjects\discord-rewrite\node_modules\@sapphire\utilities\dist\cjs\index.cjs
- C:\Users\Dev\WebstormProjects\discord-rewrite\dist\lib\util\times.js
- C:\Users\Dev\WebstormProjects\discord-rewrite\dist\lib\constants.js
- C:\Users\Dev\WebstormProjects\discord-rewrite\dist\lib\extensions\CustomClient.js
- C:\Users\Dev\WebstormProjects\discord-rewrite\dist\index.js
UndiedGFX
UndiedGFX6mo ago
PS: this could be because djs haven't updated to latest shapeshift
Baylem
Baylem6mo ago
that was my stack
UndiedGFX
UndiedGFX6mo ago
i think its not shapeshift its utilities
Baylem
Baylem6mo ago
Yeah
UndiedGFX
UndiedGFX6mo ago
@Baylem can you cat this file for me? C:\Users\Dev\WebstormProjects\discord-rewrite\node_modules@sapphire\utilities\dist\cjs\index.cjs
Baylem
Baylem6mo ago
In webstorm its just at the very top on dist/cjs/index.cjs
'use strict';

var arrayStrictEquals_mjs = require('./lib/arrayStrictEquals.mjs');
var cast_mjs = require('./lib/cast.mjs');
var chunk_mjs = require('./lib/chunk.mjs');
var classExtends_mjs = require('./lib/classExtends.mjs');
'use strict';

var arrayStrictEquals_mjs = require('./lib/arrayStrictEquals.mjs');
var cast_mjs = require('./lib/cast.mjs');
var chunk_mjs = require('./lib/chunk.mjs');
var classExtends_mjs = require('./lib/classExtends.mjs');
when I click the reference
UndiedGFX
UndiedGFX6mo ago
does node_modules@sapphire\utilities\dist\cjs\lib\arrayStrictEquals.mjs exist?
Baylem
Baylem6mo ago
just this
UndiedGFX
UndiedGFX6mo ago
iirc @Favna you broke shit, even the ci was failing in the lastest push there is a temporary workaround, change all the .mjs in imports to .cjs looking at the files in 3.15.2 all the imports are .cjs but its not in 3.16
Baylem
Baylem6mo ago
Find and Replace All my savior :prayge: nah its all broken i fix one file another pops up fix that one another pops up this one is
UndiedGFX
UndiedGFX6mo ago
@eX you have to open node_modules@sapphire\utilities\dist\cjs\index.cjs then replace all .mjs with .cjs until they fix it
Baylem
Baylem6mo ago
dist\cjs\lib\cutText
'use strict';

var splitText_mjs = require('./splitText.mjs');
'use strict';

var splitText_mjs = require('./splitText.mjs');
UndiedGFX
UndiedGFX6mo ago
i'm trying to see where this bug landed
Baylem
Baylem6mo ago
dist\cjs\lib\deepClone.mjs
'use strict';

var isPrimitive_mjs = require('./isPrimitive.mjs');
'use strict';

var isPrimitive_mjs = require('./isPrimitive.mjs');
yeah it just keeps going
UndiedGFX
UndiedGFX6mo ago
@Baylem i believe there was a flag that would interop cjs and mjs in nodejs right? try using that?
Baylem
Baylem6mo ago
dist\cjs\index.cjs dist\cjs\lib\cutText dist\cjs\lib\deepClone dist\cjs\lib\filterNullAndUndefined dist\cjs\lib\filterNullAndUndefinedAndEmpty ... list goes on yeah I'm gonna use that instead of doing this, idk how many there will be
UndiedGFX
UndiedGFX6mo ago
what was the flag?
Baylem
Baylem6mo ago
I think its --experimental-modules i havent tried yet
UndiedGFX
UndiedGFX6mo ago
try and tell me if your bot runs now
Baylem
Baylem6mo ago
Yeah no that flag doesn't work becuase you have to change type: module and that breaks everything else
UndiedGFX
UndiedGFX6mo ago
@Baylem i think its --experimental-require-module
Baylem
Baylem6mo ago
oh right
UndiedGFX
UndiedGFX6mo ago
no s lmk if that works
Baylem
Baylem6mo ago
nah --experimental-modules does run but runs into the same mjs import error --experimental-require-module doesn't exist
UndiedGFX
UndiedGFX6mo ago
If --experimental-require-module is enabled, and the ECMAScript module being loaded by require() meets the following requirements:

The module is fully synchronous (contains no top-level await); and
One of these conditions are met:
The file has a .mjs extension.
The file has a .js extension, and the closest package.json contains "type": "module"
The file has a .js extension, the closest package.json does not contain "type": "commonjs", and --experimental-detect-module is enabled.
If --experimental-require-module is enabled, and the ECMAScript module being loaded by require() meets the following requirements:

The module is fully synchronous (contains no top-level await); and
One of these conditions are met:
The file has a .mjs extension.
The file has a .js extension, and the closest package.json contains "type": "module"
The file has a .js extension, the closest package.json does not contain "type": "commonjs", and --experimental-detect-module is enabled.
weird node 22?
Baylem
Baylem6mo ago
I'm running v20 , so that might be a 22 thing I was running LTS I'll update node
UndiedGFX
UndiedGFX6mo ago
that flag was released like 2 months ago
Baylem
Baylem6mo ago
ah ok makes sense this project is on an older node version Dumb question but for a production level project, should I go ahead and update to 22? I was only staying on 20 for LTS
UndiedGFX
UndiedGFX6mo ago
if you want to update to 22 only to use the flag, better not favna broke something in his esbuild plugin
Baylem
Baylem5mo ago
Yeah I'll just wait on Favna p sure favna will see this, but should I go ahead and open a github issue? @UndiedGFX
UndiedGFX
UndiedGFX5mo ago
might not be necessary
Favna
Favna5mo ago
Dafuq happened :dragonwhat: For now set your resolutions to utilities 3.15.x I guess
Spinel
Spinel5mo ago
npm npm doesn't have anything to update transient dependencies so you'll have to provide overrides. In your package.json:
{
"overrides": {
"package-name-here": "version"
}
}
{
"overrides": {
"package-name-here": "version"
}
}
Then run npm install. You can verify the change by checking your package-lock.json Yarn v1 Yarn v1 (deprecated, recommend updating to v4 (see /tag query:yarnv4 ) does not have a way to update transient dependencies so a similar strategy is required as npm: In your package.json:
{
"resolutions": {
"package-name-here": "version"
}
}
{
"resolutions": {
"package-name-here": "version"
}
}
Then run yarn install. You can verify the change by checking your yarn.lock Yarn v4 Yarn v4 can update transient dependencies so run the command:
yarn up -R package-name-here
yarn up -R package-name-here
pnpm pnpm can also update transient dependencies so run the command:
pnpm --recursive update package-name-here@version
pnpm --recursive update package-name-here@version
Favna
Favna5mo ago
Ignore the whole update thing there
UndiedGFX
UndiedGFX5mo ago
@eX @Baylem issue solved in 3.16.1
Baylem
Baylem5mo ago
Thanks
eX
eX5mo ago
@UndiedGFX@Baylem 3.16.1 sapphire ?
UndiedGFX
UndiedGFX5mo ago
@sapphire/utilities
eX
eX5mo ago
Damn it! Its work
Want results from more Discord servers?
Add your server