Coder Social home page Coder Social logo

rules_node's People

Contributors

jboning avatar miikka avatar peterlebrun avatar samertm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rules_node's Issues

Rules assume /usr/bin/python is Python 2

Last night, I decided to build livegrep which uses rules_node. Now I could be wrong, but it looks like these rules depend on /usr/bin/python being Python 2. I tried a Python 2 virtual environment, but got the same dictionary item concatenation error. Then when I temporarily linked /usr/bin/python to /usr/bin/python2, the build succeed.

ERROR: /home/jeff/.cache/bazel/_bazel_jeff/bb4d08f3ff80487a42cb41ef63df32dd/external/org_dropbox_rules_node/npm/webpack/BUILD:7:1: installing node modules from external/org_dropbox_rules_node/npm/webpack/npm-shrinkwrap.json failed (Exit 1)
Traceback (most recent call last):
  File "/home/jeff/.cache/bazel/_bazel_jeff/bb4d08f3ff80487a42cb41ef63df32dd/sandbox/processwrapper-sandbox/1395/execroot/com_github_livegrep_livegrep/bazel-out/host/bin/external/org_dropbox_rules_node/node/tools/npm/install.runfiles/org_dropbox_rules_node/node/tools/npm/install.py", line 49, in <module>
    main()
  File "/home/jeff/.cache/bazel/_bazel_jeff/bb4d08f3ff80487a42cb41ef63df32dd/sandbox/processwrapper-sandbox/1395/execroot/com_github_livegrep_livegrep/bazel-out/host/bin/external/org_dropbox_rules_node/node/tools/npm/install.runfiles/org_dropbox_rules_node/node/tools/npm/install.py", line 45, in main
    npm_install(args.shrinkwrap, args.output)
  File "/home/jeff/.cache/bazel/_bazel_jeff/bb4d08f3ff80487a42cb41ef63df32dd/sandbox/processwrapper-sandbox/1395/execroot/com_github_livegrep_livegrep/bazel-out/host/bin/external/org_dropbox_rules_node/node/tools/npm/install.runfiles/org_dropbox_rules_node/node/tools/npm/install.py", line 27, in npm_install
    run_npm(['install'], env=env, cwd=output)
  File "/home/jeff/.cache/bazel/_bazel_jeff/bb4d08f3ff80487a42cb41ef63df32dd/sandbox/processwrapper-sandbox/1395/execroot/com_github_livegrep_livegrep/bazel-out/host/bin/external/org_dropbox_rules_node/node/tools/npm/install.runfiles/org_dropbox_rules_node/node/tools/npm/utils.py", line 84, in run_npm
    full_env = dict(full_env.items() + env.items())
TypeError: unsupported operand type(s) for +: 'dict_items' and 'dict_items'
INFO: Elapsed time: 376.399s, Critical Path: 28.67s
INFO: 1395 processes: 1395 processwrapper-sandbox.
FAILED: Build did NOT complete successfully

Discuss bazelbuild/rules_node

Hi @samertm , I'm on the Angular team and also have written nodejs rules. Currently they are part of the TypeScript rules but I would like to make a canonical rule under bazelbuild as you suggest in your README.

I started a discussion with the maintainer of the pubref version here: pubref/rules_node#19 (comment)

We can discuss on this issue, or you can just treat it as a ping and we can continue discussion on that issue.

Simple express example not working

I am trying to put together a simple express example to try these out (since I've been able to get further with them than bazelbuild/rules_nodejs), and I'm running into an issue.

To reproduce (on top of standard WORKSPACE @ 4fe6494):

# Set up express dependency.
# see: https://github.com/dropbox/rules_node/issues/3
bazel run @org_dropbox_rules_node//node/tools/npm:gen_build_npm -- [email protected] $PWD/

I then append (adding node_binary to the load()):

node_binary(
    name = 'binary',
    srcs = ['index.js'],
    main = 'index.js',
    deps = [
        ':express',
    ],
)

However, when I bazel run :binary I'm getting:

$ bazel run :binary
INFO: Analysed target //:binary (0 packages loaded).
INFO: Found 1 target...
ERROR: /home/mattmoor/trying-node/BUILD:334:1: Creating runfiles tree bazel-out/local-opt/bin/binary.runfiles failed (Exit 1)
_bin/build-runfiles (args bazel-out/local-opt/bin/binary.runfiles_manifest bazel-out/local-opt/bin/binary.runfiles): paths must not be absolute: line 1: '/node_modules/express/History.md /home/mattmoor/.cache/bazel/_bazel_mattmoor/e6c1f9a612e03cb822c6e33f6e63f45c/execroot/__main__/bazel-out/local-opt/bin/node_modules/express/History.md'

Target //:binary failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 1.647s, Critical Path: 1.38s
FAILED: Build did NOT complete successfully
ERROR: Build failed. Not running target

The contents of index.js don't even matter. Am I holding it wrong? Any workarounds?

Bazel version info:

$ bazel version
Build label: 0.7.0
Build target: bazel-out/local-fastbuild/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Wed Oct 18 14:27:19 2017 (1508336839)
Build timestamp: 1508336839
Build timestamp as int: 1508336839

Webpak Build Error

File "c:\users\rwatts\appdata\local\temp\Bazel.runfiles_s8dqke\runfiles\org_dropbox_rules_node\node\tools\npm\runfiles.py", line 18, in _get_runfiles_dir
    raise RunfilesError('Must be run in Bazel environment')
node.tools.npm.runfiles.RunfilesError: Must be run in Bazel environment
Target //:bundle failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 4.455s, Critical Path: 0.84s
INFO: 0 processes.
FAILED: Build did NOT complete successfully
FAILED: Build did NOT complete successfully

can you discuss Webpack a little more?

Hi there,
I was curious about this note in the README about webpack_build:

Making the experience of using webpack better within Dropbox was one of the reasons we wrote these rules.

Can you elaborate a little further on how it's made the experience of using Webpack better? Is it faster? Shorter restarts?

Thanks,
Kevin

Q: failing to build/use npm_library

Hi,

While trying to add react as npm_library via gen_build_npm all looked ok until I tried to require it in webpack_build. Then I got errors for missing modules:

root@492043872cb0:/usr/src/app# bazel build //examples/webpack_build:webpack_build
INFO: Analysed target //examples/webpack_build:webpack_build (1 packages loaded).
INFO: Found 1 target...
ERROR: /usr/src/app/examples/webpack_build/BUILD:5:1: building webpack_build with node failed (Exit 2)
Hash: 941dea5966bf4b5f728e
Version: webpack 3.4.1
Time: 324ms
    Asset     Size  Chunks             Chunk Names
bundle.js  96.1 kB       0  [emitted]  main
  [12] multi entry.ts 28 bytes {0} [built]
  [13] /usr/src/app/examples/webpack_build/src/entry.ts 156 bytes {0} [built]
  [14] /usr/src/app/examples/webpack_build/src/stuff.ts 31 bytes {0} [built]
  [15] /usr/src/app/examples/internal_module/internal_module.js 32 bytes {0} [built]
    + 26 hidden modules

ERROR in /root/.cache/bazel/_bazel_root/a14564dce24fc232216f1aef117728d1/execroot/org_dropbox_rules_node/bazel-out/host/bin/examples/npm/react/node_modules/react/lib/React.js
Module not found: Error: Can't resolve 'object-assign' in '/root/.cache/bazel/_bazel_root/a14564dce24fc232216f1aef117728d1/execroot/org_dropbox_rules_node/bazel-out/host/bin/examples/npm/react/node_modules/react/lib'
 @ /root/.cache/bazel/_bazel_root/a14564dce24fc232216f1aef117728d1/execroot/org_dropbox_rules_node/bazel-out/host/bin/examples/npm/react/node_modules/react/lib/React.js 11:14-38
 @ /root/.cache/bazel/_bazel_root/a14564dce24fc232216f1aef117728d1/execroot/org_dropbox_rules_node/bazel-out/host/bin/examples/npm/react/node_modules/react/react.js
 @ /usr/src/app/examples/webpack_build/src/entry.ts
 @ multi entry.ts

ERROR in /root/.cache/bazel/_bazel_root/a14564dce24fc232216f1aef117728d1/execroot/org_dropbox_rules_node/bazel-out/host/bin/examples/npm/react/node_modules/react/lib/ReactBaseClasses.js
Module not found: Error: Can't resolve 'object-assign' in '/root/.cache/bazel/_bazel_root/a14564dce24fc232216f1aef117728d1/execroot/org_dropbox_rules_node/bazel-out/host/bin/examples/npm/react/node_modules/react/lib'
 @ /root/.cache/bazel/_bazel_root/a14564dce24fc232216f1aef117728d1/execroot/org_dropbox_rules_node/bazel-out/host/bin/examples/npm/react/node_modules/react/lib/ReactBaseClasses.js 12:14-38
 @ /root/.cache/bazel/_bazel_root/a14564dce24fc232216f1aef117728d1/execroot/org_dropbox_rules_node/bazel-out/host/bin/examples/npm/react/node_modules/react/lib/React.js
 @ /root/.cache/bazel/_bazel_root/a14564dce24fc232216f1aef117728d1/execroot/org_dropbox_rules_node/bazel-out/host/bin/examples/npm/react/node_modules/react/react.js
 @ /usr/src/app/examples/webpack_build/src/entry.ts
 @ multi entry.ts
...

any ideas if I'm doing smth wrong or maybe there is a fix/workaround for this?

Thanks alot in advance!

Problem using with node 8.11.4

I've run into an issue attempting to get this working with node 8.11.4. You can see a reproduction of this at https://github.com/pward123/bazel-node-reproduction

Running with the default node version succeeds, but running with 8.11.4 fails with the following:

...

[8 / 9] installing node modules from npm/lodash/npm-shrinkwrap.json; 0s processwrapper-sandbox
ERROR: /usr/src/app/npm/lodash/BUILD:7:1: output 'npm/lodash/node_modules/lodash/LICENSE' was not created
ERROR: /usr/src/app/npm/lodash/BUILD:7:1: output 'npm/lodash/node_modules/lodash/README.md' was not created
ERROR: /usr/src/app/npm/lodash/BUILD:7:1: output 'npm/lodash/node_modules/lodash/_DataView.js' was not created
ERROR: /usr/src/app/npm/lodash/BUILD:7:1: output 'npm/lodash/node_modules/lodash/_Hash.js' was not created
ERROR: /usr/src/app/npm/lodash/BUILD:7:1: output 'npm/lodash/node_modules/lodash/_LazyWrapper.js' was not created
ERROR: /usr/src/app/npm/lodash/BUILD:7:1: output 'npm/lodash/node_modules/lodash/_ListCache.js' was not created
E

...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.