Unable to preview / run angular.js project from codenvy - javascript

I developed an angular.js project on codenvy IDE on Javascript framework ( or is it platform). I am unable to preview the same.
I get the following error.
[ERROR] Failed to start application. : ====> /logs/stderr.log <==== node.js:134 throw e; // process.nextTick error, or 'error' event on first tick ^ Error: Cannot find module 'gulp' at Function._resolveFilename (module.js:326:11) at Function._load (module.js:271:25) at require (module.js:355:19) at Object.(/var/vcap.local/dea/apps/app-07zsn86eb8vspvg0-0-bf2638b3e702ededc5473a0c16608d37/app/gulpfile.js:1:74) at Module._compile (module.js:411:26) at Object..js (module.js:417:10) at Module.load (module.js:343:31) at Function._load (module.js:302:12) at Array. (module.js:430:10) at EventEmitter._tickCallback (node.js:126:26)
The console output says it cannot find Gulp, but my project certainly has gulp.js on the root folder. Also the project works perfectly fine when i preview this from a Webstorm editor - so i dont think there is an issue with the code per se..
Any help much appreciated
James

If your project is public, please, share it with Codenvy's factory feature. So everyone will be able to look what is wrong with the project. (You can access factory on left panel of the IDE)

Related

Cannot require nodejs files in electron worker process

I am running a worker on a page of electron after a button click which runs the beginning part of the file just fine. But it gives me the error:
node:internal/modules/cjs/loader:940 Uncaught Error: Cannot find module './bar'
Require stack:
- electron/js2c/worker_init
at Module._resolveFilename (node:internal/modules/cjs/loader:940:15)
at o._resolveFilename (node:electron/js2c/worker_init:33:1095)
at Module._load (node:internal/modules/cjs/loader:785:27)
at c._load (node:electron/js2c/asar_bundle:5:13343)
at Module.require (node:internal/modules/cjs/loader:1012:19)
at require (node:internal/modules/cjs/helpers:102:18)
at 3a43803….js:21:5
foo.js is in the same directory as bar.js which is being run as a worker.
I checked the location of the directory and it shows:
C:\Users\programmer\project\node_modules\electron\dist\resources\electron.asar\worker
I expect the locaction to be:
C:\Users\programmer\project\dist\src
P.S. I researched further and found this but the solution for it did not work for me despite being my exact problem.

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

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

Node.js are not running

Using macOs High Sierra, trying to run small node.js code node server.js, from iTerm, showing this error:
module.js:545
throw err;
^
Error: Cannot find module '/Users/vikasenkova/server.js'
at Function.Module._resolveFilename (module.js:543:15)
at Function.Module._load (module.js:470:25)
at Function.Module.runMain (module.js:690:10)
at startup (bootstrap_node.js:194:16)
at bootstrap_node.js:666:3
Cant't find solution here.. if somebody knows..Found this link https://gist.github.com/DanHerbert/9520689 when trying to delete files with this: rm -rf /usr/local/lib/node_modules showing that permission denied. Nothing helps.
Check if your running in the same directory as the server.js file. Also update your question with some code to get more specific answer. Hope it helps you.

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