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

[FEATURE] Improved DX reporting engines field mismatch on install errors #1326

Closed
wesleytodd opened this issue May 18, 2020 · 1 comment · May be fixed by Jankyboy/cli-1#5 or baby636/cli#1
Closed
Labels
Enhancement new feature or improvement Release 6.x work is associated with a specific npm 6 release

Comments

@wesleytodd
Copy link
Contributor

What / Why

When a native dep fails to install, yet had an engines field which already indicated it might be incompatible, the message is printed as a warning under the cluttered compile failure output. This makes it difficult to see, leading to developers struggling to debug.

When

When a native dep install fails but we know it is not compatible based on the engines field

Where

Any native dep with an engines field, linux-perf is an example above when installing in node@9

How

Current Behavior

An example of the output:

$ npm i linux-perf
In file included from ../linux-perf.cc:3:
../linux-perf.h:12:37: error: unknown class name 'CodeEventHandler'; did you mean 'JitCodeEventHandler'?
class LinuxPerfHandler : public v8::CodeEventHandler {
                                    ^~~~~~~~~~~~~~~~
                                    JitCodeEventHandler
.../Library/Caches/node-gyp/9.11.2/include/node/v8.h:6667:16: note: 'JitCodeEventHandler' declared here
typedef void (*JitCodeEventHandler)(const JitCodeEvent* event);
               ^
In file included from ../linux-perf.cc:3:
../linux-perf.h:12:33: error: base specifier must name a class
class LinuxPerfHandler : public v8::CodeEventHandler {
                         ~~~~~~~^~~~~~~~~~~~~~~~~~~~
../linux-perf.h:15:23: error: only virtual member functions can be marked 'override'
  ~LinuxPerfHandler() override;
                      ^~~~~~~~
../linux-perf.h:18:19: error: no type named 'CodeEvent' in namespace 'v8'; did you mean 'JitCodeEvent'?
  void Handle(v8::CodeEvent* code_event) override;
              ~~~~^~~~~~~~~
                  JitCodeEvent
.../Library/Caches/node-gyp/9.11.2/include/node/v8.h:6571:8: note: 'JitCodeEvent' declared here
struct JitCodeEvent {
       ^
In file included from ../linux-perf.cc:3:
../linux-perf.h:18:42: error: only virtual member functions can be marked 'override'
  void Handle(v8::CodeEvent* code_event) override;
                                         ^~~~~~~~
../linux-perf.h:21:30: error: no type named 'CodeEvent' in namespace 'v8'; did you mean 'JitCodeEvent'?
  std::string FormatName(v8::CodeEvent* code_event);
                         ~~~~^~~~~~~~~
                             JitCodeEvent
.../Library/Caches/node-gyp/9.11.2/include/node/v8.h:6571:8: note: 'JitCodeEvent' declared here
struct JitCodeEvent {
       ^
../linux-perf.cc:37:25: error: no member named 'Enable' in 'node::LinuxPerfHandler'
    linuxPerf->handler->Enable();
    ~~~~~~~~~~~~~~~~~~  ^
../linux-perf.cc:49:25: error: no member named 'Disable' in 'node::LinuxPerfHandler'
    linuxPerf->handler->Disable();
    ~~~~~~~~~~~~~~~~~~  ^
8 errors generated.
make: *** [Release/obj.target/linux-perf/linux-perf.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (.../node_modules/npm6/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:180:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:12)
gyp ERR! System Darwin 19.4.0
gyp ERR! command ".../node_modules/nvmjs/.nvm/versions/node/v9.11.2/bin/node" ".../node_modules/npm6/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd .../test/fixtures/__tmp/pkg/node_modules/linux-perf
gyp ERR! node -v v9.11.2
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=10.4.0"} (current: {"node":"9.11.2","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     .../test/fixtures/__tmp/.npm/_logs/2020-05-18T23_35_58_743Z-debug.log

Expected Behavior

Report as ERR would be a good minimal change. Possibly a better change would be to suppress the error output and print only the engines incompatibility and a message about compile failure. I am sure there are other DX improvements which would help.

Who

  • n/a

References

  • n/a
@darcyclarke
Copy link
Contributor

npm v6 is no longer in active development; We will continue to push security releases to v6 at our team's discretion as-per our Support Policy.

If your bug is preproducible on v7, please re-file this issue using our new issue template.

If your issue was a feature request, please consider opening a new RRFC or RFC. If your issue was a question or other idea that was not CLI-specific, consider opening a discussion on our feedback repo

Closing: This is an automated message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement new feature or improvement Release 6.x work is associated with a specific npm 6 release
Projects
None yet
2 participants