node trying to remove JOI module getting error warning? - node.js

I am trying to remove Joi moule from node (because im not using it in app) and as its giving me this error:
/home/ubuntu/socialtrendsApp/app/SocialTrends/node_modules/joi/lib/index.js:48
root.any = function (...args) {
^^^
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> (/home/ubuntu/socialtrendsApp/app/SocialTrends/index.js:1:75)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
I typed: npm uninstall joi --save -g which is giving me the following warning: npm WARN uninstall not installed in /home/ubuntu/.nvm/versions/node/v4.4.5/lib/node_modules: "joi"
Need to get rid of this error or remove this modile. What am I doing wrong?

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.

Not able to create and Run react app. reinstalling didn't worked

I have tried to reinstall VS code and Node but it did not work out.Please help!
Error While Creating -
C:\Users\ADMIN\Desktop\Projects>npx create-react-app my-app
C:\Users\ADMIN\Desktop\node_modules\fs-extra\lib\ensure\file.js:1
$→��m��mo�L�D��;�%g�?w��ŷ↓�▬��ovH0��a�5��*�ؒ��l͛�S�iy☺�r�O7����%L]��%��∟�hk
^
SyntaxError: Invalid or unexpected token
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1032:15)
at Module._compile (node:internal/modules/cjs/loader:1067:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (C:\Users\ADMIN\Desktop\node_modules\fs-extra\lib\ensure\index.js:3:40)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
While Running -
C:\Users\ADMIN\Desktop\Projects\portfolio-website>npm start
> portfolio#0.1.0 start
> react-scripts start
Failed to compile.
Invalid or unexpected token

uncaughtException SyntaxError: Use of const in strict mode in sparkpost modules

{"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.

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?

Error: Cannot find module './is-buffer'

I haven't found any posts that have an answer for this one. It appears to be a sourcing issue, but no matter what I try I can't seem to source it properly. I get the following error when trying to launch my application.
is-buffer is installed. I see it in my node-modules directory.
C:\MY-APP\dataService>node dataAPI.js
module.js:338
throw err;
^
Error: Cannot find module './is-buffer'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (C:\MY-APP\node_modules\socket.io\node_modules\so
ket.io-adapter\node_modules\socket.io-parser\index.js:11:13)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
I tried setting this in my binary file as well as my package.json. I'm able to change it in my binary file, but no matter what I'm not able to find the correct src dir.
I also tried npm install is-buffer -g to no avail. Any advice?
Unexpected token ILLEGAL
I was able to update the source to
var isBuf = require('C:\VF_PDO_APP\node_modules\is-buffer');
So now it seems to be going to the right place I think. Now however, I'm getting Unexpected token ILLEGAL.
C:\MY-APP\dataService>node dataAPI.js
C:\MY-APP\node_modules\socket.io\node_modules\socket.io-adapter\node_modules\socket.io-parser\binary.js:10
socket.io\node_modules\socket.io-adapter\node_modules\socket.io-parser
^^^
SyntaxError: Unexpected token ILLEGAL
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> (C:\MY-APP\node_modules\socket.io\node_modules\soc
ket.io-adapter\node_modules\socket.io-parser\index.js:10:14)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
You first must install all your project dependencies, do it on the root folder of your project:
npm install
For your problem with socket.io try to:
npm install socket.io --save
For the bson problem:
npm install bson --save
(for this one probably you will need to install python and c++)

Resources