Cannont find module 'node-fetch' - javascript

I've been trying to run the code but it just shows this error i couldn't fix it because i'm not into coding that much i'm just trying to run the app
here's the error
Uncaught Error Error: Cannot find module 'node-fetch'
Require stack:
- c:\Users\As\Desktop\tiktok-downloader-main\index.js
at Module._resolveFilename (internal/modules/cjs/loader:956:15)
at Module._load (internal/modules/cjs/loader:804:27)
at Module.require (internal/modules/cjs/loader:1028:19)
at require (internal/modules/cjs/helpers:102:18)
at <anonymous> (c:\Users\As\Desktop\tiktok-downloader-main\index.js:6:15)
at Module._compile (internal/modules/cjs/loader:1126:14)
at Module._extensions..js (internal/modules/cjs/loader:1180:10)
at Module.load (internal/modules/cjs/loader:1004:32)
at Module._load (internal/modules/cjs/loader:839:12)
at executeUserEntryPoint (internal/modules/run_main:81:12)
at <anonymous> (internal/main/run_main_module:17:47)

Try looking for a file called package-lock.json in the tiktok-downloader-main folder. It could be in any of the sub folders. Once you find it, navigate to that folder in your terminal and run - npm install.
If you do not find the file called package-lock.json, look for yarn.lock file. If you find this file - in your terminal run yarn install.
These commands will work if you already have npm/yarn installed. For both of them, you will need nodejs installed.
Moreover, these commands have been tested on a Mac. Windows machine commands should be similar, but I do not gaurantee that these commands will work on windows machines as well.

Related

Ember.js - Error when running ember --version command

I am trying to run an ember.js app on my laptop but after installing the ember-cli and trying to run ember --version command I get an error.
To install ember-cli I used the following command - npm install -g ember-cli
It is probably important to mention that when I run ember --version command outside of the app directory it works, but when I run it inside app directory it crashes and gives error.
Node.js version - 8.11.3
This is the error that I get:
ember --version
/Users/user/go/src/github.com/apps/app/node_modules/ember-cli/node_modules/fs-extra/lib/mkdirs/make-dir.js:85
} catch {
^
SyntaxError: Unexpected token {
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
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)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/user/go/src/github.com/apps/app/node_modules/ember-cli/node_modules/fs-extra/lib/mkdirs/index.js:3:44)
As suggested in comments by Buck Doyle I changed Node.js version to 14.5.0 and ran ember --version command again, but I got a different error this time:
Node Sass does not yet support your current environment: OS X 64-bit with Unsupported runtime (83)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v3.13.1
Stack Trace and Error Report: /var/folders/bt/p_dtgwnd23gbv8nc7v_wpzmr0000gn/T/error.dump.ddc14c42b05e40a5181262bd0b9ad027.log
It is probably important to mention that when I run ember --version command outside of the app directory it works, but when I run it inside app directory it crashes and gives error.
Just wanted to answer this small piece. When you run ember inside of a directory with a package.json that includes ember-cli it will run the version of ember installed there. This is really nice when you're moving between a few apps with different versions of ember-cli, but can be surprising in situations like this.
replace catch with catch (error)
just had the same problem and solved it by replacing catch with catch(error) so you need to add (error) next to each catch.
i needed to change this in about 10 files. so you gotta change every time and run it so you see the new location of the error. best of luck

npm ReferenceError: primordials is not defined (node.js)

I know this question is posted many times but I tried the solutions and I can not resolve it. I am trying to work wit npm however I get this error:
evalmachine.<anonymous>:35
} = primordials;
^
ReferenceError: primordials is not defined
at evalmachine.<anonymous>:35:5
at Object.<anonymous> (C:\Users\User\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\fs.js:11:8)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Module.require (internal/modules/cjs/loader.js:1026:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (C:\Users\User\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:3:27)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
I can not even execute npm -v to see the version.
I tried to downgrade node to version 10.
I tried to uninstall-reinstall node so many times (From remove application settings).
I tried to create a file called "npm-shrinkwrap.json" insde the npm folder where package.json exists.
But there is no use.
And I can't see an "AppData" folder in the "Users/User" path but I can access it by "cd" from the command line. I don't understand how it is not visible.
Thank you.
It is resolved!
I know I said I uninstalled npm, but just uninstalling it from the settings were not enough. I tried to uninstall it deleting the node releted directories on my computer following this post: https://stackoverflow.com/a/11178106/13806114. And then I installed node again and it worked!
Thank you.
It's looking for the "primordials" method in graceful-fs, trying to reinstall this dependency.
About npm, try reinstalling nodejs again, probably your npm is corrupted
About AppData is not visible or is a hidden directory in Windows, you can access it by path in Windows Explorer

invalid ELF header in node.js on linux putty

I am facing the error invalid ELF header when I'm trying to run my node.js project on my printer having linux os using putty. The project was developed on windows. I'm attaching the whole error that I'm receiving. Please help.
stack=[Error: /sirius/rw/test/node-v8.11.1-linux-armv7l/node_modules/ref/build/Release/binding.node: invalid ELF header,
at Object.Module._extensions..node (module.js:681:18),
at Module.load (module.js:565:32),
at tryModuleLoad (module.js:505:12),
at Function.Module._load (module.js:497:3),
at Module.require (module.js:596:17),
at require (internal/module.js:11:18),
at bindings (/sirius/rw/test/node-v8.11.1-linux-armv7l/node_modules/ref/node_modules/bindings/bindings.js:81:44),
at Object.<anonymous> (/sirius/rw/test/node-v8.11.1-linux-armv7l/node_modules/ref/lib/ref.js:5:47),
at Module._compile (module.js:652:30),
at Object.Module._extensions..js (module.js:663:10)]
Because the project was developed on windows; npm needs to compile some node modules specially for the linux OS, so simply using the modules as is won’t always work.
First remove the node modules:
rm -rf node_modules/
Then generate the same modules for linux using the following command:
npm update
I hope this helps

NPM Permission errors even after resetting ownership

Been trying to install nodemon globally and although installed, I got a permission error when trying to run nodemon app.js in my terminal (using zsh). The following error:
/usr/local/lib/node_modules/nodemon/node_modules/configstore/index.js:53
throw err;
^
Error: EACCES: permission denied, open '/Users/carlosgrijalva/.config/configstore/update-notifier-nodemon.json'
You don't have access to this file.
at Error (native)
at Object.fs.openSync (fs.js:641:18)
at Object.fs.readFileSync (fs.js:509:33)
at Object.get (/usr/local/lib/node_modules/nodemon/node_modules/configstore/index.js:34:26)
at Object.Configstore (/usr/local/lib/node_modules/nodemon/node_modules/configstore/index.js:27:44)
at new UpdateNotifier (/usr/local/lib/node_modules/nodemon/node_modules/update-notifier/index.js:34:17)
at module.exports (/usr/local/lib/node_modules/nodemon/node_modules/update-notifier/index.js:123:23)
at Object.<anonymous> (/usr/local/lib/node_modules/nodemon/bin/nodemon.js:15:27)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
I found this article: https://docs.npmjs.com/getting-started/fixing-npm-permissions
And followed the instructions in option 1 by running the following command:
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
I'm debating reinstalling node and since i'm using 6.11 and figured I might as well use the latest version but I'm unsure if that's the wisest move at this point. If anyone has any other suggestions I'd really appreciate it.

GithubElectron: A JavaScript error occured in the browser process

I installed "electron-packager" using npm and executed the command
electron-packager . Johnston --platform=darwin --arch=x64 --version=0.36.0
And then I when I run the "Johnston.app", this error showed up (I didn't even see the main window)
Uncaught Exception: Error: Cannot find module 'electron'
at Function.Module._resolveFilename (module.js:332:15)
at Function.Module._load (module.js:282:25)
at Module.require (module.js:361:17)
at require (module.js:380:17)
at Object. (/Users/David/Github/Johnston/Johnston-darwin-x64/Johnston.app/Contents/Resources/app/main.js:3:18)
at Module._compile (module.js:426:26)
at Object.Module._extensions..js (module.js:444:10)
at Module.load (module.js:351:32)
at Function.Module._load (module.js:306:12)
at Object. (/Users/David/Github/Johnston/Johnston-darwin-x64/Johnston.app/Contents/Resources/atom.asar/browser/lib/init.js:104:10)
Is there any solutions? Thanks!
This likely has something to do with you having a different version of Electron installed on your machine that you are using to build with. In the folder for your app, run electron --version to get the version of electron that you have installed. Then, change the --version=0.36.0 to use whatever version you have installed.
If that doesn't fix it, then you should try rm -rf node_modules && npm install on your project. This will remove you node modules and then reinstall them all. If that doesn't work, please comment here and I will try to help again.

Categories