我正在使用 "sails new "命令创建一个新的应用程序。当运行sails lift时,我在浏览器上得到一个 "Not Found"(404)的错误。我已经在本地安装了sails,以下是我的节点&;sails的版本信息。
vsnag@like:~/sails/node_modules$ sails --version
0.10.5
vsnag@like:~/sails/node_modules$ node --version
v0.10.32
帆举与verbose选项给我这样的答案
vsnag@like:~/sails/app$ sails lift --verbose
info: Starting app...
warn: Cannot read package.json in the current directory (/home/vsnag/sails/app)
warn: Are you sure this is a Sails app?
warn:
warn: The package.json in the current directory does not list Sails as a dependency...
warn: Are you sure `/home/vsnag/sails/app` is a Sails app?
warn:
verbose: Setting Node environment...
verbose: Please run `npm install coffee-script` to use coffescript (skipping for now)
verbose: moduleloader hook loaded successfully.
......
....
error:
------------------------------------------------------------------------
grunt-cli: The grunt command line interface. (v0.1.13)
Fatal error: Unable to find local grunt.
If you're seeing this message, either a Gruntfile wasn't found or grunt
hasn't been installed locally to your project. For more information about
installing and configuring grunt, please see the Getting Started guide:
http://gruntjs.com/getting-started
error: Looks like a Grunt error occurred--
error: Please fix it, then **restart Sails** to continue running tasks (e.g. watching for changes in assets)
error: Or if you're stuck, check out the troubleshooting tips below.
......
...
verbose: Sending 404 ("Not Found") response
verbose: res.notFound() :: Could not locate view for error page (sending JSON instead). Details: Could not render view "404". Tried locating view file @ "/home/vsnag/sails/app/views/404". Layout configured as "layout.ejs", so tried using layout @ "/home/vsnag/sails/app/views/layout.ejs")
我尝试了在 此任,但毫无用处。
当我对比了一下《帆海》APP中提到的解剖学。帆文档 & 我的应用程序,他们似乎不匹配。
vsnag@like:~/sails/app$ ls -la
total 20
drwxrwxr-x 5 vsnag vsnag 4096 Oct 9 21:36 .
drwxrwxr-x 4 vsnag vsnag 4096 Oct 10 18:54 ..
drwxrwxr-x 7 vsnag vsnag 4096 Oct 9 21:36 api
drwxrwxr-x 4 vsnag vsnag 4096 Oct 9 21:36 config
drwxrwxr-x 2 vsnag vsnag 4096 Oct 9 21:36 views
我缺少Gruntfile.js、README、app.js、.gitignore、package.json、.sailsrc文件。
有什么建议可以帮助我解决这个问题吗? 或者是我遗漏了什么设置?
做一个空的新的sails应用(在你的home-文件夹中)。
$> sails new myapp
然后把你的api、views和config复制到这个 "myapp "文件夹中,然后运行 sails lift
再次
检查您的进口商.少
我不小心包含了一些不在里面的东西(缺少一个文件夹),修复之后,就可以了。(:
如果没有,请检查你的pipeline.js,看看你是否注入了正确的文件。
我当时运行的是 sails new
命令,因为我把它安装在本地而不是全局。我得到了not found和404。当我在全球范围内安装时,它工作了。