nodejs Error: Cannot find module '.-audio' - node.js

Error: Cannot find module '.-audio'
at Function.Module._resolveFilename (module.js:538:15)
at Function.Module._load (module.js:468:25)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (F:\Stage_ete_2018_XperMedia\2eme stage\transcription-service-master\bin\lib\job.js:6:25)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
I already did :
npm install
npm install -audio
then after executing a google-cloud Error pop up and so on, if install one module the other pop up.

npm install -audio
This does nothing, it ignores non existing options that start with a -. NPM also does not give an error, as I tried with -something_that_does_exists_for_sure as an option.
I guess you want to install the audio package: https://github.com/audiojs/audio
npm install audio
+ audio#1.2.0
added 2 packages in 1.97s
It should read that it added two packages, I think you didnt install it yet.
Also I do not understand the .- in your error:
Error:Cannot find module '.-audio'
Below is how the code example looks like in the audio package readme. See it has no dots, nor minus symbols.
const Audio = require('audio')
Audio.load('./sample.mp3').then(audio =>
audio
.trim()
.normalize()
.fade(.5)
.fade(-.5)
.save('sample-edited.wav')
)
I guess you also need to remove those from your code. Dots are only needed if you want to require files from a certain directory, not for packages installed with NPM.

You can try with this once,
Remove node_modules folder from your project directory
npm install
npm install <your_package_name> --save

Related

Cannot find module '../build/Release/zmq.node' after Pop-OS/Ubuntu update

I recently updated my operating system, which is Pop-OS, which is a Ubuntu's distribution. Before updating, I could run nodejs with ZeroMQ perfectly. Now, I can't run any file with ZeroMQ, not even with just this SLOC-line: const zmq = require('zeromq')
I am using Visual Studio code and also I tried to uninstall and install from scratch nodejs and npm and nothing works.
This is the error:
myuser#pop-os:~/Documents/Lab/fuentes$ node publicadorServer.js
node:internal/modules/cjs/loader:922
throw err;
^
Error: Cannot find module '../build/Release/zmq.node'
Require stack:
- /home/myuser/node_modules/zeromq/lib/index.js
- /home/myuser/node_modules/zeromq/index.js
- /home/myuser/Documents/Lab/fuentes/publicadorServer.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:15)
at Function.Module._load (node:internal/modules/cjs/loader:763:27)
at Module.require (node:internal/modules/cjs/loader:991:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.<anonymous> (/home/myuser/node_modules/zeromq/lib/index.js:6:11)
at Module._compile (node:internal/modules/cjs/loader:1102:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1131:10)
at Module.load (node:internal/modules/cjs/loader:967:32)
at Function.Module._load (node:internal/modules/cjs/loader:807:14)
at Module.require (node:internal/modules/cjs/loader:991:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/myuser/node_modules/zeromq/lib/index.js',
'/home/myuser/node_modules/zeromq/index.js',
'/home/myuser/Documents/Lab/fuentes/publicadorServer.js'
]
}
I have installed ZeroMQ with this command at the directory of the project : npm install zeromq#5
Any help would be appreciated.
Finally I could fix it, only with the command npm rebuild.
Unbelievable. I guess, installing a new version of node and the new operating system version make necessary to rebuild it, but I still don't understand that, if I uninstall nodejs and npm, why it was not working. Fortunately, it's all fixed.

Executing node.js programs

I am totally new to node.js and trying to run a program I downloaded from github (as a zip file, instead of git clone). I installed npm, node and python. I added python to the path and added the PYTHON variable. I did an npm install from inside the exploded zip archive. Reading stackoverflow, I I redid as the install as "npm -g install".
I am trying to run charCryptoExample.js from inside the Samples directory. When I execute
node Samples\charCryptoExample.js
I get:
module.js:549
throw err;
^
Error: Cannot find module './dist/node'
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> (C:\Users\D\Desktop\node-ld-master\node-ld-master\index.js:1:80)
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 am not sure where to begin solving this; I thought the install created the contents of the dist directories. Assuming that the code on github is working, are there build process steps that I am missing?
Yeh, it sounds like you need to build the project.
Have a look in package.json where you should find a "scripts" section. You're looking for a build or compile script (but could be anything).
If you find one, then you can run it with:
$ npm run build or $ npm run compile
Failing that, go back to the README of the project where you'll hopefully find build instructions.

Ember Installation Issue: SyntaxError: Use of const in strict mode

When trying to install Ember.js on Windows (and possibly other systems), after running the following commands:
npm install -g npm
npm install -g ember-cli
npm install -g bower
No errors are raised, how the command ember -v outputs the following:
C:\Users\<user>\AppData\Roaming\npm\node_modules\ember-cli\lib\cli\index.js:3
const willInterruptProcess = require('../utilities/will-interrupt-process');
^^^^^
SyntaxError: Use of const in strict mode.
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at C:\Users\Shayn\AppData\Roaming\npm\node_modules\ember-cli\bin\ember:26:11
at C:\Users\Shayn\AppData\Roaming\npm\node_modules\ember-cli\node_modules\resolve\lib\async.js:50:13
at processDirs (C:\Users\Shayn\AppData\Roaming\npm\node_modules\ember-cli\node_modules\resolve\lib\async.js:182:39)
This suggests an issue with my Ember installation, how can I address this?
The solution is suggested in a few other answers, for example this one, however this exact solution will not work on Windows.
Instead, the best solution is to get the latest version of Node installed via an installer.
To verify after installation try the following:
node --version
Which should output something like:
v8.9.1
Previously this command would have given a lower version number. In my case it was similar to v0.12.

MEAN stack, cannot find module 'request'

I'm new to mean stack world, I installed mongoDB and nodejs
node -v => v4.4.3
npm -v => 2.15.1
mongo -version => MongoDB shell version: 3.2.6
then followed MEAN installation guide to install it.
after many faults I can run gult and have a response.
now when ever I try to run any command with mean, I get following error:
module.js:327
throw err;
^
Error: Cannot find module 'request'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/usr/lib/node_modules/mean-cli/lib/controllers/anonymized-data.js:8:12)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
I tried with: sudo npm install request
but still getting same issue !! can any one guide me please? thanks in advance
UPDATE
after running command given by #Alexander Mac, I got following result
it's still same status :( . and without sudo I got lots or errors #Seth :P
Alex is right about 'request' not being part of the package. That said, instead of messing out with the install manually, it might be far easier to install a previous known good version
For e.g., you can try: sudo npm i -g mean-cli#0.12.1
mean-cli package has a bug. The authors forget to include request module in package.json: look here. You can create an issue about that on their site.
To resolve the problem locally go to /usr/lib/node_modules/mean-cli and run: sudo npm i request to install missing request module.
I use nvm to manage node.
I go to /home/ougwen1235/.nvm/versions/node/v4.2.4/lib/node_modules/mean-cli and run npm install request --save.Then, the problem was solved.

cannot find module 'config-chain'

This is my first post, so forgive me for formatting issues. I was following this mean.io tutorial: https://www.youtube.com/watch?v=0aMNWYpG5sk. It basically gets you to the point where you can locally access the default web app. I was able to do so successfully.The video then suggests to run>
mean package myTheme
I received this error...
C:\Users\****\myApp>mean package myTheme
module.js:339
throw err;
^
Error: Cannot find module 'config-chain'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (C:\Users\****\AppData\Roaming\npm\node_modules\mean-cli\node_modules\npm\lib\config\core.js:2:10)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
I'm running npm 2.14.7 and node v4.2.3(video uses 4.2.2) on Win 10. I had previously tried this on node 5.3 and received the same error. I also tried cleaning cache & updating npm, bower, and gulp.
I found C:\Users****\myApp\node_modules\config-chain. Do I need to change something here?
Any help would be greatly appreciated. If I need to provide more information, just ask. Thanks!
I guess something was wrong with mean-cli.
I reran:
npm install -g mean-cli
npm install (inside project folder)
My issue was resolved. Hope this helps someone else.
I just removed and re-installed and everything worked. Go figure. I also had to use sudo because I'm on a mac.
sudo npm install -g ember-cli#2.5
The problem is when you install config-chain it installs in your project directory node_modules but cordova add browser is looking in global modules. This is what I did, went outside the directory and ran npm install -g config-chain That resolved this module and asked for more do the same thing for all modules it complains and you should be good.

Resources