Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module.js:471 throw err; #663

Closed
dnyaneshwar1991 opened this issue Jun 8, 2017 · 32 comments
Closed

module.js:471 throw err; #663

dnyaneshwar1991 opened this issue Jun 8, 2017 · 32 comments

Comments

@dnyaneshwar1991
Copy link

Hi,
I have installed all required libraries for node-pocketsphinx given in below link https://www.npmjs.com/package/pocketsphinx
But when I try to execute example code I got following error
module.js:471
throw err;
^

Error: Cannot find module 'pocketsphinx'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/home/jjadhad/nodejs/test.js:3:33)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)

please help

@Knighton910
Copy link
Contributor

Hey did you fix your problem yet?

@kahwee
Copy link

kahwee commented Jun 9, 2017

We need more context. I'm guessing you may be in the wrong directory.

Can you try to print out these commands?

ls -al node_modules

It will be helpful to send your .js file as well.

@dnyaneshwar1991
Copy link
Author

dnyaneshwar1991 commented Jun 12, 2017

@kahwee I tried this command but it shows "ls: cannot access node_modules: No such file or directory"

@kahwee
Copy link

kahwee commented Jun 12, 2017

It looks like you did not install your modules correctly.

Typically, if your project is in ./my-project, it should be a package.json and when you run npm install, it should install dependencies based on versions specified in that file. Your installed modules will be in ./my-project/node_modules

Take a look at npm's documentation and there's a video that can help you get started:

Without having node_modules in your source directory, you will not be able to run scripts that require them.

@dnyaneshwar1991
Copy link
Author

thanks @kahwee

@tniessen
Copy link
Member

I am closing this as solved.

@alciomarhollanda
Copy link

You are wonderful, it is work

@ayumishra
Copy link

Hi,
i try to execute my code ,but I got following error,
module.js:471
throw err;
^

Error: Cannot find module 'rxjs/add/operator/map'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (C:\projectang\node_modules@angular-devkit\core\src\l
ogger\indent.js:10:1)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)

please help me out

@Ariven1
Copy link

Ariven1 commented Nov 20, 2017

I solved this issue by doing the following

  1. C: drive -> Users -> "username" eg. john -> AppData -> Roaming

  2. Inside the "Roaming" folder you need to delete both "npm" and "npm-cache"
    folder.

  3. Now build your project, and it should work

@dcoferraz
Copy link

Perfect solution @Ariven1 !!!!
Thanks

@wafa363
Copy link

wafa363 commented Feb 12, 2018

when I run npm run dev I get this error :

module.js:471
throw err;
^
I couldn't fix that using the mentioned solutions

@Ariven1
Copy link

Ariven1 commented Feb 12, 2018

Hi wafa363,
Did you followed the steps correctly ?

 Explain me how you did the above steps ?

@wafa363
Copy link

wafa363 commented Feb 12, 2018

Well the last solution I did is to add "node node_modules/ in each line in the file "package.json" and the errors are gone but I've done changes in app.scss file and I don't see anything when I run npm run watch .. neither the errors nor the changes

{ "private": true, "scripts": { "dev": "npm run development", "development": "node node_modules/cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", "watch": "node node_modules/cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", "watch-poll": "node node_modules/npm run watch -- --watch-poll", "hot": "node node_modules/cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js", "prod": "node node_modules/npm run production", "production": "node node_modules/cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" }, "devDependencies": { "axios": "^0.17", "bootstrap": "^4.0.0", "popper.js": "^1.12", "cross-env": "^5.1", "jquery": "^3.2", "laravel-mix": "^2.0", "lodash": "^4.17.4", "vue": "^2.5.7" } }

@wafa363
Copy link

wafa363 commented Feb 12, 2018

capture

@ysiddiqui
Copy link

@Ariven1 I did as you said, but now I'm getting

'ng' is not recognized as an internal or external command,
operable program or batch file.

@arifasultana
Copy link

in tjbot i am getting
sudo node conversation.js
module.js:472
throw err;
^

Error: Cannot find module './config'
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 Object. (/home/pi/tjbot/recipes/conversation/conversation.js:18:14)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:427:7)
at startup (bootstrap_node.js:151:9)
at bootstrap_node.js:542:3
please help me out

@rami-sweyri
Copy link

i have same err
i try all solution and nothing worked

events.js:183 throw er; // Unhandled 'error' event ^

@shivangi222
Copy link

module.js:549
throw err;
^

Error: Cannot find module '/home/shivanya/app.js'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:188:16)
at bootstrap_node.js:609:3

..please help me out this problem

@shivangi222
Copy link

module.js:549
throw err;
^

Error: Cannot find module '/home/shivanya/app.js'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:188:16)
at bootstrap_node.js:609:3

@zyl34389
Copy link

when i run this "node install_chaincode.js"

Error: Cannot find module '/home/zyl/marbles/config/[object Object]'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at module.exports (/home/zyl/marbles/utils/connection_profile_lib/index.js:22:14)
at Object. (/home/zyl/marbles/scripts/install_chaincode.js:35:84)
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)

@tniessen
Copy link
Member

Please do not post stack traces without context, there is no way we can help you based on that. Please read the documentation on module resolution and the usage synopsis and if you still feel like you need help, please provide context, what you are trying to do, what you did to achieve that goal, the stack trace and anything else that might be helpful. If you feel like this is a problem with the package you are trying to install, you can report the problem to the package maintainers.

@alandolsi
Copy link

I have the same error, i need help please

module.js:478
throw err;
^

Error: Cannot find module './js/modules'
at Function.Module._resolveFilename (module.js:476:15)
at Function.Module._load (module.js:424:25)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object. (/mnt/e/mdb-4.5.1/gulpfile.js:6:17)
at Module._compile (module.js:577:32)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)

@tniessen
Copy link
Member

@alandolsi Please look at the comment right above yours.

@Gamezpedia
Copy link

@tniessen hi i am having the same cannot find module problem.

STEPS:

mkdir test
cd test

npm init -y

mkdir src
touch src/index.js

yarn add graphql-yoga

in index.js just adding these lines const { GraphQLServer } = require('graphql-yoga')

and : doing

node src/index.js

RESULT

PS I:\GraphQL\test_projects\testa> node src/index.js
module.js:549
    throw err;
    ^

Error: Cannot find module 'graphql-yoga'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (I:\GraphQL\test_projects\testa\src\index.js:1:89)
    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)

I TRIED

C: drive -> Users -> "username" eg. john -> AppData -> Roaming

Inside the "Roaming" folder you need to delete "npm-cache"
folder.
 
no luck it's still the same .

@tniessen
Copy link
Member

@Gamezpedia Works for me, does the folder I:\GraphQL\test_projects\testa\node_modules\graphql-yoga exist and is there a valid package.json file? If not, then it is probably a problem with yarn. Which OS, yarn, npm and node versions are you using?

@Gamezpedia
Copy link

@tniessen hi, i just figured out that the problem was with the graphql-yoga package version, i downgraded it to the previous version and it worked as expected. thanks

@ShanthanVoruganti
Copy link

@shivangi222 Hi, Is the issue resolved? If so, can you provide the solution as I am facing the same problem.

@rakeshrnjn
Copy link

I solved this issue by doing the following

C: drive -> Users -> "username" eg. john -> AppData -> Roaming

Inside the "Roaming" folder you need to delete both "npm" and "npm-cache"
folder.

Now build your project, and it should work

  • worked for me. 👍

@gsmgitdev
Copy link

@kahwee thank Man You Are Life saver

@gg-gg-v1
Copy link

Can some one please help me on this ?

After running ng build command, I entered the command node dist/server.js and I got the following error.

Basically I am trying to convert my angular 5 app to universal app (for SEO purpose) using this link

https://github.com/angular/angular-cli/wiki/stories-universal-rendering#step-5-setup-a-webpack-config-to-handle-this-node-serverts-file-and-serve-your-application

C:\Y_ntt\Try-Angular-v4-master>node dist/server.js
module.js:549
throw err;
^

Error: Cannot find module 'C:\Y_ntt\Try-Angular-v4-master\dist\server.js'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3

my dist folder content
error

apart from the command node dist/server.js , I tried following commands also but none of them working
node server.js
node dist/server.js

and if try to run this command node dist/server/main.js
I got following error

C:\Y_ntt\Try-Angular-v4-master>node dist/server/main.js
C:\Y_ntt\Try-Angular-v4-master\node_modules\ngx-bootstrap\carousel\carousel.component.js:14
import { Component, Input, Output, EventEmitter, NgZone } from '@angular/core';
^^^^^^

SyntaxError: Unexpected token import
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.ngx-bootstrap/carousel/carousel.component (C:\Y_ntt\Try-Angular-v4-master\dist\server\main.js:2765:18)

@selvapayagri
Copy link

selvapayagri commented Oct 10, 2018

How to Solve this error? Please help me

cordova build android --release
C:\Users\Payagri1\AppData\Roaming\npm\node_modules\cordova\node_modules\insight\node_modules\configstore\index.js:69
throw err;
^

Error: EBUSY: resource busy or locked, rename 'C:\Users\Payagri1.config\configstore\insight-cordova.json.3102825954' -> 'C:\Users\Payagri1.config\configstore\insight-cordova.json'
at Object.fs.renameSync (fs.js:766:18)
at Function.writeFileSync [as sync] (C:\Users\Payagri1\AppData\Roaming\npm\node_modules\cordova\node_modules\insight\node_modules\write-file-atomic\index.js:124:8)
at Configstore.set (C:\Users\Payagri1\AppData\Roaming\npm\node_modules\cordova\node_modules\insight\node_modules\configstore\index.js:62:21)
at new Configstore (C:\Users\Payagri1\AppData\Roaming\npm\node_modules\cordova\node_modules\insight\node_modules\configstore\index.js:27:11)
at new Insight (C:\Users\Payagri1\AppData\Roaming\npm\node_modules\cordova\node_modules\insight\lib\index.js:38:34)
at Object. (C:\Users\Payagri1\AppData\Roaming\npm\node_modules\cordova\src\telemetry.js:26:15)
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)
[ERROR] An error occurred while running subprocess cordova.

    cordova build android --release exited with exit code 1.

    Re-running this command with the --verbose flag may provide more information.

@nodejs nodejs locked as resolved and limited conversation to collaborators Oct 10, 2018
@Trott
Copy link
Member

Trott commented Oct 10, 2018

I'm locking this issue to prevent continued reporting of unrelated problems. Please feel free to open a new issue to ask for help with issues you are experiencing using Node.js. (And maybe take a look at #663 (comment) for suggestions on what to include in your question.)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests