I am trying to start my node-red on a raspberry pi 2 using pm2. I am using the startup command:
pm2 start /usr/bin/node-red-pi --node-args="--max-old-space-size=128" -- -v
At first it seems to work:
But unfortunatly then it errors:
Thats the log:
SyntaxError: Unexpected token ILLEGAL
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:404:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function._load (/usr/local/lib/node_modules/pm2/node_modules/pmx/lib/transaction.js:62:21)
at Object.<anonymous> (/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js:28:21)
at Module._compile (module.js:397:26)
at Object.Module._extensions..js (module.js:404:10)
at Module.load (module.js:343:32)
Please make sure you installed the latest PM2 version (>2.x):
$ npm install pm2#latest -g
$ pm2 update
Then start node-red again, it should works as expected:
pm2 start node-red --node-args="--max-old-space-size=128" -- -v
Related
I tried to run this example on my ubuntu os.
https://github.com/google/zx/blob/main/examples/basics.mjs
after I installed zx from npm
via npm i -g zx
and run the following cmd:
sudo zx ./script.mjs
i got below error:
/usr/local/lib/node_modules/zx/zx.mjs:17
import {basename, dirname, extname, join, parse, resolve} from 'path'
^
SyntaxError: Unexpected token {
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)
My npm version is : 7.14.0
As exlained in above comments:
The issue originated from an old version node that didn't recognize the import feature. which is available only since : v13+ ( see https://stackoverflow.com/questions/39436322/node-js-syntaxerror-unexpected-token-import)
Find Visual Studio Code application where I tried to run the file. Things look fine but it says cannot find module. Find my terminal output below along with screenshot in "Node Program"
F:\Git Clone\Node.js_From 31Oct2019\IBM-Developer\Node.js\Course\Unit-6>node server.js
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module 'sqlite3'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (F:\Git Clone\Node.js_From 31Oct2019\IBM-Developer\Node.js\Course\Unit-6\utils\utils.js:23:17)
at Module._compile (internal/modules/cjs/loader.js:778:30)
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)
Node Program
You have to run npm i and then restart your application and vs code.
Install NPM by typing npm i and then restart your application
Trying to build a meteor app through mup to the digitalOceans droplet, which runs on Nginx.
During this process, I always stack on deployment verifictation.
nodejs & node version: v4.8.4
npm version: 2.15.11
Error:
x Verifying Deployment: FAILED
-----------------------------------STDERR-----------------------------------
WARN package.json meteor-dev-bundle#0.0.0 No description
npm WARN package.json meteor-dev-bundle#0.0.0 No repository field.
npm WARN package.json meteor-dev-bundle#0.0.0 No README data
npm WARN cannot run in wd meteor-dev-bundle#0.0.0 node npm-rebuild.js (wd=/bundle/bundle/programs/server)
=> Starting meteor app on port:80
/bundle/bundle/programs/server/mini-files.js:82
const unicodeNormalizePath = (path) => {
^
SyntaxError: Unexpected token >
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/bundle/bundle/programs/server/boot.js:9:13)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
=> Redeploying previous version of the app
-----------------------------------STDOUT-----------------------------------
To see more logs type 'mup logs --tail=100'
----------------------------------------------------------------------------
And here is logs:https://pastebin.com/zs8FG86V
Thank you!
Fixed it, by changing docker image, from 'kadirahq/meteord' to 'abernix/meteord:base' in mup.js file.
When I run ng with any command, then causes
ng -v
C:\nodejs\node_modules\#angular\cli\models\config\config.js:16
constructor(_configPath, schema, configJson, fallbacks = []) {
^
SyntaxError: Unexpected token =
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (C:\nodejs\node_modules\#angular\cli\models\config.js:3:18)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
node -v
v6.10.0
npm -v
4.4.1
I tried reinstalling the node, npm and #angular/cli. No solution has helped.
#Edited, Solution
I deleted ng, ng.cmd from C:\nodejs\ and folders #angular/cli/, angular-cli/ fromC:\nodejs\node_modules, and reinstall #angular/cli, and then
works correctly.
I am trying to run 'node server.js' to connect my raspberry pi device to Azure via the Azure IoT Hub. When I run the command 'node server.js', I receive the following error. Please note that I replaced my computer's user name with 'username'. The file connection_string.js does not have my computer's username in it, despite the error saying that it does. Please see error below:
SyntaxError: Invalid flags supplied to RegExp constructor '*username*'
at new RegExp (native)
at Object.<anonymous> (/Users/*username*/iot-hub-c-raspberrypi-getstartedkit/command_center_node/node_modules/azure-iot-common/lib/connection_string.js:9:31)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/Users/*username*/iot-hub-c-raspberrypi-getstartedkit/command_center_node/node_modules/azure-iot-common/common.js:15:21)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/Users/*username*/iot-hub-c-raspberrypi-getstartedkit/command_center_node/server.js:7:15)
Thank you in advance for your help!
Not sure if it is your case or not, but I had similar issue:
SyntaxError: Invalid flags supplied to RegExp constructor 'u'
I fixed it simply by updating Node.js.
Previous version was:
$ node -v
v5.1.1
Then I did:
$ curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
... long output
$ sudo apt-get install -y nodejs
... shorter output
$ node -v
v6.7.0
And no more issues.