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 --only=prod #254

Closed
phhoef opened this issue Mar 31, 2022 · 2 comments
Closed

npm install --only=prod #254

phhoef opened this issue Mar 31, 2022 · 2 comments
Labels

Comments

@phhoef
Copy link

phhoef commented Mar 31, 2022

Describe the bug
When trying to install the dependency only with not devDependencies an error is raised.
When only npm install is called, the installation is working.

root:/opt/test# npm install --only=prod
npm ERR! code 127
npm ERR! path /opt/test/node_modules/node-rfc
npm ERR! command failed
npm ERR! command sh -c prebuild-install -r napi || cmake-js rebuild
npm ERR! sh: 1: prebuild-install: not found
npm ERR! sh: 1: cmake-js: not found

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-03-31T10_25_06_456Z-debug.log

To Reproduce
Create a new project with npm. Add node-rfc as dependency. Delete the node_modules folder and run npm install --only=prod

When adding the following two dependencies to my dependencies it is working:

  • prebuilt-install
  • cmake-js

Is this by design or should both dependencies moved from devDependencies to dependencies?

Environment

  • The output of node -p "require('node-rfc').environment"
environment: {
 "platform": {
   "name": "linux",
   "arch": "x64",
   "release": "5.10.0-13-amd64"
 },
 "env": {
   "SAPNWRFC_HOME": "",
   "RFC_INI": ""
 },
 "versions": {
   "node": "12.22.5",
   "v8": "7.8.279.23-node.56",
   "uv": "1.40.0",
   "zlib": "1.2.11",
   "brotli": "1.0.9",
   "ares": "1.17.1",
   "modules": "72",
   "nghttp2": "1.43.0",
   "napi": "8",
   "llhttp": "2.1.3",
   "http_parser": "2.9.4",
   "openssl": "1.1.1k",
   "cldr": "37.0",
   "icu": "67.1",
   "tz": "2019c",
   "unicode": "13.0"
 }
}
@bsrdjan
Copy link
Member

bsrdjan commented Mar 31, 2022

Thanks for finding this bug and the solution.

Is this by design or should both dependencies moved from devDependencies to dependencies?

According to prebuild documentation, only prebuild-install is mandatory dependency, moreover at application level. The installation should therefore work like:

npm i --only=prod prebuild-install node-rfc  

or

package.json

  "dependencies": {
    "node-rfc": "^2.6.0",
    "prebuild-install": "^7.0.1"
  }

Could you please check it it works in your environment?

I would move only prebuild-install to dependencies (from dev dependencies) because cmake-js requires native CMake which can't be installed "on the fly", together with other dependencies.

Would it work for your scenario?

@phhoef
Copy link
Author

phhoef commented Mar 31, 2022

Hallo @bsrdjan, thanks for your quick reply.
I can confirm, that adding prebuild-install to the dependencies is sufficient.

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

2 participants