我正在使用“sails new”命令创建一个新应用。在运行风帆升降机时,我在浏览器上收到“未找到”(404)错误。我在当地安装了帆和这是我的节点&帆版本信息
vsnag@like:~/sails/node_modules$ sails --version
0.10.5
vsnag@like:~/sails/node_modules$ node --version
v0.10.32
带有详细选项的风帆升降机给了我这个
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")
我尝试了this so post中建议的解决方案,但没有用。
当我比较sails docs&中提到的风帆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文件。
有什么建议可能是什么问题?或者我错过的任何设置......
答案 0 :(得分:0)
使用以下内容制作一个空的新风帆应用程序(在您的主文件夹中)
$> sails new myapp
在此" myapp" -folder中复制您的api,观看和配置,然后再次运行sails lift
答案 1 :(得分:0)
检查您的importer.less
我意外地包含了一些不在那里的东西(一个丢失的文件夹),在修复它之后,它起作用了。 (:
如果它没有检查你的pipeline.js,看你是否注入了正确的文件。
答案 2 :(得分:0)
我在npm上运行sails new
命令,因为我在本地而不是全局安装它。我得到了not found和404。在全局安装它时,它可以工作。