Bug 11015 - devtool: fails to add node.js project that has local dependency
Summary: devtool: fails to add node.js project that has local dependency
Status: NEW
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: Future
Assignee: Unassigned
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2017-02-04 01:12 UTC by Henry Bruce
Modified: 2025-03-27 14:56 UTC (History)
7 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 2017-02-04 01:12:49 UTC
Node.js can specify dependencies that are in local folders instead of registry. This is used when developing a module. Instead of defining dependencies by version

  "dependencies": {
    "my-node-test-lib": "0.1.0"
  }

you specify a path

  "dependencies": {
    "my-node-test-lib": "../my-node-test-lib"
  }

If you use the "local" form of dependency specification, devtool fails as it still looks for module in the registry and obviously it isn't there. 
 
Observed behavior
-----------------
$ devtool add my-node-test-app ~/Projects/nodejs/my-node-test-app/
ERROR: Command 'recipetool --color=always create -o /tmp/devtoolfsp88t_c "/home/hbruce/Projects/nodejs/my-node-test-app"  -N my-node-test-app' failed:
npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/my-node-test-lib
npm ERR! 404
npm ERR! 404 'my-node-test-lib' is not in the npm registry.

Expected behavior 
-----------------
Devtool completes successfully, provided path can be satisfied
Comment 1 Henry Bruce 2017-02-04 01:22:49 UTC
Adding all steps to reproduce
-----------------------------
$ git clone -b morty git://git.yoctoproject.org/poky
$ git clone -b morty git://git.openembedded.org/meta-openembedded
$ source poky/oe-init-build-env
$ bitbake-layers add-layer ../meta-openembedded/meta-oe
$ devtool add my-node-test-lib https://github.com/whbruce/my-node-test-lib.git
$ devtool add my-node-test-app https://github.com/whbruce/my-node-test-app.git
Comment 2 Rebecca Chang 2017-12-20 10:14:58 UTC
I have also run into similar issue in crops/esdk-container on v2.4.1-rc1

sdkuser@b6a396ad36ee:/workdir$ devtool add npm "npm://registry.npmjs.org;name=forever;version=0.15.1"
NOTE: Starting bitbake server...
NOTE: Starting bitbake server...
NOTE: Fetching npm://registry.npmjs.org;name=forever;version=0.15.1;noverify=1...
Loading cache: 100% |################################################################################################################################################################################| Time: 0:00:01
Loaded 1272 entries from dependency cache.
Parsing recipes: 100% |##############################################################################################################################################################################| Time: 0:00:00
Parsing of 816 .bb files complete (815 cached, 1 parsed). 1273 targets, 43 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
ERROR: Nothing PROVIDES 'nodejs-native'. Close matches:
  nss-native
  tzcode-native
  nspr-native
ERROR: Failed to fetch URL npm://registry.npmjs.org;name=forever;version=0.15.1;noverify=1
ERROR: Command '. /workdir/layers/build/oe-init-build-env /workdir > /dev/null && script -e -q -c "recipetool --color=always create --devtool -o /tmp/devtool1vf6gt2j 'npm://registry.npmjs.org;name=forever;version=0.15.1'  -x /workdir/workspace/sources/devtoolsrcesg8at_8 -N npm" /dev/null' failed
Comment 3 Randy MacLeod 2020-05-28 08:08:24 UTC
Jean-Marie are you interested in working on this bug?
Comment 4 Frédéric Martinsons 2023-03-26 07:12:44 UTC
It seems the same problem I ran into for rust recipe
see this series that is under discussion: https://patchwork.yoctoproject.org/project/oe-core/list/?series=11510

And in particularly the patch 1 and 4.

cargo based recipe has a "patch" mechanism to allow override dependencies to get the lib locally.

I don't know node.js and npm at all but if there is such a mechanism also, it should be used in npm.bbclass and externalsrc.bbclass should also be modified in the same way I did for cargo.