Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken on npm 6.6.0 #183

Closed
Abrahamic-God opened this issue Jan 23, 2019 · 4 comments
Closed

Broken on npm 6.6.0 #183

Abrahamic-God opened this issue Jan 23, 2019 · 4 comments

Comments

@Abrahamic-God
Copy link

Hello again! 馃憢

It seems that npm 6.6.0 has some incompatibility with bower-npm-resolver. Here's the error output I receive:

bower nodecg-obs-scene#^4.0.0                                             error Cannot convert undefined or null to object
Stack trace:
TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at getLastKey (C:\projects\nodecg-starcraft\node_modules\bower-npm-resolver\dist\npm-utils.js:255:21)
    at C:\projects\nodecg-starcraft\node_modules\bower-npm-resolver\dist\npm-utils.js:284:31
    at _fulfilled (C:\projects\nodecg-starcraft\node_modules\q\q.js:854:54)
    at self.promiseDispatch.done (C:\projects\nodecg-starcraft\node_modules\q\q.js:883:30)
    at Promise.promise.promiseDispatch (C:\projects\nodecg-starcraft\node_modules\q\q.js:816:13)
    at C:\projects\nodecg-starcraft\node_modules\q\q.js:624:44
    at runSingle (C:\projects\nodecg-starcraft\node_modules\q\q.js:137:13)
    at flush (C:\projects\nodecg-starcraft\node_modules\q\q.js:125:13)
    at _combinedTickCallback (internal/process/next_tick.js:132:7)
    at process._tickCallback (internal/process/next_tick.js:181:9)
Console trace:
Error
    at StandardRenderer.error (C:\Users\appveyor\AppData\Roaming\npm\node_modules\bower\lib\renderers\StandardRenderer.js:88:37)
    at Logger.<anonymous> (C:\Users\appveyor\AppData\Roaming\npm\node_modules\bower\lib\bin\bower.js:113:30)
    at emitOne (events.js:116:13)
    at Logger.emit (events.js:211:7)
    at Logger.emit (C:\Users\appveyor\AppData\Roaming\npm\node_modules\bower\lib\node_modules\bower-logger\lib\Logger.js:29:39)
    at C:\Users\appveyor\AppData\Roaming\npm\node_modules\bower\lib\commands\index.js:49:24
    at _rejected (C:\Users\appveyor\AppData\Roaming\npm\node_modules\bower\lib\node_modules\q\q.js:864:24)
    at C:\Users\appveyor\AppData\Roaming\npm\node_modules\bower\lib\node_modules\q\q.js:890:30
    at Promise.when (C:\Users\appveyor\AppData\Roaming\npm\node_modules\bower\lib\node_modules\q\q.js:1142:31)
    at Promise.promise.promiseDispatch (C:\Users\appveyor\AppData\Roaming\npm\node_modules\bower\lib\node_modules\q\q.js:808:41)
    at C:\Users\appveyor\AppData\Roaming\npm\node_modules\bower\lib\node_modules\q\q.js:624:44
    at runSingle (C:\Users\appveyor\AppData\Roaming\npm\node_modules\bower\lib\node_modules\q\q.js:137:13)
    at flush (C:\Users\appveyor\AppData\Roaming\npm\node_modules\bower\lib\node_modules\q\q.js:125:13)
    at _combinedTickCallback (internal/process/next_tick.js:132:7)
    at process._tickCallback (internal/process/next_tick.js:181:9)
System info:
Bower version: 1.8.7
Node version: 8.12.0
OS: Windows_NT 10.0.14393 x64
Command exited with code 1
@mjeanroy
Copy link
Owner

Hi @lange,
Sorry for the delay, do you have a reproducible test case available?
Thanks for the report (and many thanks for the system info!).

@dsechin
Copy link

dsechin commented Feb 6, 2019

Hi @mjeanroy I was able to reproduce the same error while trying to install npm:simplebar#3.1.0-beta.3.

I've looked at the trace & modified execViewCommand inside npm-utils.js slightly (console.log):

function execViewCommand(args) {
  return execNpm(function (meta, deferred) {
    npm.commands.view(args, true, function (err, data) {
      console.log(args, err, data);
      if (err) {
        deferred.reject(err);
      } else {
        deferred.resolve(data);
      }
    });
  });
}

For npm >= 6.6.0 if the second argument passed to the npm.commands.view
is true (silent run) -- err === null & data === undefined, but if it is false everything works ok.

I don't know what changes in the npm cause this.

@mjeanroy
Copy link
Owner

Hi,

Thanks @dsechin, you're right: when silent parameter is false, everything works fine (but we get a dirty message to the console...). This is due to the fact that, starting with npm 6.6.0, when silent is true, nothing is returned by the view command (you can see it here: https://github.com/npm/cli/blob/bb8688d5aba998bcdbcd33ee0508dad8a9ec2278/lib/view.js#L187).

For me, it looks like a bug in npm cli, I posted a message to the support forum to understand, you can see it here: https://npm.community/t/cannot-use-npm-view-command-programmatically/5455.

I'm still thinking how to fix this, for now I don't have a better idea than switching silent flag to false.

@mjeanroy
Copy link
Owner

mjeanroy commented Mar 2, 2019

@dsechin @lange It should have been fixed with version 0.10.0. Please, let me know if something does not work ;)

@mjeanroy mjeanroy closed this as completed Mar 2, 2019
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

No branches or pull requests

3 participants