help icon indicating copy to clipboard operation
help copied to clipboard

module.js:471 throw err;

Open dnyanesh-dev-repo opened this issue 9 years ago • 32 comments

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

dnyanesh-dev-repo avatar Jun 08 '17 07:06 dnyanesh-dev-repo

Hey did you fix your problem yet?

Knighton910 avatar Jun 09 '17 22:06 Knighton910

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.

kahwee avatar Jun 09 '17 22:06 kahwee

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

dnyanesh-dev-repo avatar Jun 12 '17 03:06 dnyanesh-dev-repo

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:

  • https://docs.npmjs.com/getting-started/installing-npm-packages-locally
  • https://docs.npmjs.com/getting-started/using-a-package.json

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

kahwee avatar Jun 12 '17 05:06 kahwee

thanks @kahwee

dnyanesh-dev-repo avatar Jun 13 '17 11:06 dnyanesh-dev-repo

I am closing this as solved.

tniessen avatar Jul 25 '17 12:07 tniessen

You are wonderful, it is work

alciomarhollanda avatar Oct 25 '17 16:10 alciomarhollanda

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

ayumishra avatar Oct 26 '17 10:10 ayumishra

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

Ariven1 avatar Nov 20 '17 05:11 Ariven1

Perfect solution @Ariven1 !!!! Thanks

dcoferraz avatar Nov 27 '17 12:11 dcoferraz

when I run npm run dev I get this error :

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

wafa363 avatar Feb 12 '18 10:02 wafa363

Hi wafa363, Did you followed the steps correctly ?

 Explain me how you did the above steps ?

Ariven1 avatar Feb 12 '18 11:02 Ariven1

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 avatar Feb 12 '18 11:02 wafa363

capture

wafa363 avatar Feb 12 '18 11:02 wafa363

@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.

ysiddiqui avatar Feb 23 '18 15:02 ysiddiqui

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

arifasultana avatar Feb 23 '18 16:02 arifasultana

i have same err i try all solution and nothing worked

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

rami-sweyri avatar Mar 05 '18 23:03 rami-sweyri

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 avatar Mar 22 '18 13:03 shivangi222

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

shivangi222 avatar Mar 22 '18 13:03 shivangi222

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)

zyl34389 avatar Mar 23 '18 01:03 zyl34389