Bug 10337 - devtool: fails to add an npm project if nodejs-native is not already built
Summary: devtool: fails to add an npm project if nodejs-native is not already built
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: devtools / tool chain (show other bugs)
Version: 2.2
Hardware: x86 Multiple
: Medium normal
Target Milestone: 2.2 M4
Assignee: Paul Eggleton
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2016-09-27 22:12 UTC by Henry Bruce
Modified: 2016-10-05 19:38 UTC (History)
3 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Don't know


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Henry Bruce 2016-09-27 22:12:02 UTC
Observed behavior
-----------------
$ devtool add "npm://registry.npmjs.org;name=grunt-cli;version=1.1.0"
ERROR: Command 'recipetool --color=always create -o /tmp/devtooll09swkt2 "npm://registry.npmjs.org;name=grunt-cli;version=1.1.0"  -x /path/to/build/workspace/sources/devtoolsrcuogngddz' failed:
ERROR: npm:// URL requested but npm is not available - you need to either build nodejs-native or install npm using your package manager

If you run 'bitbake nodejs-native' *OR* install node on host system, then rerun above devtool add command it complete OK.

Observed behavior
-----------------
[build]$ devtool add "npm://registry.npmjs.org;name=grunt-cli;version=1.1.0"
Command completes without error and does not require nodejs-native to be man ually build aHEAD OF TIME.

Notes
------
1. This is a regression. The above 'devtool add' command works on krogoth.
2. nodejs-native recipe should not allow fallback to node installed on host
Comment 1 Paul Eggleton 2016-09-28 19:36:37 UTC
1. devtool add did require npm on krogoth - there's no way it could fetch the source for the specified npm package without it. It may be that we check for it now where we didn't before. I'll have to investigate. Do you have npm available on your host?

2. Not sure I understand what you mean - should *not* allow ?

If devtool attempted to build nodejs-native if it could not run npm, would that be OK?
Comment 2 Stephen K Jolley 2016-09-29 14:46:38 UTC
Henry - please comment
Comment 3 brian avery 2016-09-29 14:48:47 UTC
yes.  I believe so.  It seems like we should either:
1) document that to use the node functionality you need to have host npm
or
2) (better, i think) just try to build nodejs-native if not available.

When I had no host npm and had built nodejs-native, it worked.
Comment 4 Henry Bruce 2016-09-29 17:28:11 UTC
To extend on my original comments

1. To clarify observed behavior on krogoth
When running devtool add "npm://registry.npmjs.org;name=grunt-cli;version=1.1.0" 
'devtool add' fetches and builds nodejs-native then completes successfully
'devtool build grunt-cli' will then complete successfully

2. On master the observed behavior (i.e. failure) can be avoided if npm is installed on host. We should update devtool's npm support to avoid using host's npm as its version is not controlled and force use of npm from nodejs-native. Thus if nodejs-native is not available, 'devtool add' of npm project should fail.

I hope that makes more sense.