-
Notifications
You must be signed in to change notification settings - Fork 2
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
SyntaxError: Cannot use import statement outside a module #1
Comments
We published sdk in npmjs, you should use that: https://www.npmjs.com/search?q=zincsearch |
Using this' https://www.npmjs.com/package/zincsearch-sdk' The expression+zincsearch-sdk demo reported an error. // import ZincSearchSDK from 'zincsearch-sdk'
// const { ZincSearchSDK } = require('zincsearch-sdk')
const ZincSearchSDK = require('zincsearch-sdk')
function test1() {
}
test1() package.json {
"name": "zincsearch-demo",
"version": "1.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www"
},
"dependencies": {
"cookie-parser": "~1.4.4",
"debug": "~2.6.9",
"express": "~4.16.1",
"http-errors": "~1.6.3",
"morgan": "~1.9.1",
"mysql2": "^3.2.3",
"pug": "2.0.0-beta11",
"sequelize": "^6.31.0",
"undici": "^5.22.0",
"zincsearch-sdk": "^0.3.3"
}
} |
Yes, it looks can't work with latest nodejs. i will try to fix it. Thanks. |
I think it should be |
I was able to build the current project with rollup as an ES bundle. Would you like me to send a PR ? |
use sdk-nodejs-zincsearch/exmaples/index/exists/main.js
`/* Copyright 2022 Zinc Labs Inc. and Contributors
*
*/
var ZincSearchSDK = require('../../../src/index');
let defaultClient = ZincSearchSDK.ApiClient.instance;
// Configure HTTP basic authorization: basicAuth
let basicAuth = defaultClient.authentications['basicAuth'];
basicAuth.username = 'admin';
basicAuth.password = 'Complexpass#123';
let apiInstance = new ZincSearchSDK.Index();
let index = "index_example"; // String | Index
apiInstance.exists(index, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + JSON.stringify(data));
}
});`
errinfo:
sdk-nodejs-zincsearch/src/index.js:15
import ApiClient from './ApiClient';
^^^^^^
SyntaxError: Cannot use import statement outside a module
==================
The text was updated successfully, but these errors were encountered: