How do devs maintain old projects? - node.js

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.

Related

Error while trying to deploy page - npm errors

I am trying to deploy my github page on Cloudfare and I am getting a bunch of errors. I tried installing lating versions od npm and node.js but I really dont understand what I need to do to fix them. Also, looked in my package.json file and I dont have a script for a build. Do I add one, and if so, what do I add to the scripts section? Here is the error message:
ERROR: npm v9.4.2 is known not to run on Node.js v12.18.0. You'll need to upgrade
07:11:10.568 to a newer Node.js version in order to use this version of npm. This version of
07:11:10.569 npm supports the following node versions: ^14.17.0 || ^16.13.0 || >=18.0.0. You
07:11:10.569 can find the latest version at https://nodejs.org/.
07:11:10.569
07:11:10.569 ERROR:
07:11:10.569 /opt/buildhome/repo/node_modules/npm/lib/utils/exit-handler.js:21
07:11:10.570 const hasLoadedNpm = npm?.config.loaded
07:11:10.570 ^
07:11:10.570
07:11:10.570 SyntaxError: Unexpected token '.'
07:11:10.570 at wrapSafe (internal/modules/cjs/loader.js:1054:16)
07:11:10.570 at Module._compile (internal/modules/cjs/loader.js:1102:27)
07:11:10.570 at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
07:11:10.570 at Module.load (internal/modules/cjs/loader.js:986:32)
07:11:10.570 at Function.Module._load (internal/modules/cjs/loader.js:879:14)
07:11:10.571 at Module.require (internal/modules/cjs/loader.js:1026:19)
07:11:10.571 at require (internal/modules/cjs/helpers.js:72:18)
07:11:10.571 at module.exports (/opt/buildhome/repo/node_modules/npm/lib/cli.js:81:23)
07:11:10.571 at Object. (/opt/buildhome/repo/node_modules/npm/bin/npm-cli.js:2:25)
07:11:10.571 at Module._compile (internal/modules/cjs/loader.js:1138:30)
07:11:10.577 Failed: build command exited with code: 1
07:11:11.469 Failed: an internal error occurred
I tried installing latest versions of npm and node.js and waas expecting it to be updated but i am getting the same error.

node installed but npm is not installed

Problem
node -v is working but,
npm -v is not working, error
Error encountered
C:\Users\HackerGprat>node -v
v19.2.0
C:\Users\HackerGprat>npm -v
node:internal/modules/cjs/loader:1039
const err = new Error(message);
^
Error: Cannot find module '../package.json'
Require stack:
- C:\Users\HackerGprat\AppData\Roaming\npm\node_modules\npm\lib\cli.js
- C:\Users\HackerGprat\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
←[90m at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)←[39m
←[90m at Module._load (node:internal/modules/cjs/loader:885:27)←[39m
←[90m at Module.require (node:internal/modules/cjs/loader:1105:19)←[39m
←[90m at require (node:internal/modules/cjs/helpers:103:18)←[39m
at createEnginesValidation ←[90m(C:\Users\HackerGprat\←[39mAppData\Roaming\npm\node_modules\←[4mnpm←[24m\lib\cli.js:7:15←[90m)←[39m
at module.exports ←[90m(C:\Users\HackerGprat\←[39mAppData\Roaming\npm\node_modules\←[4mnpm←[24m\lib\cli.js:73:27←[90m)←[39m
at Object.<anonymous> ←[90m(C:\Users\HackerGprat\←[39mAppData\Roaming\npm\node_modules\←[4mnpm←[24m\bin\npm-cli.js:2:25←[90m)←[39m
←[90m at Module._compile (node:internal/modules/cjs/loader:1218:14)←[39m
←[90m at Module._extensions..js (node:internal/modules/cjs/loader:1272:10)←[39m
←[90m at Module.load (node:internal/modules/cjs/loader:1081:32)←[39m {
code: ←[32m'MODULE_NOT_FOUND'←[39m,
requireStack: [
←[32m'C:\\Users\\HackerGprat\\AppData\\Roaming\\npm\\node_modules\\npm\\lib\\cli.js'←[39m,
←[32m'C:\\Users\\HackerGprat\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js'←[39m
]
}
Node.js v19.2.0
Try : 1
walkthrough installation
👆 my doubt is i did not checked ☑ the options of automatic install necessary tools becuase it will take lots of mb so i skiped it.. and by default it was unchecked too [ ]
it did not working, and given me error,
Try : 2
it's working on sandbox but not in real pc.
Try : 3
tried to copy all installation folder from sandbox to real pc,
node -v -> working
npm -v -> not working, error
Try : 4
Trying without installing node, copied from sandbox
node -v -> working
npm -v -> not working, error
Try : 5
Tried to change the location with new name NJS
node -v -> working
npm -v -> not working, error
Try 6 : Successfully Installed npm
as you can see the last line
requireStack: [
←[32m'C:\\Users\\HackerGprat\\AppData\\Roaming\\npm\\node_modules\\npm\\lib\\cli.js'←[39m,
←[32m'C:\\Users\\HackerGprat\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js'←[39m
]
its pointing to AppData folder,
and saying there is npm folder
just delete that npm folder and reinstall the node
and see it started again working..
results

pod install fails in integrated vs terminal

I'm trying to run a pod update from my integrated VS-code terminal (react-native project) but it keeps throwing this error:
node:internal/modules/cjs/loader:936 throw err; ^
Error: Cannot find module '/Users/.../App/node_modules/#react-native-community/cli/build/bin.js Debugger attached. Waiting for the debugger to disconnect...'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 { code: 'MODULE_NOT_FOUND', requireStack: [] }
Node.js v17.6.0
[!] Invalid `Podfile` file: 859: unexpected token at ''.
target 'appname' do
config = use_native_modules! use_react_native!(
I already tried removing package-lock.json, node_modules, and reinstalling.
If I run the command in a normal terminal I have no problems, any ideas?
Please try this:
step 1: pod deintegrate
step 2: pod install

node-sass error deploying react to elastic beanstalk

I am trying to deploy a reactjs app to an elastic beanstalk instance and seem to be encountering several issues.
1) I am receiving this error in the health section for elastic beanstalk:
/opt/elasticbeanstalk/containerfiles/ebnode.py --action npm-install
node-sass#4.9.3 install /tmp/deployment/application/node_modules/node-sass
node scripts/install.js
Unable to save binary
/tmp/deployment/application/node_modules/node-sass/vendor/linux-x64-57
: { Error: EACCES: permission denied, mkdir
'/tmp/deployment/application/node_modules/node-sass/vendor' at
Object.fs.mkdirSync (fs.js:885:18) at sync
(/tmp/deployment/application/node_modules/mkdirp/index.js:71:13) at
Function.sync
(/tmp/deployment/application/node_modules/mkdirp/index.js:77:24) at
checkAndDownloadBinary
(/tmp/deployment/application/node_modules/node-sass/scripts/install.js:114:11)
at Object.
(/tmp/deployment/application/node_modules/node-sass/scripts/install.js:157:1)
at Module._compile (module.js:652:30) at Object.Module._extensions..js
(module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad
(module.js:505:12) at Function.Module._load (module.js:497:3) errno:
-13, code: 'EACCES', syscall: 'mkdir', path: '/tmp/deployment/application/node_modules/node-sass/vendor' }
2) At the same time it appears as if node and npm are claiming all of the resources for my ec2 instance and this seems to continue even after the deployment fails.
What could be the cause of this failure? The other packages seems to be deploying as they are in the node_modules folder? Additionally, why would node take up resources in this fashion?
The reactjs app is using webpack and node-sass ^4.9.3 and node version 8.11.3 which works on my local environment.
Update: .npmrc solved the permission issue. I am still having a problem with the cpu being 100%. In the build script, the code is not getting past this line, I adding console.log lines at various points in the code:
let compiler = webpack(config);
After this line is hit, I am not seeing any advancement. Could this be a webpack issue?
I think this might the same issue described here
So apparently npm install takes too long during automated deployments
on t1.micro instances, bumping to a t2.small gives enough power to get
the task done.
There is an alternative js only module just called sass. Seems to work ok, but not as up to date as none-sass.

Error while lifting a sails.js project

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

Resources