Reputation: 453
I am trying to run a sails application with Webstorm 7.0.3. this appear when i try to run the server in the console log:
module.js:340 throw err; ^ Error: Cannot find module 'sails' 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. (C:\Users**\projects\WebstormProjects**\app.js:2:1) 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 Module.runMain [as _onTimeout] (module.js:497:10)
Process finished with exit code 8
i installed sails globaly. i know that this is dont work because it cant find the sails module in the project's local 'node_modules' directory. if ill install again 'sails' localy it will work. but i dont want to...
Is there a way to make it work with sails global install? thanks!
Upvotes: 2
Views: 2751
Reputation: 5671
If your applications relies on Sails, you should have it in your dependencies in package.json
as well as installed locally.
If you don't like the way that npm creates a copy of each module locally, use yarn
and tell it to symlink the cached version.
Upvotes: 0
Reputation: 30401
The sails
module that your code is looking for is not the same thing as the sails
command you're executing at the terminal.
The command generates project skeletons. The module is the code that actually makes it run.
You need to install the command globally and the module locally.
Global installation (using npm install -g
) does not make modules available globally to all node applications, it's only there for command line stuff.
Upvotes: 1