簡體   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