You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(node:5251) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
insert-product.js:19
import { rest } from 'prestashop-api-client';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at wrapSafe (internal/modules/cjs/loader.js:1063:16)
at Module._compile (internal/modules/cjs/loader.js:1111:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
at Module.load (internal/modules/cjs/loader.js:996:32)
at Function.Module._load (internal/modules/cjs/loader.js:896:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
If I add the type module to package.json or rename the file to mjs, I get:
(node:5260) ExperimentalWarning: The ESM module loader is experimental.
internal/modules/run_main.js:54
internalBinding('errors').triggerUncaughtException(
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'prestashop-api-client' imported from /var/www/vagrant/testScraper/insert-product.mjs
at packageResolve (internal/modules/esm/resolve.js:575:9)
at moduleResolve (internal/modules/esm/resolve.js:600:14)
at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:644:13)
at Loader.resolve (internal/modules/esm/loader.js:94:40)
at Loader.getModuleJob (internal/modules/esm/loader.js:240:28)
at ModuleWrap. (internal/modules/esm/module_job.js:42:40)
at link (internal/modules/esm/module_job.js:41:36) {
code: 'ERR_MODULE_NOT_FOUND'
}
Hi, I following the instructions and I get:
(node:5251) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
insert-product.js:19
import { rest } from 'prestashop-api-client';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at wrapSafe (internal/modules/cjs/loader.js:1063:16)
at Module._compile (internal/modules/cjs/loader.js:1111:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
at Module.load (internal/modules/cjs/loader.js:996:32)
at Function.Module._load (internal/modules/cjs/loader.js:896:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
If I add the type module to package.json or rename the file to mjs, I get:
(node:5260) ExperimentalWarning: The ESM module loader is experimental.
internal/modules/run_main.js:54
internalBinding('errors').triggerUncaughtException(
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'prestashop-api-client' imported from /var/www/vagrant/testScraper/insert-product.mjs
at packageResolve (internal/modules/esm/resolve.js:575:9)
at moduleResolve (internal/modules/esm/resolve.js:600:14)
at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:644:13)
at Loader.resolve (internal/modules/esm/loader.js:94:40)
at Loader.getModuleJob (internal/modules/esm/loader.js:240:28)
at ModuleWrap. (internal/modules/esm/module_job.js:42:40)
at link (internal/modules/esm/module_job.js:41:36) {
code: 'ERR_MODULE_NOT_FOUND'
}
package.json:
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo "Error: no test specified" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"cheerio": "^1.0.0-rc.3",
"download-file": "^0.1.5",
"node-rest-client": "^3.1.0",
"puppeteer": "^2.1.1",
"read-json-sync": "^2.0.1",
"sync-request": "^6.1.0"
}
}
and the code is the same of the instructions:
import { rest } from 'prestashop-api-client';
const client = new rest.Client({
language: 'en',
languages: {
'en': 1,
'es': 2,
},
webservice: {
key: 'my_key',
scheme: 'http',
host: 'my_url',
root: '/api',
},
});
The text was updated successfully, but these errors were encountered: