I have installed all the prerequisites and i am getting following error while registering node admin after npm install. If anyone can please help me out with the error:-
hitesh#hitesh-VirtualBox:~/medication-blockchain/drug-app$ node registerAdmin.js
/home/hitesh/medication-blockchain/drug-app/node_modules/fabric-client/node_modules/grpc/src/grpc_extension.js:57
throw e;
^
Error: Cannot find module '/home/hitesh/medication-blockchain/drug-app/node_modules/fabric-client/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-glibc/grpc_node.node'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (/home/hitesh/medication-blockchain/drug-app/node_modules/fabric-client/node_modules/grpc/src/grpc_extension.js:32:13)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
Errors like the one in question most commonly show up because of installing gRPC on one platform/architecture/Node version, and then using it on a different one. This often comes up when loading an installed library into a docker image, or switching Node versions using nvm. In many cases, this can be resolved by running npm rebuild in the environment where the code will be run.
When u cloned sample, u also copied the node_modules, which doesn't work with ur pc parameters. First, delete the node_modules, reinstall with npm install -g (globally), restart the app, works fine.
Stop all running containers, and remove them:
$docker stop $(docker ps -a -q)
$docker rm $(docker ps -a -q)
Delete node_modules:
$cd medication-blockchain/drug-app/node_modules
Restart from scratch:
$cd medication-blockchain/drug-app
$./startFabric.sh
$npm install -g
$node registerAdmin.js
$node registerUser.js
$node server.js
Related
I am not an expert in Vuejs or Vuecli, but I do manage to get stuff working.
I had a project i worked on before using Vuecli3 and webpack and now when I opened it after few weeks to make changes, i get the below error in dev mode
$ vue-cli-service serve --open --mode development --dashboard
internal/modules/cjs/loader.js:582
throw err;
^
Error: Cannot find module '../package.json'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
at Function.Module._load (internal/modules/cjs/loader.js:506:25)
at Module.require (internal/modules/cjs/loader.js:636:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (/Volumes/Drobo/Dropbox/NASDAQ Dubai/Marketdata-6-Indices/node_modules/.bin/vue-cli-service:5:25)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
Total task duration: 0.15s
The package.json file is right there in the root director and also the .lock file. Dont know what is the reason for this error in compiling.
Any help hightly appreciated
As #vesperknight mentioned in the comment, this issue tends to happen when you move the project's folder to another location.
To solve this (on Linux), from the root directory of your project:
Delete existing node modules.
rm -r node_modules
Reinstall all dependencies:
npm install
The first step seems to be important.
When I start a new tmux sessions with tmux, tmux new or tmux new-session, I get the following error:
module.js:549
throw err;
^
Error: Cannot find module '../lib/utils/unsupported.js'
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 /usr/local/lib/node_modules/npm/bin/npm-cli.js:19:21
at Object.<anonymous> (/usr/local/lib/node_modules/npm/bin/npm-cli.js:153:3)
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)
nvm is not compatible with the npm config "prefix" option: currently set to ""
Run `npm config delete prefix` or `nvm use --delete-prefix v10.8.0 --silent` to unset it.
I have tried the solution for this question i.e. npm delete prefix but to no avail: running outside the tmux session doesn't fix the problem, and running within the tmux session throws the top section of the previous error again (without the npm warning):
module.js:549
throw err;
^
Error: Cannot find module '../lib/utils/unsupported.js'
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 /usr/local/lib/node_modules/npm/bin/npm-cli.js:19:21
at Object.<anonymous> (/usr/local/lib/node_modules/npm/bin/npm-cli.js:153:3)
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)
This appears to be an issue with npm somehow as the .js error also occurs when I run npm --help. However, this only occurs within tmux.
Any solutions?
After digging on the internet I found some accepted answers:
Try config the $NVM_DIR reference again.
For example nvm use v7.10.0, and have the error: Run npm config delete prefix or nvm use --delete-prefix v7.10.0 --silent to unset it.
You need overwrite nvm prefix,
npm config set prefix $NVM_DIR/versions/node/v7.10.0
https://github.com/nvm-sh/nvm/issues/855#issuecomment-314309706
OR
If you're using any other shell than bash, make sure to configure your tmux that way:
# set default shell to zsh
set -g default-command /bin/zsh
set -g default-shell /bin/zsh
This solved it for me.
https://github.com/nvm-sh/nvm/issues/1245#issuecomment-370396741
OR
comment out the code below in your shell file (such as ~/.zshrc):
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
log out your account and log in
uncommnet these code above and source shell file
OR
nvm unalias default
https://stackoverflow.com/a/47861348/6700273
https://blog.natetodd.com/nvm/
I think that you should run
npm install
this should do the trick.
Bash starts as a login shell in tmux. On macOS it is ~/.bash_profile, not ~/.bashrc that is sourced then, AFAIK.
Have you tried adding source ~/.bashrc to your ~/.bash_profile?
Here is another possible solution:
$ npm config delete prefix
$ npm config set prefix $NVM_DIR/versions/node/v6.11.1
This should delete and reset the prefix, which you can edit later.
Fixed: it looks like this might be specific to how macOS handles
pathes on each bash shell. Adding the recommended path-clearing logic
to my profile files fixed this issue for me.
Seeing this too, just on tmux, with nvm installed via the curl script.
Oddly, it seems like I'm using different versions of npm when in tmux and when I'm just in my shell (zsh). When I'm in tmux, doing a which npm results in /usr/local/bin/npm while in zsh, it's /Users/brett/.nvm/versions/node/v10.8.0/bin/npm.
It seems like it might be related to tmux reloading my profile files, and appending more paths to $PATH.
Look here: When using tmux nvm isn't being sourced
Hello I receive the following message when trying to install npm. I downloaded the most recent node.js but it doesn't seem to download npm. I keep getting the belowenter code here error message after deleting node.js and reinstalling it.
When I try installing node.js I don't see the following being created:
C:\Users\Efren Barragan\AppData\Roaming\npm
This is the first time installing node.js. I just installed it on my old computer and it worked out fine. I am new to this so so your patience is much appreciated! Thanks!
C:\Users\Efren Barragan> npm install npm -g
module.js:327
throw err;
^
Error: Cannot find module 'npmlog'
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 C:\Users\Efren Barragan\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js:19:13
at Object.<anonymous> (C:\Users\Efren Barragan\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js:75:3)
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)
Due to the bug in versions this is what i did -
I have faced the same issue in my Windows 10 PC. After looking into solutions, since i couldn't find the exact solution for the issue i was facing
Cannot find module 'npmlog'
I just uninstalled the node js and then, deleted both 'npm' and 'npm-cache' in
"C:\Users\YourPCName\AppData\Roaming"
Then, i downloaded the latest version of node from Node JS Website
And, installed node js
After that i checked with the path in environment variables.
Finally run the command prompt 'run as administrator' and npm install npm -g
Checking your version will show the latest version. 'npm -v'
I got the latest version - v3.10.9
Try this. this should work.
Install a newer version, it's been a bug in previous version.
I'm attempting to use the React Starter Kit with SemanticUI on Windows. I can install and build RSK, but when I run npm install semantic-ui and go through the set up, I always hit the same module error and I am unsure how to solve it.
gulp build
module.js:341
throw err;
^
Error: Cannot find module 'inflight'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (C:\Users\Alex\AppData\Roaming\npm\node_modules\gulp\node_modules\glob\glob.js:57:16)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
I have tried nuking the directory and reinstalling multiple times, but I am unable to get this to work. What is causing the issue?
You may be hitting the same issues people are having on npm 2701. The issue appears to be related to version updates between installing NPM modules (from a quick read over the later parts of the report). Suggestions include running:
npm set registry https://registry.npmjs.org/
And alternatively, removing all currently installed node modules including globally installed modules (in /usr/node-modules/ or C:\Program Files\nodejs\node_modules for example). The user deleted them manually (i.e. not using npm).
I also faced same issue while running react app. I simply installed it
npm install inflight
Although after it there prompt another error msg which was failed to find moudule 'source-list-map' then I installed it as well
npm install source-list-map
I hope it will help you
The problem:
I am using laravel 4 + basset for asset management (OSX).
i have added the twitter bootstrap to my composer as a dependency.
I want to compile the less files into a collection:
Basset::collection('TwitterBootstrap', function($collection)
{
// Collection definition.
$collection->add('../vendor/twbs/bootstrap/less/bootstrap.less');
})->apply('Less');
I then try to build the collection:
php artisan basset:build TwitterBootstrap
Which throws the error:
[Assetic\Exception\FilterException]
An error occurred while running:
'/usr/local/bin/node' '/private/var/folders/f4/xjby77695pbcgfdjfclfdqd40000gn/T/assetic_less5y7dnh'
Error Output:
module.js:340
throw err;
^
Error: Cannot find module 'less'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/private/var/folders/f4/xjby77695pbcgfdjfclfdqd40000gn/T/assetic_less5y7dnh:1:74)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
I have installed less globally - im unsure why this is throwing errors/what to fix (my path? a node config? an assetic config?)
I had the same problem and I solved it by installing less with npm :
npm install less
To use less globally, do not run "npm install less" at the root of your project.
Instead add a symlink to the global one (/home/{user}/node_modules/less/) in your project :
ln -s /home/{user}/node_modules/less/ /path/to/project/node_modules/less
ln -s /home/{user}/node_modules/less/bin/lessc /path/to/project/node_modules/less/.bin/lessc
How did you install less?
npm install less
Reference: https://npmjs.org/package/less
Edit... Just saw your footnote.
Another option would be to install lessPHP via composer and use LessphpFilter instead of LessFilter