This repository has been archived by the owner on Feb 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
ERR_PACKAGE_PATH_NOT_EXPORTED #4127
Labels
need/triage
Needs initial labeling and prioritization
Comments
我在使用ipfs-core这个库时遇到了同样的问题,我的解决办法是降低库的版本 |
Same error here, test.ts import {create} from 'ipfs-core'
create().then((ipfs) => {
ipfs.add('Hello world').then((cid) => {
console.info(cid)
})
}) package.json {
"scripts": {
"test": "ts-node test.ts"
},
"devDependencies": {
"@types/cors": "^2.8.12",
"@types/express": "^4.17.13",
"@types/node": "^17.0.41",
"@types/orbit-db": "github:orbitdb/orbit-db-types",
"ipfs-core-types": "^0.11.0",
"ts-node": "^10.8.1",
"tsconfig-paths": "^4.0.0",
"tsup": "^6.1.0",
"typescript": "^4.7.3",
"npm-check-updates":"^13.1.2"
},
"dependencies": {
"cors": "^2.8.5",
"express": "^4.18.1",
"orbit-db": "^0.28.6",
"ipfs-core":"^0.15.1"
},
"engines": {
"node": "16.x"
}
} tsconfig.json {
"compilerOptions": {
"baseUrl": ".",
"target": "es2017",
"module": "CommonJS",
"lib": [
"esnext"
],
"moduleResolution": "node",
"esModuleInterop": true,
"strict": true,
"noEmit": true,
"strictNullChecks": true,
"resolveJsonModule": true,
"skipDefaultLibCheck": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"outDir": "./dist",
"strictPropertyInitialization": false,
"paths": {
"~/*": [
"./src/*"
],
"~~/*": [
"./*"
]
}
},
"ts-node": {
"require": ["tsconfig-paths/register"]
}
} orbitdb-server % npm run test
> test
> ts-node test.ts
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /Users/user/Development/orbitdb-server/node_modules/ipfs-core/package.json
at new NodeError (node:internal/errors:372:5)
at throwExportsNotFound (node:internal/modules/esm/resolve:472:9)
at packageExportsResolve (node:internal/modules/esm/resolve:693:7)
at resolveExports (node:internal/modules/cjs/loader:482:36)
at Function.Module._findPath (node:internal/modules/cjs/loader:522:31)
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue (/Users/user/Development/orbitdb-server/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
at Function.Module._resolveFilename (/Users/user/Development/orbitdb-server/node_modules/tsconfig-paths/src/register.ts:115:36)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
} |
my workaround is to modify ipfs-core/package.json "exports": {
".": "./src/index.js",
"./config/profiles": {
"import": "./src/components/config/profiles.js"
}
}, |
@ki4jgt : You'll need to update to use ESM. See https://github.com/ipfs/js-ipfs/blob/master/docs/upgrading/v0.62-v0.63.md#esm @eltorio : Please change your typescript configuration to produce ESM not CJS. |
@BigLep, I'm a little out of touch with that process. Can you show me how? I watched a video on YouTube, on importing, but with the node_modules folder, where am I pointing exactly? |
This was referenced Aug 19, 2022
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Version:
0.63.2
Platform:
Windows 11, 64-bit
Subsystem:
Severity:
Critical
Description:
I've been working on a project for months. Updated IPFS to the latest version, and now when I try to require it, I get this error.
Steps to reproduce the error:
The text was updated successfully, but these errors were encountered: