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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails when using the protobuf.js library #45

Open
rohanag12 opened this issue Oct 31, 2017 · 8 comments
Open

Build fails when using the protobuf.js library #45

rohanag12 opened this issue Oct 31, 2017 · 8 comments
Labels

Comments

@rohanag12
Copy link

rohanag12 commented Oct 31, 2017

The library: protobuf.js

To reproduce (Using the latest commit to this repo):

WORKSPACE

RULES_NODE_COMMIT = 'a447bee6fec5a6b64b6b2dd5dfe0f0597c648d1c'
RULES_NODE_SHA256 = '551f19fb02f97ccb68c78ec20e4190378e46129fc9594ed01be0baa0c224ec14'

http_archive(
    name = "org_pubref_rules_node",
    url = "https://github.com/pubref/rules_node/archive/%s.zip" % RULES_NODE_COMMIT,
    strip_prefix = "rules_node-%s" % RULES_NODE_COMMIT,
    sha256 = RULES_NODE_SHA256
)

load("@org_pubref_rules_node//node:rules.bzl", "node_repositories", "yarn_modules")
node_repositories()

yarn_modules(
  name = "vc_server_deps",
  deps = {
    "protobufjs": "~6.8.0"
  }
)

BUILD

load("@org_pubref_rules_node//node:rules.bzl", "node_binary", "node_module")

node_module(
  name = "server-module",
  description = "Server",
  srcs = [
    "index.js"
  ],
  deps = [
    "@vc_server_deps//:_all_"
  ],
  main = "index.js"
)

index.js

console.log('HELLO');

bazel build //...

.......................
ERROR: /Users/rohan/nodejstest/BUILD:3:1: no such package '@vc_server_deps//': Traceback (most recent call last):
	File "/private/var/tmp/_bazel_rohan/704e4959b45a6871701648c93ca35942/external/org_pubref_rules_node/node/internal/yarn_modules.bzl", line 66
		execute(ctx, ([node, "internal/parse_yarn_...), ...)
	File "/private/var/tmp/_bazel_rohan/704e4959b45a6871701648c93ca35942/external/org_pubref_rules_node/node/internal/yarn_modules.bzl", line 4, in execute
		fail((" ".join(cmds) + ("failed: \nST...))))
/private/var/tmp/_bazel_rohan/704e4959b45a6871701648c93ca35942/external/node/bin/node internal/parse_yarn_lock.jsfailed: 
STDOUT:

STDERR:
/private/var/tmp/_bazel_rohan/704e4959b45a6871701648c93ca35942/external/vc_server_deps/internal/parse_yarn_lock.js:145
        let referrer = dependency.referrer;
                                 ^

TypeError: Cannot read property 'referrer' of undefined
    at Object.keys.forEach.name (/private/var/tmp/_bazel_rohan/704e4959b45a6871701648c93ca35942/external/vc_server_deps/internal/parse_yarn_lock.js:145:34)
    at Array.forEach (native)
    at nodes.forEach (/private/var/tmp/_bazel_rohan/704e4959b45a6871701648c93ca35942/external/vc_server_deps/internal/parse_yarn_lock.js:134:39)
    at Array.forEach (native)
    at breakCircularDependencies (/private/var/tmp/_bazel_rohan/704e4959b45a6871701648c93ca35942/external/vc_server_deps/internal/parse_yarn_lock.js:124:9)
    at main (/private/var/tmp/_bazel_rohan/704e4959b45a6871701648c93ca35942/external/vc_server_deps/internal/parse_yarn_lock.js:46:3)
    at Object.<anonymous> (/private/var/tmp/_bazel_rohan/704e4959b45a6871701648c93ca35942/external/vc_server_deps/internal/parse_yarn_lock.js:7:1)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
 and referenced by '//:server-module'.
ERROR: Analysis of target '//:server-module' failed; build aborted: Loading failed.
INFO: Elapsed time: 11.235s

The protobuf.js library installs fine when using this library from commit dc9f8ba73f007a5eb3e57668e77082188c1ce219.

@pcj pcj added the bug label Oct 31, 2017
@pcj
Copy link
Contributor

pcj commented Oct 31, 2017

Looking into it. Looks like you are on darwin, yes? What bazel version?

@rohanag12
Copy link
Author

I'm on darwin, bazel 0.7.0.

$bazel version
Build label: 0.7.0-homebrew
Build target: bazel-out/darwin_x86_64-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Thu Oct 19 09:13:24 2017 (1508404404)
Build timestamp: 1508404404
Build timestamp as int: 1508404404

@rohanag12
Copy link
Author

rohanag12 commented Oct 31, 2017

Can also confirm that it fails with the same error on ubuntu, with bazel 0.7.0.

@pcj
Copy link
Contributor

pcj commented Oct 31, 2017

Hmm. I wasn't able to repro this. I added #46, let's see what travis thinks.

@rohanag12
Copy link
Author

You got the wrong library in #46. The dependency should be "protobufjs": "~6.8.0", not "protobuf.js". Please see the link in my original post.

@rohanag12
Copy link
Author

I created pull request #47 with a test example similar to #46, using the correct library. Let's see what Travis says about this.

@Zetten
Copy link
Contributor

Zetten commented Nov 1, 2017

I've been finding (and fixing) similar issues in parallel on a branch which I've submitted as PR #48. This particular dependency.referrer issue was because @-scope modules aren't found during the walk of the installed node_modules tree.

My (rather crude) solution for this is in 79c8825.

@pcj
Copy link
Contributor

pcj commented Nov 1, 2017

@rohanag12 OK, thanks for clearing that up. I'll abandon #46 and we'll keep going with #47 and #48.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants