[英]fix module.js:328 throw err;
我正在通過一些教程學習nodejs,到目前為止它很順利。 現在我收到了一個錯誤,我被困住了。 任何人都可以幫助我。
這是我的app.js文件
var greet5 = require('/greet5');
greet5.greet();
這是我的greet5.js文件,它與app.js位於同一目錄中
var greeting = "Hello from Revieling Module pattern";
function greet(){
console.log(greeting);
}
module.exports = {
greet : greet
}
當我在終端上運行節點app.js時,這是我面臨的錯誤。
module.js:328
throw err;
^
Error: Cannot find module '/greet5'
at Function.Module._resolveFilename (module.js:326:15)
at Function.Module._load (module.js:277:25)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/pankaja/Nodejs/Tests/23-Module Patterns/app.js:19:14)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Function.Module.runMain (module.js:442:10)
誰能幫我這個。 謝謝
運行nodejs install
后出現的nodejs項目的README.md文件向您解釋了如何通過nodejs運行Web應用程序。
它說你必須在命令行上執行npm run dev
。
在這里,您是默認的README.md:
# Front End Boilerplate
Front-end boilerplate for creating new web projects with Gulp.js and everything you need to get started.
# Getting Started
Required! Gulp installed `npm install -g gulp`
```
$ cd html-boilerplate
$ npm install
$ npm run dev
```
# Build to production
```
$ npm run build
```
Thank you for your suggestions!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.