{"record":{"id":"c93cb24bf629ea96","repo":"jordansissel/fpm","slug":"npm-prefix-g-returned-unexpected-output","errorCode":null,"errorMessage":"`npm prefix -g` returned unexpected output.","messagePattern":"`npm prefix -g` returned unexpected output\\.","errorType":"exception","errorClass":"FPM::InvalidPackageConfiguration","httpStatus":null,"severity":"error","filePath":"lib/fpm/package/npm.rb","lineNumber":111,"sourceCode":"    #\n    # To that end, I don't think we necessarily need to include\n    # any automatic dependency information since every 'npm install'\n    # is fully self-contained. That's why you don't see any bother, yet,\n    # to include the package's dependencies in here.\n    #\n    # It's possible someone will want to decouple that in the future,\n    # but I will wait for that feature request.\n  end\n\n  def set_default_prefix\n    attributes[:prefix] = self.class.default_prefix\n    attributes[:prefix_given?] = true\n  end\n\n  def self.default_prefix\n    npm_prefix = safesystemout(\"npm\", \"prefix\", \"-g\").chomp\n    if npm_prefix.count(\"\\n\") > 0\n      raise FPM::InvalidPackageConfiguration, \"`npm prefix -g` returned unexpected output.\"\n    elsif !File.directory?(npm_prefix)\n      raise FPM::InvalidPackageConfiguration, \"`npm prefix -g` returned a non-existent directory\"\n    end\n    logger.info(\"Setting default npm install prefix\", :prefix => npm_prefix)\n    npm_prefix\n  end\n\n  public(:input)\nend # class FPM::Package::NPM\n","sourceCodeStart":93,"sourceCodeEnd":121,"githubUrl":"https://github.com/jordansissel/fpm/blob/b6d77ba72a560b687723376a0e5115c3a92634ad/lib/fpm/package/npm.rb#L93-L121","documentation":"Error \"`npm prefix -g` returned unexpected output.\" thrown in jordansissel/fpm.","triggerScenarios":"Thrown at lib/fpm/package/npm.rb:111 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b6d77ba72a560b687723376a0e5115c3a92634ad","analyzedAt":"2026-08-21T16:39:02.570Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}