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

Installation errors running CLI #1368

Open
jakelauer opened this issue Mar 6, 2020 · 5 comments
Open

Installation errors running CLI #1368

jakelauer opened this issue Mar 6, 2020 · 5 comments

Comments

@jakelauer
Copy link

@jakelauer jakelauer commented Mar 6, 2020

protobuf.js version: 6.8.8

Expected: Protobufjs runs and installs dependencies
Actual: Protobufjs fails to install dependencies

installing jsdoc@^3.5.5
installing uglify-js@^3.3.25
installing espree@^3.5.4
child_process.js:669
    throw err;
    ^
Error: Command failed: npm --silent install jsdoc@^3.5.5 uglify-js@^3.3.25 espree@^3.5.4
    at checkExecSyncError (child_process.js:630:11)
    at Object.execSync (child_process.js:666:15)
    at modInstall (D:\Project\node_modules\protobufjs\cli\util.js:129:19)
    at Object.exports.setup (D:\Project\node_modules\protobufjs\cli\util.js:156:5)
    at Object.<anonymous> (D:\Project\node_modules\protobufjs\cli\pbjs.js:7:6)
    at Module._compile (internal/modules/cjs/loader.js:1157:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1177:10)
    at Module.load (internal/modules/cjs/loader.js:1001:32)
    at Function.Module._load (internal/modules/cjs/loader.js:900:14)
    at Module.require (internal/modules/cjs/loader.js:1043:19) {

Any ideas for how to mitigate this?

@jakelauer

This comment has been minimized.

Copy link
Author

@jakelauer jakelauer commented Mar 6, 2020

Note: We have multiple machines failing with this error

@jakelauer jakelauer closed this Mar 6, 2020
@jakelauer jakelauer reopened this Mar 6, 2020
@deart1mer

This comment has been minimized.

Copy link

@deart1mer deart1mer commented Mar 10, 2020

The CLI and the browser runtime source code are in one package. Most people are only using protobuf.js for their runtime dep. For providing a smaller installed size, the author does not install the CLI's dependencies by default. Only when the CLI is used will it check whether it's dependencies were installed. If not, it will start a child process to install them. The child process would execute an npm install ... command. But that may cause problems such as insufficient permissions in system or failed to find NPM due to environment variables.

@jakelauer

This comment has been minimized.

Copy link
Author

@jakelauer jakelauer commented Mar 10, 2020

Is there a mitigation for this? We tried including the libraries in our own package.json but it still installs them anyway.

@deart1mer

This comment has been minimized.

Copy link

@deart1mer deart1mer commented Mar 10, 2020

Is there a mitigation for this? We tried including the libraries in our own package.json but it still installs them anyway.

Because the libraries are installed in <root>/cli/node_modules instead of <root>/node_modules. You could remove the <root>/cli/package.json and remove the .setup() caller.

https://github.com/protobufjs/protobuf.js/blob/master/cli/pbjs.js#L7
https://github.com/protobufjs/protobuf.js/blob/master/cli/pbts.js#L8

@jakelauer

This comment has been minimized.

Copy link
Author

@jakelauer jakelauer commented Mar 11, 2020

I don't have the option to modify the files inside node_modules as this issue is happening during build on a machines that run npm install for every build.

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.