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 @lmstudio/sdk : #14

Open
henri-edh opened this issue May 7, 2024 · 9 comments
Open

npm install @lmstudio/sdk : #14

henri-edh opened this issue May 7, 2024 · 9 comments

Comments

@henri-edh
Copy link

henri-edh commented May 7, 2024

What version of node is required ?

I have a Macbook M3 Max Apple Silicon and get errors trying to run : npm install @lmstudio/sdk

Any advice on this ?

I use a Macbook Pro M3 max:

Here is a short section of the node errors:
npm error code 1
npm error path /Users/henrijohnson/Repos/lmstudio.js/node_modules/lmdb
npm error command failed
npm error command sh -c node-gyp-build-optional-packages
npm error make: Entering directory '/Users/henrijohnson/Repos/lmstudio.js/node_modules/lmdb/build'
npm error CXX(target) Release/obj.target/lmdb/src/lmdb-js.o
npm error make: Leaving directory '/Users/henrijohnson/Repos/lmstudio.js/node_modules/lmdb/build'
npm error /Users/henrijohnson/Repos/lmstudio.js/node_modules/node-gyp-build-optional-packages/index.js:77
npm error throw new Error('No native build was found for ' + target + '\n attempted loading from: ' + dir + ' and package:' +
npm error ^
npm error
npm error Error: No native build was found for platform=darwin arch=arm64 runtime=node abi=120 uv=1 armv=8 libc=glibc node=21.2.0
npm error attempted loading from: /Users/henrijohnson/Repos/lmstudio.js/node_modules/lmdb and package: @lmdb/lmdb-darwin-arm64
npm error
npm error at load.path (/Users/henrijohnson/Repos/lmstudio.js/node_modules/node-gyp-build-optional-packages/index.js:77:9)
npm error at load (/Users/henrijohnson/Repos/lmstudio.js/node_modules/node-gyp-build-optional-packages/index.js:29:25)
npm error at Object. (/Users/henrijohnson/Repos/lmstudio.js/node_modules/node-gyp-build-optional-packages/build-test.js:19:19)
npm error at Module._compile (node:internal/modules/cjs/loader:1376:14)
npm error at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
npm error at Module.load (node:internal/modules/cjs/loader:1207:32)
npm error at Module._load (node:internal/modules/cjs/loader:1023:12)
npm error at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
npm error at node:internal/main/run_main_module:28:49
npm error
npm error Node.js v21.2.0
npm error
npm error The failure above indicates the primary issue with the native builds which are included for all major platforms. Will now attempt to build the package locally in case this can be resolved by re-compiling.
npm error gyp info it worked if it ends with ok
npm error gyp info using [email protected]
npm error gyp info using [email protected] | darwin | arm64
npm error gyp info find Python using Python version 3.12.3 found at "/opt/homebrew/opt/[email protected]/bin/python3.12"
npm error gyp info spawn /opt/homebrew/opt/[email protected]/bin/python3.12
npm error gyp info spawn args [
npm error gyp info spawn args '/Users/henrijohnson/Repos/lmstudio.js/node_modules/node-gyp/gyp/gyp_main.py',
npm error gyp info spawn args 'binding.gyp',
npm error gyp info spawn args '-f',
npm error gyp info spawn args 'make',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/Users/henrijohnson/Repos/lmstudio.js/node_modules/lmdb/build/config.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/Users/henrijohnson/Repos/lmstudio.js/node_modules/node-gyp/addon.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/Users/henrijohnson/Library/Caches/node-gyp/21.2.0/include/node/common.gypi',
npm error gyp info spawn args '-Dlibrary=shared_library',
npm error gyp info spawn args '-Dvisibility=default',
npm error gyp info spawn args '-Dnode_root_dir=/Users/henrijohnson/Library/Caches/node-gyp/21.2.0',
npm error gyp info spawn args '-Dnode_gyp_dir=/Users/henrijohnson/Repos/lmstudio.js/node_modules/node-gyp',
npm error gyp info spawn args '-Dnode_lib_file=/Users/henrijohnson/Library/Caches/node-gyp/21.2.0/<(target_arch)/node.lib',
npm error gyp info spawn args '-Dmodule_root_dir=/Users/henrijohnson/Repos/lmstudio.js/node_modules/lmdb',
npm error gyp info spawn args '-Dnode_engine=v8',
npm error gyp info spawn args '--depth=.',
npm error gyp info spawn args '--no-parallel',
npm error gyp info spawn args '--generator-output',
npm error gyp info spawn args 'build',
npm error gyp info spawn args '-Goutput_dir=.'
npm error gyp info spawn args ]
npm error gyp info spawn make
npm error gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm error In file included from ../src/lmdb-js.cpp:1:
npm error ../src/lmdb-js.h:4:10: fatal error: vector: No such file or directory
npm error 4 | #include
npm error | ^~~~~~~~
npm error compilation terminated.
npm error make: *** [lmdb.target.mk:161: Release/obj.target/lmdb/src/lmdb-js.o] Error 1
npm error gyp ERR! build error
npm error gyp ERR! stack Error: make failed with exit code: 2

@yagil
Copy link
Member

yagil commented May 7, 2024

@henri-edh Node.js 18.6.0 or newer should work. Can you please share the error you are getting?

@ryan-the-crayon
Copy link
Contributor

We are using node v18.16.0, so any version above should work. Do you mind sharing the error message?

@QuinnPiers

This comment was marked as resolved.

@QuinnPiers

This comment was marked as resolved.

@ryan-the-crayon

This comment was marked as resolved.

@ryan-the-crayon

This comment was marked as resolved.

@QuinnPiers

This comment was marked as resolved.

@ryan-the-crayon

This comment was marked as resolved.

@ryan-the-crayon
Copy link
Contributor

Hi @henri-edh

This error seems to be caused by installing the development environment of lmstudio.js (which has a development time dependency that doesn't support apple silicon yet).

That said, if you are not trying to contribute to lmstudio.js itself (i.e. if you just want to use lmstudio.js), you should run npm install @lmstudio/sdk inside your own project. We actually have a guide on how to create a new project on our documentation website: https://lmstudio.ai/docs/lmstudio-sdk/quick-start, please check it out. :D

On the other hand, if you are indeed trying to contribute, you can remove "parcel" from the devDependencies section. We are currently not using parcel, so it is safe to remove.

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

No branches or pull requests

4 participants