Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Based on the comments from <a href="https://github.com/creationix/nvm/pull/97" rel="noreferrer">https://github.com/creationix/nvm/pull/97</a>:</p> <blockquote> <p>When installing packages with npm using the global switch -g the package ends up in the proper directory (i.e. .nvm/$VERSION/lib/node_modules), however node is unable to require it since it somehow isn't searching on it's prefix.</p> </blockquote> <p>So using <code>npm install -g xxxxx</code> will put the modules in the correct location for NVM but if you try to <code>require</code> one of them node can't find the module. I am still playing around with this and will update if I find a solution.</p> <p><strong>Update</strong></p> <p>Where does NPM put node_modules? (see <a href="https://docs.npmjs.com/files/folders" rel="noreferrer">https://docs.npmjs.com/files/folders</a>)</p> <ul> <li>Local install (default): puts stuff in ./node_modules of the current package root.</li> <li>Global install (with -g): puts stuff in /usr/local or wherever node is installed.</li> <li>Install it locally if you're going to <code>require()</code> it.</li> <li>Install it globally if you're going to run it on the command line.</li> <li>If you need both, then install it in both places, or use <code>npm link</code>.</li> </ul> <p>So what I did was run <code>npm init</code> (see <a href="http://npmjs.org/doc/init.html" rel="noreferrer">http://npmjs.org/doc/init.html</a>) in my projects root dir which generated package.json. Now when I run <code>npm install xxxxx</code> it creates a node_modules dir in my project folder (which I add to my .gitignore). This works for modules that I require in my code.</p> <p>For commands such as CoffeeScript I install with <code>npm install -g coffee-script</code> which puts it in the correct directory (.nvm/$VERSION/lib/node_modules). While I can't require these modules (npm link should solve this problem) I can run the commands - i.e. <code>coffee</code>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload