Cannot use Bower because of node.js error - javascript

I'm trying to use bower to install everything for the website I am working on, but every time I try to use it, I get the error:
TypeError: Object #<Object> has no method 'toLowerCase'
at Function.Buffer.isEncoding (buffer.js:240:32)
at assertEncoding (evalmachine.<anonymous>:98:27)
at Object.fs.writeFileSync (evalmachine.<anonymous>:908:3)
at Object.create.all.set (/usr/local/lib/node_modules/bower/node_modules/configstore/index.js:64:8)
at Object.Configstore (/usr/local/lib/node_modules/bower/node_modules/configstore/index.js:27:11)
at readCachedConfig (/usr/local/lib/node_modules/bower/lib/config.js:19:23)
at defaultConfig (/usr/local/lib/node_modules/bower/lib/config.js:11:12)
at Object.<anonymous> (/usr/local/lib/node_modules/bower/lib/index.js:40:32)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
I have been searching for a while on the internet but cannot manage to find the solution for this problem.
I am trying to run it on Linux Mint 17.2

Problem solved by downloading the Node.js sources and by recompiling it.

Related

Issues installing Sequelize

I am finishing some backend tutorials and when i tried to install Sequelize with Node this is what it displays on the screen i have tried to downgrade the versions of Node js to solve the problem and updated other dependencies but it doesnt work, i am currently using 8.4.0 Node version, the one that is used on the tutorial and the lesson but it doesnt fix the issue, hope you can help me with this so i can move on to finish my course and do the exam, here it is what i get after trying to install:
P.D. I am working on a OS Windows 10 desktop computer.
C:\Users\AIO 330-20AST\Desktop\backend\base_datos> node server.js
node-pre-gyp info This Node instance does not support builds for N-API version 3
node-pre-gyp info This Node instance does not support builds for N-API version 6
C:\Users\AIO 330-20AST\Desktop\backend\base_datos\node_modules\node-pre-gyp\lib\util\napi.js:84
throw new Error(
^
Error: The N-API version of this Node instance is 1. This module
supports N-API version(s) 3,6. This Node instance cannot run this
module.
at Object.module.exports.validate_package_json (C:\Users\AIO
330-20AST\Desktop\backend\base_datos\node_modules\node-pre-gyp\lib\util\napi.js:84:9)
at Object.validate_config (C:\Users\AIO
330-20AST\Desktop\backend\base_datos\node_modules\node-pre-gyp\lib\util\versioning.js:229:10)
at Object.exports.find (C:\Users\AIO
330-20AST\Desktop\backend\base_datos\node_modules\node-pre-gyp\lib\pre-binding.js:21:15)
at Object.<anonymous> (C:\Users\AIO
330-20AST\Desktop\backend\base_datos\node_modules\sqlite3\lib\sqlite3-binding.js:3:27)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
at Module.require (module.js:517:17)
C:\Users\AIO 330-20AST\Desktop\backend\base_datos>
For your help thanks in advance, good coding!

Apollo-server tutorial from GraphQL website produce error

I can't get this tutorial to work (running on Ubuntu v19.04):
https://www.apollographql.com/docs/apollo-server/getting-started/
My code is literally copy+pasted from the tutorial - I have installed all dependencies, and I keep getting the following error when running node index.js:
internal/modules/cjs/loader.js:628
throw e;
^
Error: No valid exports main found for '{project-path}/node_modules/uuid'
at resolveExportsTarget (internal/modules/cjs/loader.js:625:9)
at applyExports (internal/modules/cjs/loader.js:502:14)
at resolveExports (internal/modules/cjs/loader.js:551:12)
at Function.Module._findPath (internal/modules/cjs/loader.js:657:22)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:960:27)
at Function.Module._load (internal/modules/cjs/loader.js:855:27)
at Module.require (internal/modules/cjs/loader.js:1033:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> ({project-path}/project-myra/node_modules/apollo-engine-reporting/dist/agent.js:26:16)
at Module._compile (internal/modules/cjs/loader.js:1144:30) {
code: 'MODULE_NOT_FOUND'
This is literally so frustrating, because the only place to get any help with apollo-server is from a Spectrum chat that keeps disconnecting, and doesn't even allow me to create any posts...
Why is this library the official supported and recommended library for GraphQL? And how come I seem to be the only person in the world having this issue, I can't find anyone else asking about this...
It seems it's a problem with the current Apollo Server version.
Try downgrading to 2.6.3, this worked for me. Haven't tried with any other version though.
npm install apollo-server#2.6.3

Grave (`) is marked as illegal token

I've been trying to transfer a node program I created locally to an EC2 server via Cloud9, and I have already manually replaced all of the (req,res) => {} statements because it didn't accept that. However, now it's giving me
console.log(`foo ${bar}`)
^
SyntaxError: Unexpected token ILLEGAL
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 Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:945:3
It works fine on my local server and it runs fine here too, even without nodejs.
var bar = "bar"
console.log(`foo ${bar}`)
The version of node is v13.9.0 and it was installed via nvp.
Anyone know why this is happening? I really don't want to go through and convert all the strings with `
Thanks for the help, I figured out that cloud9 automatically installs nodejs, just not the right version. It installs 10.19.0, while the current latest version is 13.10.0. I installed the latest version, but the default was still 10.19.0. For anyone else having this problem, do
nvm ls
to list your installed node versions, then use
nvm alias default 13.10.0 (replace with whatever version you want)

react-native-fetch-blob link FAILED

How can i Fix my error. i need to display a pdf from my assets folder. im using expo, react native, react-native-pdf
Scanning folders for symlinks in C:\Users\kjdelacruz\mobile\cdo-mobile-organizer\node_modules (31ms)
RNFetchBlob checking app version ..
RNFetchBlob detected app version => 6
Add Android permissions => false
react-native-fetch-blob link FAILED
Could not automatically link package :TypeError: path must be a string or Buffer
at Object.fs.readFile (fs.js:358:11)
at Object.<anonymous> (C:\Users\kjdelacruz\mobile\cdo-mobile-organizer\node_modules\react-native-fetch-blob\scripts\prelink.js:29:8)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Function.Module.runMain (module.js:605:10)
at startup (bootstrap_node.js:158:16)
at bootstrap_node.js:575:3please follow the instructions to manually link the library : https://github.com/wkh237/react-native-fetch-blob/wiki/Manually-Link-Package
rnpm-install info Linking assets to ios project
rnpm-install ERR! Something went wrong while linking. Error: Cannot read property 'pbxprojPath' of null
Please file an issue here: https://github.com/facebook/react-native/issues
Cannot read property 'pbxprojPath' of null
Apparently rn-fetch-blob is incompatible with expo. I have dealt with this very problem before with expo and rn-fetch-blob.
"It doesn't work with Expo because Expo doesn't support native module linking. Like you said you'll have to detach from Expo in order to run react-native link react-native-fetch-blob for this to work."
https://docs.expo.io/versions/latest/guides/detach.html
You will need to use XCode to get it working.
There are a couple threads discussing. No solutions with expo though.
https://github.com/joltup/rn-fetch-blob/issues/97
https://github.com/wkh237/react-native-fetch-blob/issues/371

I get a SyntaxError in Node.JS, but I can't figure out the origin of that error from the log messages

I am running a Node app on Azure. It's a Web API and when I try to call it, I see this message in the Node console:
Application has thrown an uncaught exception and is terminated:
SyntaxError: Unexpected token (
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:313:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (D:\home\site\wwwroot\app.js:17:23)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
I ran my whole code through eslint and didn't find any syntax errors. It also runs fine on my local machine, but doesn't run on Azure.
The message above points to line 17 and column 23 in app.js, which is a require:
let warehouseExport = require('./routes/warehouse-export-api');
I ran eslint and jshint specifically on the file referenced above, and there are no syntax errors.
What are some other ways I can get the exact location of the syntax error, and why could it be that the code fails on Azure but runs on my local machine?
What I tried:
Wrap in try-catch and grab the line number - it shows up undefined:
try {
var warehouseExport = require('./routes/warehouse-export-api');
} catch (error) {
console.log(error + ', line ' + error.lineNumber);
}
You should check version of nodejs you have installed on Azure. Maybe it's <= 4 and it doesn't support let keyword. Just a wild guess.
The cause of the error was that the Node version somehow got reset to 4.2.4.
When I go to Azure Portal and run node --version, I get version 8.1.4.
However, if I console.log the Node version inside my script, it is somehow still 4.2.4.
I will investigate why that happened and how to fix it, but for now it's clear that the bug is due to async function not being recognized by the old Node.
Update: the package.json file where the node version was specified got overwritten somehow, which is what caused the issue.

Categories