Error while lifting a sails.js project - node.js

I'm getting this error, which I can't really understand:
info: Starting app...
/Users/Sammy/Projects/MyProject/node_modules/mongodb/lib/utils.js:98
process.nextTick(function() { throw err; });
^
Error: Cannot find module '../fixtures'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at /Users/Sammy/Projects/MyProject/config/bootstrap.js:23:31
at wrapper (/Users/Sammy/Projects/MyProject/node_modules/waterline/node_modules/lodash/index.js:3592:19)
at applyInOriginalCtx (/Users/Sammy/Projects/MyProject/node_modules/waterline/lib/waterline/utils/normalize.js:421:80)
at wrappedCallback (/Users/Sammy/Projects/MyProject/node_modules/waterline/lib/waterline/utils/normalize.js:324:18)
at success (/Users/Sammy/Projects/MyProject/node_modules/waterline/node_modules/switchback/lib/normalize.js:33:31)
at _switch (/Users/Sammy/Projects/MyProject/node_modules/waterline/node_modules/switchback/lib/factory.js:58:28)
at returnResults (/Users/Sammy/Projects/MyProject/node_modules/waterline/lib/waterline/query/finders/basic.js:392:9)
at /Users/Sammy/Projects/MyProject/node_modules/waterline/lib/waterline/query/finders/basic.js:272:16
at /Users/Sammy/Projects/MyProject/node_modules/waterline/lib/waterline/query/finders/operations.js:83:7
at /Users/Sammy/Projects/MyProject/node_modules/waterline/node_modules/async/lib/async.js:52:16
at Object.async.forEachOf.async.eachOf (/Users/Sammy/Projects/MyProject/node_modules/waterline/node_modules/async/lib/async.js:236:30)
at Object.async.forEach.async.each (/Users/Sammy/Projects/MyProject/node_modules/waterline/node_modules/async/lib/async.js:209:22)
at /Users/Sammy/Projects/MyProject/node_modules/waterline/lib/waterline/query/finders/operations.js:436:11
at /Users/Sammy/Projects/MyProject/node_modules/waterline/lib/waterline/query/finders/operations.js:574:5
at /Users/Sammy/Projects/MyProject/node_modules/waterline/node_modules/async/lib/async.js:52:16
at Object.async.forEachOf.async.eachOf (/Users/Sammy/Projects/MyProject/node_modules/waterline/node_modules/async/lib/async.js:236:30)
at Object.async.forEach.async.each (/Users/Sammy/Projects/MyProject/node_modules/waterline/node_modules/async/lib/async.js:209:22)
at module.exports._buildChildOpts (/Users/Sammy/Projects/MyProject/node_modules/waterline/lib/waterline/query/finders/operations.js:464:9)
at module.exports._execChildOpts (/Users/Sammy/Projects/MyProject/node_modules/waterline/lib/waterline/query/finders/operations.js:432:8)
at /Users/Sammy/Projects/MyProject/node_modules/waterline/lib/waterline/query/finders/operations.js:81:10
at wrapper (/Users/Sammy/Projects/MyProject/node_modules/waterline/node_modules/lodash/index.js:3592:19)
at applyInOriginalCtx (/Users/Sammy/Projects/MyProject/node_modules/waterline/lib/waterline/utils/normalize.js:421:80)
at wrappedCallback (/Users/Sammy/Projects/MyProject/node_modules/waterline/lib/waterline/utils/normalize.js:324:18)
at success (/Users/Sammy/Projects/MyProject/node_modules/waterline/node_modules/switchback/lib/normalize.js:33:31)
Does it have to do with waterline? Is a module missing? What's this "fixtures" module?
Thanks in advance,
Sammy

It looks like something is missing from your node_modules folder.
Try doing an npm cache clear and a clean npm install
In your project folder run:
npm cache clear && rm -rf node_modules && npm install
Hope it helps

Related

No definite solution on Windows for Cannot find module 'graceful-fs' Error on React Native App Create Start Up

`PS C:\Users\Adrien\Documents\ReactNativeProjects> npx react-native start
node:internal/modules/cjs/loader:1042
throw err;
^
Error: Cannot find module 'graceful-fs'
Require stack:
- C:\Users\Adrien\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\#react-native-community\cli\build\tools\gracefulifyFs.js
- C:\Users\Adrien\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\#react-native-community\cli\build\bin.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)
at Module._load (node:internal/modules/cjs/loader:885:27)
at Module.require (node:internal/modules/cjs/loader:1105:19)
at require (node:internal/modules/cjs/helpers:103:18)
at _gracefulFs (C:\Users\Adrien\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\#react-native-community\cli\build\tools\gracefulifyFs.js:15:39)
at Object.<anonymous> (C:\Users\Adrien\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\#react-native-community\cli\build\tools\gracefulifyFs.js:22:1) at Module._compile (node:internal/modules/cjs/loader:1218:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1272:10)
at Module.load (node:internal/modules/cjs/loader:1081:32)
at Module._load (node:internal/modules/cjs/loader:922:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\Adrien\\AppData\\Local\\npm-cache\\_npx\\7930a8670f922cdb\\node_modules\\#react-native-community\\cli\\build\\tools\\gracefulifyFs.js',
'C:\\Users\\Adrien\\AppData\\Local\\npm-cache\\_npx\\7930a8670f922cdb\\node_modules\\#react-native-community\\cli\\build\\bin.js'
]
}
Node.js v18.13.0
Everytime I tried to create an App I got this as a response.
I tried to Open a Project like,
npx react-native init App2
I was expecting was for the project to get built, appear so that I could see all the project files.
I tried uninstalling and then reinstalling like,
npm install 'graceful-fs'
I tried the other solutions here too like apt-get or sudo and curl but it didn't work in my terminal`

How do devs maintain old projects?

A year ago I've made a project for a course: https://github.com/GeorgeFlorian/Finished_link_project
Now, I am trying to make it work on my machine, but I have no luck.
I've got npm 7.13.0 and node 16.1.0.
I've ran npm update in order to update all the depencies.
Steps
I've cloned the repo into a PC than runs Linux Mint 20.1
I've ran npm install
npm update
npm run build and npm run serve return the same error:
georgeflorian#georgeflorian-desktop:~/New Volume/VSCode Projects/Finished_link_project$ npm run build
> proiect-link#0.1.0 build
> vue-cli-service build
⠧ Building for production...
ERROR Failed to compile with 1 error 2:55:41 PM
Syntax Error: TypeError: Cannot read property 'parseComponent' of undefined
You may use special comments to disable some warnings.
Use // eslint-disable-next-line to ignore the next line.
Use /* eslint-disable */ to ignore all warnings in a file.
ERROR Build failed with errors.
I have no idea how to trace the error: Syntax Error: TypeError: Cannot read property 'parseComponent' of undefined.
Also, the NodeJS server won't start:
georgeflorian#georgeflorian-desktop:~/New Volume/VSCode Projects/Finished_link_project/server$ node app.js
node:internal/fs/utils:343
throw err;
^
Error: ENOENT: no such file or directory, stat '/home/georgeflorian/New Volume/VSCode Projects/Finished_link_project/dist/favicon.ico'
at Object.statSync (node:fs:1527:3)
at resolveSync (/home/georgeflorian/New Volume/VSCode Projects/Finished_link_project/node_modules/serve-favicon/index.js:187:17)
at favicon (/home/georgeflorian/New Volume/VSCode Projects/Finished_link_project/node_modules/serve-favicon/index.js:61:12)
at Object.<anonymous> (/home/georgeflorian/New Volume/VSCode Projects/Finished_link_project/server/app.js:46:9)
at Module._compile (node:internal/modules/cjs/loader:1109:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
at Module.load (node:internal/modules/cjs/loader:989:32)
at Function.Module._load (node:internal/modules/cjs/loader:829:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
at node:internal/main/run_main_module:17:47 {
errno: -2,
syscall: 'stat',
code: 'ENOENT',
path: '/home/georgeflorian/New Volume/VSCode Projects/Finished_link_project/dist/favicon.ico'
}
I believe that many dependencies are deprecated, but this begs two questions:
If it worked back then and it hasn't been touched since, why doesn't it work now ?
How can I fix all the deprecated dependencies if npm update did not fix them ?
Ultimately, I would like to learn how to approach this kind of situation. Thank you.

NodeJS nodegui module could not be found

Attempting to get nodegui running on a blank nodeJS project, but it won't run. The example starter-project runs fine, however I do not want to use webpack on my project.
Error when running node main.js:
internal/modules/cjs/loader.js:1208
return process.dlopen(module, path.toNamespacedPath(filename));
^
Error: The specified module could not be found.
\\?\C:\Users\user\Documents\project\node_modules\#nodegui\nodegui\build\Release\nodegui_core.node
�[90m at Object.Module._extensions..node (internal/modules/cjs/loader.js:1208:18)�[39m
�[90m at Module.load (internal/modules/cjs/loader.js:1002:32)�[39m
�[90m at Function.Module._load (internal/modules/cjs/loader.js:901:14)�[39m
�[90m at Module.require (internal/modules/cjs/loader.js:1044:19)�[39m
�[90m at require (internal/modules/cjs/helpers.js:77:18)�[39m
at Object.<anonymous> (C:\Users\user\Documents\project\node_modules\�[4m#nodegui�[24m\nodegui\dist\lib\utils\addon.js:3:15)
�[90m at Module._compile (internal/modules/cjs/loader.js:1158:30)�[39m
�[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)�[39m
�[90m at Module.load (internal/modules/cjs/loader.js:1002:32)�[39m
�[90m at Function.Module._load (internal/modules/cjs/loader.js:901:14)�[39m
main.js:
const { QMainWindow } = require("#nodegui/nodegui");
const win = new QMainWindow();
win.show();
global.win = win;
When running npm install #nodegui/nodegui this is the output.
Windows 10 x64 build 18363, NodeJS version 12.16.1, NPM version 6.14.2, NodeGUI version 0.16.0
npx qode main.js
or
npm exec qode main.js
It's seem specified module is missing in your project you need to run:
npm i --save specified

Node cannot find installed package

I have a simple nodejs client that uses grpc and protobuf to talk to a cpp grpc server.
My package.json contains the required packages:
"dependencies": {
"google-protobuf": "^3.9.1",
"grpc-web": "^1.0.6",
"webpack": "^4.39.2",
"webpack-cli": "^3.3.7"
}
I ran npm install and all the modules were installed in locally node_modules.
My client in in the same path as node_modules but when I launch it, I get an error saying that it cannot find the protobuf module.
From client.js:
var messages = require('../../messages/proto/output/work_pb.js');
var services = require('../../messages/proto/output/work_grpc_web_pb.js');
var grpc = require('grpc');
Running the client:
node client.js
Error: Cannot find module 'google-protobuf'
Require stack:
- /home/work/messages/proto/output/work_pb.js
- /home/work/frontend/web/client.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:713:15)
at Function.Module._load (internal/modules/cjs/loader.js:618:27)
at Module.require (internal/modules/cjs/loader.js:771:19)
at require (internal/modules/cjs/helpers.js:68:18)
at Object.<anonymous> (/home/radu/work/admass/messages/proto/output/work_pb.js:11:12)
at Module._compile (internal/modules/cjs/loader.js:868:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:879:10)
at Module.load (internal/modules/cjs/loader.js:731:32)
at Function.Module._load (internal/modules/cjs/loader.js:644:12)
at Module.require (internal/modules/cjs/loader.js:771:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/work/messages/proto/output/work_pb.js',
'/home/work/frontend/web/client.js
Removing the entire node_modules folder and re-installing will work:
rm -rf node_modules
npm install
I ended up adding the node module inside '../../messages/ and removing it from pace where the proto files are being referenced, as to avoid conflicts.

Error: Cannot find module 'C:\server.js' in Node server for Meanjs

I have git cloned meanjs into a folder in D: drive as shown below and ran the command npm start to start the node server.
admin#admin-PC MINGW32 /d/Udemy Angular 1 projects/Project5/jobfinder (master)
$ npm start
> meanjs#0.5.0 start D:\Udemy Angular 1 projects\Project5\jobfinder
> gulp
[23:41:30] Using gulpfile D:\Udemy Angular 1 projects\Project5\jobfinder\gulpfile.js
....and got the below error.
Error: Cannot find module 'C:\server.js'
at Function.Module._resolveFilename (module.js:455:15)
at Function.Module._load (module.js:403:25)
at Module.runMain (module.js:590:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
[23:58:35] [nodemon] app crashed - waiting for file changes before starting...
After that, just to give it a try I copied the server.js from the current directory to C:\ and issued 'npm start' command at git bash from the same directory and the error changed to below.
Debugger listening on [::]:5858
module.js:457
throw err;
^
Error: Cannot find module './config/lib/app'
at Function.Module._resolveFilename (module.js:455:15)
at Function.Module._load (module.js:403:25)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\server.js:6:11)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
[23:41:52] [nodemon] app crashed - waiting for file changes before starting...
Can anyone please help me understand why is Node looking for server.js and other resources at C:\ instead of the current directory? Is there anything very simple I am missing out (though I find it quite strange !). Btw sorry for posting the git bash errors as code since I did not have enough reputations to post more than one image link.
Cheers!
Adding my research ....
Invoking 'npm start' command in meanjs directory hits the file gulpfile.js. Looking into the file, I saw that a gulp task (nodemon) was initiated as below and the script property of the return object was set to 'server.js'.
Code from gulpfile.js.
gulp.task('nodemon', function () {
var nodeVersions = process.versions;
var debugArgument = '--debug';
switch (nodeVersions.node.substr(0, 1)) {
case '4':
case '5':
case '6':
debugArgument = '--debug';
break;
case '7':
debugArgument = '--inspect';
break;
}
console.log('nodemon task'); // checking execution of the callback
return plugins.nodemon({
script: 'server.js',
nodeArgs: [debugArgument],
ext: 'js,html',
verbose: true,
watch: _.union(defaultAssets.server.views, defaultAssets.server.allJS, defaultAssets.server.config)
});
});
The above problem was solved by deleting the Autorun string in the registry at the below path.
"HKEY_CURRENT_USER\Software\Microsoft\Command Processor".
The autorun string was set to C: and as a result Nodemon recognised C: as the root instead of the current directory in Gitbash or command prompt.

Resources