Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sails 0.10.1 cannot find module grunt #2059

Closed
gkaimakas opened this issue Aug 5, 2014 · 11 comments
Closed

Sails 0.10.1 cannot find module grunt #2059

gkaimakas opened this issue Aug 5, 2014 · 11 comments

Comments

@gkaimakas
Copy link

Just installed sails@0.10.1 and when I lift my server I get the following error:

error: Grunt :: module.js:340
    throw err;
          ^
Error: Cannot find module '/home/gkaimakas/node_modules/sails/node_modules/grunt-cli/bin/grunt'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:906:3

I saw similar problems in previous versions and every solution said to delete some backslashes from pathToSails.

var pathToSails = __dirname.replace(' ', '\ ') + '/../..';

the thing is that I cannot locate pathToSails anywhere. My server lifts fine though. Can anyone help ?

@RWOverdijk
Copy link
Contributor

@gkaimakas What steps did you take to get to this error? I can't reproduce it with a fresh install. Did you install all dependencies?

@gkaimakas
Copy link
Author

I was using version 0.9.16 with no problems and yesterday I decided to
update to the latest version and the error appeared.

I am using Ubuntu 14.04 both at work and home. The problem only appears at
my work machine which I formated just last week
On Aug 6, 2014 9:33 AM, "Wesley Overdijk" notifications@github.com wrote:

@gkaimakas https://github.com/gkaimakas What steps did you take to get
to this error? I can't reproduce it with a fresh install. Did you install
all dependencies?


Reply to this email directly or view it on GitHub
#2059 (comment).

@RWOverdijk
Copy link
Contributor

@gkaimakas Did you follow the migration guide? Quite a lot of things have changed and you might have to install all dependencies again. If you're using global grunt, that should probably be updated, too.

You can find the migration guide here.

@gkaimakas
Copy link
Author

I fixed it by going to sails directory and installing grunt-cli. Just a
noob mistake but thanks for the help!!!

2014-08-06 9:43 GMT+03:00 Wesley Overdijk notifications@github.com:

@gkaimakas https://github.com/gkaimakas Did you follow the migration
guide? Quite a lot of things have changed and you might have to install all
dependencies again. If you're using global grunt, that should probably be
updated, too.

You can find the migration guide here
https://github.com/sixpounder/sails-docs/blob/master/Migration-Guide.md.


Reply to this email directly or view it on GitHub
#2059 (comment).

Γιώργος

@RWOverdijk
Copy link
Contributor

Hoorah!

Please close the issue :)

@gkaimakas
Copy link
Author

will do!

2014-08-06 10:17 GMT+03:00 Wesley Overdijk notifications@github.com:

Hoorah!

Please close the issue :)


Reply to this email directly or view it on GitHub
#2059 (comment).

Γιώργος

@gkaimakas gkaimakas changed the title Sails 0.10.1 cannot find module grunt [#closed] Sails 0.10.1 cannot find module grunt Aug 6, 2014
@gkaimakas gkaimakas changed the title [#closed] Sails 0.10.1 cannot find module grunt [closed] Sails 0.10.1 cannot find module grunt Aug 6, 2014
@gkaimakas gkaimakas changed the title [closed] Sails 0.10.1 cannot find module grunt Sails 0.10.1 cannot find module grunt Aug 6, 2014
@leejt489
Copy link

I think there may still be an issue here. I hypothesize that the problem lies in updating sails using npm install inside of a pre-existing sails application, when that application already has some of the sails dependencies installed via its package.json or via globally installed packages (such as grunt-cli), then npm install skips installing those dependencies that are higher up, which is fine if they are properly requested with require, but not so good when a binary is being referenced via the relative path.

I'm still relatively new to node and not rock-solid on package management, so I could be totally wrong, but I did notice that when I tried upgrading from v0.10.3 to v0.10.5 that all of a sudden many of the node_modules in sails were no longer there and that seems to explain the issue.

The reason that I think it is a bug is because you should be able to update minor versions without causing problems, and even though this cause a fatal error break the app, it does give an annoying grunt error on lifting and more importantly screws up the asset compilation. It can be fixed by installing grunt-cli as @gkaimakas said, but sails shouldn't be looking for a file that may not be there!

@rmarku
Copy link

rmarku commented Dec 11, 2014

I have the same problem with sails 0.10.5. If I have grunt-cli in my package.json, npm did not install it in sails/node_modules and sails lift throw the error in module.js:340

What I did to reproduce this error

~ $ sails new myApp
~ $ cd myApp
~/myApp $ rm node_modules/ -rf
~/myApp $ npm install grunt-cli --save
~/myApp $ npm install
~/myApp $ sails lift

I am using linux
node v0.10.33
npm v2.1.11

@Bazze
Copy link

Bazze commented Jan 29, 2015

This is absolutely still an issue. I'm experiencing the same as @rmarku.

@kt3k
Copy link

kt3k commented Jan 6, 2016

This seems fixed in this commit and it's included in v0.11 or later.

@vigneshmack
Copy link

vigneshmack commented Jul 6, 2017

I created one notepad file I used the command node C:\Users\Vignesh Ravi\AppData\Roaming\npm\node_modules\sails\bin\sails.js lift and save as sails.bat file and put into C:\Windows\System32.but still I got an error while using sails lift. can anyone solve this error? Thanks in advance....
C:\Users\Vignesh Ravi\AppData\Roaming\npm>cd xyz

C:\Users\Vignesh Ravi\AppData\Roaming\npm\xyz>sails lift

C:\Users\Vignesh Ravi\AppData\Roaming\npm\xyz>node C:\Users\Vignesh Ravi\AppData\Roaming\npm\node_modules\sails\bin\sails.js lift
module.js:487
throw err;
^

Error: Cannot find module 'C:\Users\Vignesh'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Function.Module.runMain (module.js:605:10)
at startup (bootstrap_node.js:158:16)
at bootstrap_node.js:575:3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

7 participants