. Advertisement .
..3..
. Advertisement .
..4..
Last night, I put request module, and having the error “cannot find module request”. As this table :
module.js:340
throw err;
^
Error: Cannot find module 'request'
I have read a lot of documents but it haven’t found the best way to solve . How can you be solved? please help me. Thanks a lot!
The cause:
After reading your post, i know that this is because module request is not publiced in over the world. I have 2 suggests as follow, this is the cause which is getting the error:
Whether should this set up it in /usr/loca/bin? because it do not exsit.
Terminal was started again after each command but the error is still existed.
The solution:
Access the project directory.
Make it to your root’s project.
Set necessary npm modules and save them as project dependencies.
Create a
test.js
file in project directory with code from package example:It must be similarly this:
Finally, run Node from your project directory.