diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 4f2b3cee..0d7c2a9e 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +- The "no package-lock.json" error when deploying Node.js content now states + that Connect installs Node.js dependencies with npm, helping publishers who + build with yarn or pnpm understand why a `package-lock.json` is required. - `pyproject.toml` can now be supplied via `--requirements-file` for deploy and write-manifest. - Perform case insensitive matching of the configured Snowflake connection authenticator. diff --git a/rsconnect/environment_node.py b/rsconnect/environment_node.py index 30ff0183..9e962a42 100644 --- a/rsconnect/environment_node.py +++ b/rsconnect/environment_node.py @@ -75,6 +75,7 @@ def create( if not has_lock_file: raise RSConnectException( f"No package-lock.json found in '{directory}'. " + "Connect installs Node.js dependencies with npm. " "Both package.json and package-lock.json are required to deploy Node.js content." ) diff --git a/tests/test_environment_node.py b/tests/test_environment_node.py index 6a866234..cbbec72b 100644 --- a/tests/test_environment_node.py +++ b/tests/test_environment_node.py @@ -42,7 +42,10 @@ def test_create_basic(self, mock_run): def test_create_no_lock_file(self, mock_run, tmp_path): (tmp_path / "package.json").write_text(json.dumps({"dependencies": {"express": "^4.21.0"}})) (tmp_path / "app.js").write_text("// app") - with pytest.raises(RSConnectException, match="No package-lock.json found"): + with pytest.raises( + RSConnectException, + match="No package-lock.json found.*Connect installs Node.js dependencies with npm", + ): NodeEnvironment.create(str(tmp_path)) @patch("rsconnect.environment_node.subprocess.run", side_effect=_mock_run)