Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

error message: import app from "./instance.mjs" #65

Closed
sb2050 opened this issue Jan 17, 2021 · 3 comments
Closed

error message: import app from "./instance.mjs" #65

sb2050 opened this issue Jan 17, 2021 · 3 comments

Comments

@sb2050
Copy link

sb2050 commented Jan 17, 2021

Good day,
after running npm start i always get the following error messages:

npm WARN npm npm does not support Node.js v10.21.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/

> metrics@3.2.0 start /root/node/metrics
> node source/app/web/index.mjs

/root/node/metrics/source/app/web/index.mjs:2
  import app from "./instance.mjs"
         ^^^

SyntaxError: Unexpected identifier
    at Module._compile (internal/modules/cjs/loader.js:723:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! metrics@3.2.0 start: `node source/app/web/index.mjs`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the metrics@3.2.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-01-17T00_07_36_560Z-debug.log

/root/.npm/_logs/2021-01-17T00_07_36_560Z-debug.log

0 info it worked if it ends with ok
1 warn npm npm does not support Node.js v10.21.0
2 warn npm You should probably upgrade to a newer version of node as we
3 warn npm can't make any promises that npm will work with this version.
4 warn npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
5 warn npm You can find the latest version at https://nodejs.org/
6 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ]
7 info using npm@5.8.0
8 info using node@v10.21.0
9 verbose run-script [ 'prestart', 'start', 'poststart' ]
10 info lifecycle metrics@3.2.0~prestart: metrics@3.2.0
11 info lifecycle metrics@3.2.0~start: metrics@3.2.0
12 verbose lifecycle metrics@3.2.0~start: unsafe-perm in lifecycle true
13 verbose lifecycle metrics@3.2.0~start: PATH: /usr/share/npm/node_modules/npm-lifecycle/node-gyp-bin:/root/node/metrics/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:$
14 verbose lifecycle metrics@3.2.0~start: CWD: /root/node/metrics
15 silly lifecycle metrics@3.2.0~start: Args: [ '-c', 'node source/app/web/index.mjs' ]
16 silly lifecycle metrics@3.2.0~start: Returned: code: 1  signal: null
17 info lifecycle metrics@3.2.0~start: Failed to exec start script
18 verbose stack Error: metrics@3.2.0 start: `node source/app/web/index.mjs`
18 verbose stack Exit status 1
18 verbose stack     at EventEmitter.<anonymous> (/usr/share/npm/node_modules/npm-lifecycle/index.js:283:16)
18 verbose stack     at EventEmitter.emit (events.js:198:13)
18 verbose stack     at ChildProcess.<anonymous> (/usr/share/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
18 verbose stack     at ChildProcess.emit (events.js:198:13)
18 verbose stack     at maybeClose (internal/child_process.js:982:16)
18 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
19 verbose pkgid metrics@3.2.0
20 verbose cwd /root/node/metrics
21 verbose Linux 4.19.0-13-amd64
22 verbose argv "/usr/bin/node" "/usr/bin/npm" "start"
23 verbose node v10.21.0
24 verbose npm  v5.8.0
25 error code ELIFECYCLE
26 error errno 1
27 error metrics@3.2.0 start: `node source/app/web/index.mjs`
27 error Exit status 1
28 error Failed at the metrics@3.2.0 start script.
28 error This is probably not a problem with npm. There is likely additional logging output above.
29 verbose exit [ 1, true ]
@lowlighter
Copy link
Owner

Hello !

Seems your NodeJS version is a bit outdated (v10) and probably does not support ES modules syntax.

A lot of new JS features are used in metrics (like import/export syntax, ?. and ?? operators, etc.) so you should either upgrade your NodeJS or else use a transpiler like BabelJS to make it run on an older version.

Hope it helped 🙂

@sb2050
Copy link
Author

sb2050 commented Jan 17, 2021

Thank you. I have now installed a newer version of NodeJS and it works.

@lowlighter
Copy link
Owner

Nice !

Repository owner locked and limited conversation to collaborators Feb 18, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Projects
None yet
Development

No branches or pull requests

2 participants