Skip to content

repl require() broken in iojs 2.x #1633

Description

@isaacs

No longer acts as if it's a module in cwd. This is really annoying.

$ npm ls ini
npmconf@2.1.1 /Users/isaacs/dev/npm/npmconf
├─┬ config-chain@1.1.8
│ └── ini@1.3.0
└── ini@1.3.3


$ node -p "require('ini')"
{ decode: [Function: decode],
  parse: [Function: decode],
  encode: [Function: encode],
  stringify: [Function: encode],
  safe: [Function: safe],
  unsafe: [Function: unsafe] }

$ node
> process.version
'v2.0.0'
> require("ini")
Error: Cannot find module 'ini'
    at Function.Module._resolveFilename (module.js:337:15)
    at Function.Module._load (module.js:287:25)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at repl:1:1
    at REPLServer.defaultEval (repl.js:141:27)
    at bound (domain.js:254:14)
    at REPLServer.runBound [as eval] (domain.js:267:12)
    at REPLServer.<anonymous> (repl.js:295:12)
    at emitOne (events.js:77:13)
>

# expected behavior:
$ nave use 1.8.1
Already installed: 1.8.1
using 1.8.1

$ node
> process.version
'v1.8.1'
> require('ini')
{ decode: [Function: decode],
  parse: [Function: decode],
  encode: [Function: encode],
  stringify: [Function: encode],
  safe: [Function: safe],
  unsafe: [Function: unsafe] }

Probably one of the recent changes to lib/repl.js or lib/module.js.

Activity

  1. isaacs commented on May 5, 2015

    @isaacs
    ContributorAuthor

    Nevermind, fixed in 2.0.1 apparently. Thanks.

  2. Fishrock123 commented on May 5, 2015

    @Fishrock123
    Contributor

    Shouldn't this be fixed in the release version of 2.0.0?

  3. Fishrock123 commented on May 5, 2015

    @Fishrock123
    Contributor

    I.e. fixes were in #605

  4. chrisdickinson commented on May 5, 2015

    @chrisdickinson
    Contributor

    Hm? I'm on v2.0.0 and it seems okay – fixes were in #1605, as @Fishrock123 notes.

  5. mcheshkov commented on Dec 17, 2015

    @mcheshkov

    I hit this with 5.2.0 from nodesource on kubuntu 15.10

    $ npm ls
    /home/cheshkov/repl
    └── ini@1.3.4
    
    $ node -p "require('ini')"
    { decode: [Function: decode],
      parse: [Function: decode],
      encode: [Function: encode],
      stringify: [Function: encode],
      safe: [Function: safe],
      unsafe: [Function: unsafe] }
    $ node
    > process.version
    'v5.2.0'
    > require('ini')
    Error: Cannot find module 'ini'
        at Function.Module._resolveFilename (module.js:327:15)
        at Function.Module._load (module.js:278:25)
        at Module.require (module.js:355:17)
        at require (internal/module.js:13:17)
        at repl:1:1
        at REPLServer.defaultEval (repl.js:252:27)
        at bound (domain.js:281:14)
        at REPLServer.runBound [as eval] (domain.js:294:12)
        at REPLServer.<anonymous> (repl.js:417:12)
        at emitOne (events.js:83:20)
    >
    

    UPD
    4.2.3 works fine

  6. evanlucas commented on Dec 17, 2015

    @evanlucas
    Contributor

    @mcheshkov The 5.2.0 issue was a different one. It has been fixed in v5.3.0 (https://nodejs.org/en/blog/release/v5.3.0/)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions