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

npm_install & yarn_install ignore changes to .npmrc and .yarnrc #1712

Closed
uri-canva opened this issue Mar 18, 2020 · 2 comments · Fixed by #1866
Closed

npm_install & yarn_install ignore changes to .npmrc and .yarnrc #1712

uri-canva opened this issue Mar 18, 2020 · 2 comments · Fixed by #1866

Comments

@uri-canva
Copy link

🐞 bug report

Affected Rule

npm_install, yarn_install

The issue is caused by the rule:

Is this a regression?

Yes, the previous version in which this bug was not present was: ....

This does not affect symlink_node_modules = False, which used to be the default, so maybe it can be considered a regression? But I don't think it ever worked correctly with symlink_node_modules = False.

Description

.npmrc and .yarnrc are never declared as inputs to npm_install and yarn_install, even though running npm and yarn in the workspace means they are read. That means the repository rules are not reevaluated when those files change.

🔬 Minimal Reproduction

Assuming you have a project with a .yarnrc like this:

# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


yarn-path ".yarn/releases/yarn-1.21.1.js"
disable-self-update-check true
yarn
# this passes
bazel build //...
# this passes
rm .yarn/releases/yarn-1.21.1.js
yarn
# this fails with Cannot find module '.yarn/releases/yarn-1.21.1.js'
bazel build //...
# this passes

🌍 Your Environment

Operating System:

  
Darwin MacBook-Pro-108.local 19.3.0 Darwin Kernel Version 19.3.0: Thu Jan  9 20:58:23 PST 2020; root:xnu-6153.81.5~1/RELEASE_X86_64 x86_64
  

Output of bazel version:

  
Build label: 2.0.0- (@non-git)
Build target: bazel-out/darwin-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Fri Jan 10 19:03:57 2020 (1578683037)
Build timestamp: 1578683037
Build timestamp as int: 1578683037
  

Rules_nodejs version:

(Please check that you have matching versions between WORKSPACE file and @bazel/* npm packages.)

  
1.4.1
  
@uri-canva
Copy link
Author

Related: #1311

@gregmagolan
Copy link
Collaborator

gregmagolan commented May 5, 2020

When symlink_node_modules = True, you have to manually add all of the inputs to yarn_install and npm_install to the data attribute. #1866 improves the docstring for data and also includes a fix so that Bazel will evaluate all of the labels in data to ensure they are valid files.

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

Successfully merging a pull request may close this issue.

2 participants