Skip to content

Conversation

chances
Copy link
Contributor

@chances chances commented Dec 30, 2020

According to the Portability documentation, I should be able to require("assemblyscript/std/portable") to make use of the portable standard library. However, Node crashes with the following error:

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './std/portable' is not defined by "exports" in /home/chances/GitHub/teraflop-d/source/scripting/api/node_modules/assemblyscript/package.json
    at applyExports (internal/modules/cjs/loader.js:487:9)
    at resolveExports (internal/modules/cjs/loader.js:503:23)
    at Function.Module._findPath (internal/modules/cjs/loader.js:631:31)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:949:27)
    at Function.Module._load (internal/modules/cjs/loader.js:838:27)
    at Module.require (internal/modules/cjs/loader.js:1022:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/home/chances/GitHub/teraflop-d/source/scripting/api/lib/index.js:4:1)
    at Module._compile (internal/modules/cjs/loader.js:1118:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1138:10) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}

Reproduction steps:

With Node.js v13.14.0

  1. In an empty folder, run npm install assemblyscript
  2. Run the node REPL
  3. Execute require("assemblyscript/std/portable")
  4. Observe above error

Resolution

Adding std/portable to the list of exports resolves the issue.


  • I've read the contributing guidelines

@chances chances marked this pull request as ready for review December 30, 2020 05:07
@dcodeIO dcodeIO merged commit 2a35b82 into AssemblyScript:master Jan 30, 2021
@dcodeIO
Copy link
Member

dcodeIO commented Jan 30, 2021

Thank you! :)

@chances chances deleted the export-portable-stdlib branch January 30, 2021 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants