Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
977 views
in Technique[技术] by (71.8m points)

node.js - npm start Microsoft JScript runtime error 800A138F object expected

Getting started with NPM...

I can run the following command to start my app.

node app

But when I run the following command, I get the following error:

npm start

Windows Script Host Object expected

Line 2

800A138F

Microsoft JScript runtime error

App.js:

var port = 5000;
var express = require('express');

Package.json:

{
  "name": "2",
  "version": "1.0.0",
  "description": "",
  "main": "app.js",
  "scripts": {
    "start": "app.js"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "express": "^4.13.3"
  }
}

And I've run this command of course:

npm install express --save

Seems like NPM can't find the express package? Why not?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I know its too late to answer, but in case any wanderer like me faces the same problem in future..

Solution:

need to add node keyword ahead of app.js in script. So, start script should

"scripts": { "start": "node app.js" },

That solved for me.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...