uncaughtException SyntaxError: Use of const in strict mode in sparkpost modules - node.js

{"level":"error","message":"uncaughtException SyntaxError: Use of
const in strict mode.\n at Module._compile (module.js:439:25)\n
at Object.Module._extensions..js (module.js:474:10)\n at
Module.load (module.js:356:32)\n at Function.Module._load
(module.js:312:12)\n at Module.require (module.js:364:17)\n at
require (module.js:380:17)\n at Object.
(/var/www/myproject/dist/node_modules/sparkpost/node_modules/request/node_modules/hawk/lib/index.js:5:33)\n
at Module._compile (module.js:456:26)\n at
Object.Module._extensions..js (module.js:474:10)\n at Module.load
(module.js:356:32)\n at Function.Module._load (module.js:312:12)\n
at Module.require (module.js:364:17)\n at require
(module.js:380:17)\n at Object.
(/var/www/myproject/dist/node_modules/sparkpost/node_modules/request/request.js:9:12)\n
at Module._compile (module.js:456:26)\n at
Object.Module._extensions..js
(module.js:474:10)","timestamp":"2017-09-25T02:45:43.418Z"}
I've found that problem when I run my node backend project. I didn't upgrade anything in these days and encounter that error accidentally.
My node version is node -v v0.10.37 npm -v 1.4.28 Please help me how to solve that issue. Thanks.

Related

npm will not respond at all

no matter what npm package I have, or try and install I keep getting this weird syntax error.
Users/BenNolan/.node/lib/node_modules/npm/lib/cli.js:66
module.exports = async process => {
^^^^^^^
SyntaxError: Unexpected identifier
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:414:25)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/Users/BenNolan/.node/lib/node_modules/npm/bin/npm-cli.js:2:1)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
I have tried updating nvm, npm and node no matter what I try I am still getting the syntax error halfway through the install.

npm cannot run evalmachine.<anonymous>

I got this problem for a while can't find any solution , please give me some explain.
C:\Users\ASUS ZenBook I5>npm -v
evalmachine.<anonymous>:27
const { Math, Object } = primordials;
^
ReferenceError: primordials is not defined
at evalmachine.<anonymous>:27:26
at Object.<anonymous> (C:\Users\ASUS ZenBook I5\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\fs.js:11:8)
at Module._compile (internal/modules/cjs/loader.js:959:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Function.Module._load (internal/modules/cjs/loader.js:727:14)
at Module.require (internal/modules/cjs/loader.js:852:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (C:\Users\ASUS ZenBook I5\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:3:27)
at Module._compile (internal/modules/cjs/loader.js:959:30)
node.js
v12.13.1
Possible duplicate: npm ReferenceError: primordials is not defined (node.js)
The problem seems to be graceful-fs - maybe it's even enough to run the following?
npm cache clean --force
Uninstall node go to \AppData\Roaming\npm\node_modules\npm delete this npm folder, now install node nad that is all.

Can not run bubble wrap

I'm trying to run BubbleWrap, this is the error that I run into
bubblewrap build
/usr/local/lib/node_modules/#bubblewrap/cli/node_modules/uuid/dist/esm-browser/index.js:1
export { default as v1 } from './v1.js';
^^^^^^
SyntaxError: Unexpected token 'export'
at wrapSafe (internal/modules/cjs/loader.js:1001:16)
at Module._compile (internal/modules/cjs/loader.js:1049:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:93:18)
at Object.<anonymous> (/usr/local/lib/node_modules/#bubblewrap/cli/node_modules/googleapis-common/build/src/apirequest.js:20:14)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
I'm using nodejs version 14.18.0 and npm version 6.14.15
I didn't make any changes to the code and I didn't know much about nodejs to know what's going on
Can someone help, please?
thanks
It seems that I download bubblewrap with nodejs v 8
I reinstall with nodejs 14 and it works now
thanks

Error in angular2 cli installation

I am installing angular2 in linux with
sudo npm install -g #angular/cli
and after running that it successifully installs but after typing
ng new mynewapp
Am getting an error
/usr/local/lib/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:374:25)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/usr/local/lib/node_modules/#angular/cli/models/config.js:3:18)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
what could be wrong
It's seem your nodejs version does not support ES2015, update your node to version 6+
you can using nvm to manage your node version
Your need Node version 6.x or higher
See documentation below
take a look here: https://github.com/angular/angular-cli/issues/4604

How to build npm package from source

I'm new to npm/node and I'm trying to build this repository:
https://github.com/react-component/slider
After clone and run npm install, I get this error:
/Users/rodrigora/Projects/slider/node_modules/rc-server/lib/index.js:39
app.get('/tests/runner.html', function* () {
^
SyntaxError: Unexpected token *
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/Users/rodrigora/Projects/slider/node_modules/rc-server/bin/start.js:3:11)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
I've reinstalled node/npm, deleted node_modules folder but nothing worked.
$ node -v
v0.12.0
$ npm -v
3.5.2
I don't have a clue how to fix it. Any help?

Resources