I’m reading this doc on hapi-auth-cookie and trying to run sample server.here is what i did :
1-putting sample server in server.js
4-npm install —save hapi
5-node server.js but this time i get a new error
Error: Cannot find module ‘../’
somewhere in the code it’s requiring ‘../’
Не запускается gulp
Нашел статью с точно такой же проблемой и попыткой решения
Может кому нибудь пригодится.
Решение сводиться к следующей последовательности команд:
В моем же случае пакета dezalgo не находит переустановка не помогает
Подскажите шаги по устранению данной проблемы, может кто сталкивался .
Это первые шаги работы с gulp и не получается его даже запустить
I wrote a module which I published to npm a moment ago (https://npmjs.org/package/wisp)
So it installs fine from the command line:
However, when I run it from the command line, I keep getting an error that optimist isn’t installed:
However, I have specified in package.json as a dependancy:
Does anyone know what to do to get this running? I know its to do with the bin part adding the executable to bin and the node_modules in that directory being empty. No idea how to resolve this.
17 Answers 17
For anyone else running into this, I had this problem due to my npm installing into a location that’s not on my NODE_PATH .
My NODE_PATH was empty, and running npm install —global —verbose promised-io showed that it was installing into /opt/lib/node_modules/promised-io :
My script fails on require(‘promised-io/promise’) :
I probably installed node and npm from source using configure —prefix=/opt . I’ve no idea why this has made them incapable of finding installed modules. The fix for now is to point NODE_PATH at the right directory:
My require(‘promised-io/promise’) now succeeds.
/.bash_profile in Terminal, then add export NODE_PATH=/usr/local/lib/node_modules to the end of the file. Restart the terminal window. Now running echo $NODE_PATH should print out /usr/local/lib/node_modules . – Pwdr Dec 26 ’14 at 14:11
add this to beginning of prog(mac):
/bash_profile which is more machine independent in that the native .js code is unaffected. – vwvan Sep 10 at 7:03
By default node does not look inside the /usr/local/lib/node_module for loading global modules. Refer the module loading explained in http://nodejs.org/api/modules.html#modules_loading_from_the_global_folders
So either you have to 1)add the /usr/local/lib/node_module to NODE_PATH and export it or 2)copy the installed node modules to /usr/local/lib/node . (As explained in the link for loading module node will search in this path and will work)
For some (like me) that nothing else worked, try this:
Hope it helps someone 🙂
I got the "optimist" module error and I just did "npm install" to resolve it. went past that error.
I had this problem for request-promise . In my case, replacing:
Also, try setting the environment variable
For Windows, from Nodejs cannot find installed module on Windows? what worked for me is running npm link as in
Had the same problem on one of the test servers running Ubuntu under root . Then created a new user using useradd -m myuser and installed everything ( nvm , node , packages) as myuser . Now it’s working fine.
On windows if you just did a clean install and you get this you need blow away your npm cache in AppDataRoaming
In my case both node and npm were in same path ( /usr/bin ). The NODE_PATH was empty, so the npm placed the global modules into /usr/lib/node_modules where require(. ) successfully find them. The only exception was the npm module, which came with the nodejs package. Since I’m using 64 bit system, it was placed into /usr/lib64/node_modules . This is not where require(. ) searches in case of empty NODE_PATH and node started from /usr/bin . So I had two options:
- link /usr/lib64/node_modules/npm to /usr/lib/node_modules/npm
- move modules from /usr/lib/node_modules/* to /usr/lib64/node_modules/ and set NODE_PATH=/usr/lib64/node_modules
Both worked. I’m using OpenSUSE 42.1 and the nodejs package from updates repository. Version is 4.4.5.
I did this in simple way.
- Un-Install node from control panel [Windows 7]
- Install node again
- Install protractor npm install —global —verbose protractor
Update web driver manager.
works fine for me.
Hope this helps you.
I got this error Error: Cannot find module ‘number-is-nan’ whereas the module actually exists. It was due to a bad/incomplete Node.js installation.
For Windows , as other answers suggest it, you need a clean Node installation :