繁体   English   中英

错误:找不到模块“ jade〜”

[英]Error: Cannot find module 'jade~'

我是Node JS的新手。 我用Compound Js创建了一个粗体操作。

在我尝试警告值之前,该应用程序运行良好,之后我收到了错误消息

500 Error: Cannot find module 'jade~'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:362:17)
at require (module.js:378:17)

如何解决这个问题

我的索引

#tabs
  ul
    li
      a(href='#tabs-1') New Leave
    li
      a(href='#tabs-2') Index of Leave
  #tabs-1
    .page-header
      h1 New employee

    - var form = formFor(employee, {action: pathTo.employees(), method: 'POST', id: "employee_form", class: 'form-horizontal'})

    != form.begin()
    != errorMessagesFor(employee) 
    .control-group
      != form.label("code", false, {class: "control-label"})
      .controls
        != form.input("code")
    .control-group
     != form.label("description", false, {class: "control-label"})
      .controls
        != form.input("description")
    .control-group
      != form.label("applicable", false, {class: "control-label"})
      .controls
        != form.input("applicable")
    .control-group
      != form.label("cForward", false, {class: "control-label"})
      .controls
        != form.checkbox("cForward")
    .control-group
      != form.label("limit", false, {class: "control-label"})
      .controls
        != form.checkbox("limit")
    .control-group
      != form.label("lop", false, {class: "control-label"})
      .controls
        != form.checkbox("lop")
    .control-group
      != form.label("od", false, {class: "control-label"})
      .controls
        != form.checkbox("od")
    .control-group
      != form.label("co", false, {class: "control-label"})
      .controls
        != form.checkbox("co")
    .control-group
      != form.label("lrevision", false, {class: "control-label"})
      .controls
        != form.checkbox("lrevision")
    .control-group
      != form.label("active", false, {class: "control-label"})
      .controls
        != form.checkbox("active")
    .form-actions
      != form.submit('<i class="icon-ok icon-white"></i>  Create employee', {class: 'btn btn-primary'})
      span= ' or '
      != linkTo('Cancel', pathTo.employees(), {class: 'btn'})
    != form.end()
  #tabs-2
    .page-header
      h1 Index of employees


    .row
      .span12
         p
            != linkTo('<i class="icon-plus icon-white"></i> New employee', path_to.new_employee(), {class: 'btn btn-primary'})

    - if (employees.length) {
    .row
      .span12
         table.table.table-striped
           thead
             tr
               th ID
               th.span3 Actions
           tbody
             - employees.forEach(function (employee) {
             tr
               td
                 != linkTo('employee #' + employee.id, path_to.employee(employee))
               td
                 != linkTo('<i class="icon-edit"></i> Edit', pathTo.edit_employee(employee), {class: 'btn btn-mini'}) + ' '
                 != linkTo('<i class="icon-remove icon-white"></i> Delete', pathTo.employee(employee), {class: 'btn btn-mini btn-danger', method: 'delete', remote: true, jsonp: '(function (u) {location.href = u;})'})
             - });
    - } else{
    .row
      .span12
         p.alert.alert-block.alert-info
            strong No employees were found.
    - } 

布局文件

!!! 5
html
  head
    title= title
    != stylesheetLinkTag('http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/themes/base/jquery-ui.css', 'bootstrap', 'application', 'bootstrap-responsive')
    != javascriptIncludeTag('https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.js', 'rails', 'application')
    script
      $(document).ready(function() {
        $("#tabs").tabs();
      });
    != csrfMetaTag()
  body
    .navbar
        .navbar-inner
            .container
               a.brand(href='#') Project name

    .container
      - var flash = request.flash('info').pop(); if (flash) {
        .alert.alert-info= flash
      - }

      - flash = request.flash('error').pop(); if (flash) {
        .alert.alert-error= flash
      - }

      != body

      hr
      footer
        p © Company 2012
  != contentFor('javascripts')

我在nodeschool expressworks教程中遇到了同样的问题。 我通过在package.json中包含依赖项来解决它:

npm install --save express jade

我有同样的问题,但是“找不到模块'jade'”,而不是'jade〜'; 而且我很确定我已经做了“ npm install jade”。 经过一段时间的研究,我发现了我的问题,因为我在本地安装了玉器时在全局安装了Express,参考此帮助https://www.openshift.com/forums/express/nodejs-and-jade-error-cannot- find-module-jade我解决了我的问题。.我在这里发布它以为这可能会帮助一些与我面临相同问题的其他人:)

对我来说,这个问题被证明是不同的。 我安装了翡翠,并在本地和全球进行表达,希望他们能够以某种方式找到彼此,但仍然表达对翡翠的抱怨。

我的错误如下所示:

Express server listening on port 3000
Error: Cannot find module 'jade'
    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 new View (/Users/ajeetganga/node_modules/express/lib/view.js:43:49)
    at Function.app.render (/Users/ajeetganga/node_modules/express/lib/application.js:488:12)
    at ServerResponse.res.render (/Users/ajeetganga/node_modules/express/lib/response.js:798:7)
    at exports.index (/Users/ajeetganga/Documents/WORKSPACE/TinyUrl/MyTinyUrl2/routes/index.js:7:7)
    at callbacks (/Users/ajeetganga/node_modules/express/lib/router/index.js:164:37)
    at param (/Users/ajeetganga/node_modules/express/lib/router/index.js:138:11)

如果您观察到这条线:

at new View (/Users/ajeetganga/node_modules/express/lib/view.js:43:49)

您将看到它不是全局或本地npm安装的默认位置。因此,作为一种变通办法,我在以下文件夹中安装了jade

cd /Users/ajeetganga/node_modules/
npm install jade

我认为,即使我从/ Users / ajeetganga /文件夹中安装了Jade,也从未尝试过。 :)

The issue was with Fedora-16我正在开发的The issue was with Fedora-16上。 在编辑时创建的临时文件即“ index.jade〜”未被清除,因此出现了问题。

在Fedora-16中,可以通过删除临时文件“ index.jade〜”将节点模块“ jade”重命名为 “ jade〜”来解决该问题

嗯,您几乎可以肯定有require('jade~')和一个简单的错字,而您只require('jade') 检查您的快速app.engine('jade')行是否是另一条可能的嫌疑犯。

用Emacs编辑一个玉文件后,我遇到了同样的问题。 解决方法非常简单:找到jade〜文件并将其删除。

我遇到了同样的问题(我的打字稿+ Webpack项目中的Jade-loader)。 我通过将jade-loader安装为对等依赖性来解决此问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM