簡體   English   中英

npm無法啟動本地版本

[英]Cannot npm start local version

我git拉了一個小的開發團隊正在研究的node.js項目。 我正在嘗試打開一個本地版本(npm start)以進行試用並開始對其進行一些小的更改。

我的問題是,我無法啟動它。 我嘗試了以下方法:

1)只需鍵入“ npm start”,其中說package.json文件出了點​​問題(我認為):

npm ERR! this-project@0.0.1 start: `node app.js`
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the this-project@0.0.1 start script.
npm ERR! This is most likely a problem with the this_project package,
npm ERR! not with npm itself.

2)打開mongod(鏈接到“ this_project”根文件夾內的“ data”文件夾),將JSON包中的“ start”字段更改為值“〜/ workspace / this_project / app.js”,然后npm start:

: command not foundorkspace/this_project/app.js: line 1:
/Users/MichaelYim/workspace/this_project/app.js: line 2: //: is a directory
/Users/MichaelYim/workspace/this_project/app.js: line 3: syntax error near unexpected token `('
'Users/MichaelYim/workspace/this_project/app.js: line 3: `var express = require('express')

npm ERR! Darwin 13.3.0
npm ERR! argv "node" "/usr/local/bin/npm" "start"
npm ERR! node v0.10.32
npm ERR! npm  v2.1.2
npm ERR! code ELIFECYCLE
npm ERR! this_project@0.0.1 start: `~/workspace/this_project/app.js`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the this_project@0.0.1 start script.
npm ERR! This is most likely a problem with the this_project package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ~/workspace/this_project/app.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls zingly-ugc-management-system
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/MichaelYim/workspace/this_project/npm-debug.log

不知道從哪里開始。 有人可以幫我嗎?

app.js的第一部分

// Module dependencies.
var express = require('express')
  , http = require('http')
  , path = require('path')
  , engine = require('ejs-locals')
  , fs = require('fs')
  , nodemailer = require('nodemailer')
  , crypto = require('crypto')
  , request = require('request')
  , moment = require('moment')
  , async = require('async')
  , logs = require('./logs/logs.js')
  , csv = require('csv')
  , GoogleUrl = require('google-url');

var nodeExcel = require('excel-export');
var googleUrl = new GoogleUrl();

var CronJob = require('cron').CronJob;

var app = express();
// Get Configuration Files
var content = JSON.parse(fs.readFileSync(path.join(__dirname, "/package.json")));
var host = content.config.host + ":" + content.config.port;

var transport = nodemailer.createTransport("SMTP", {
  service: content.config.service,
  auth: {
      user: content.config.user,
      pass: content.config.pass
  }
});

package.json

{
  "name": "this-project",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "~/workspace/this-project/app.js"
  },
  "dependencies": {
    "express": "*3.3.4",
    "ejs": "0.8.5",
    "ejs-locals": "1.0.2",
    "mongojs": "0.9.9",
    "moment": "2.5.0",
    "async": "0.2.9",
    "instagram-node-lib" : "0.1.1",
    "nodemailer" : "0.5.14",
    "newrelic" : "1.3.2",
    "crypto" : "0.0.3",
    "csv" : "0.3.6",
    "gm" : "1.14.1",
    "paypal-rest-sdk" : "0.6.4",
    "google-url" : "0.0.2",
    "cron" : "1.0.4"
  },
  "config": {
    "host" : "this.project.me",
    "port" : "8880",
    "hash_prefix" : "this_project",
    "hash_suffix" : "jillM@kk$!@#937",
    "service" : "Gmail",
    "user" : "hello@this.project",
    "pass" : " xxxxxxxxx ",
    "instagram" : {
      "client_id" : "sd87f6asdg97asdf6sad5sdf7",
      "client_secret" : "dfsg6ds5f65dsfg46d4hgf4hd"    
    }
  }
}

使app.js文件的第一行如下所示:

#!/ usr / bin / env節點

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM