npm start Microsoft JScript 运行时错误 800A138F 预期对象 [英] npm start Microsoft JScript runtime error 800A138F object expected

查看:19
本文介绍了npm start Microsoft JScript 运行时错误 800A138F 预期对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

开始使用 NPM...

我可以运行以下命令来启动我的应用程序.

节点应用

但是当我运行以下命令时,出现以下错误:

npm 开始

<块引用>

Windows 脚本宿主预期对象

第 2 行

800A138F

Microsoft JScript 运行时错误

App.js:

var 端口 = 5000;var express = require('express');

包.json:

<代码>{名称":2",版本":1.0.0",描述": "",主":app.js",脚本":{开始":app.js"},作者": "",许可证":ISC",依赖":{快递":^4.13.3"}}

我当然已经运行了这个命令:

npm install express --save

好像NPM找不到快递包?为什么不?

解决方案

我知道现在回答为时已晚,但万一像我这样的流浪者将来也面临同样的问题..

解决方案:

需要在脚本中的 app.js 之前添加 node 关键字.所以,启动脚本应该

<代码>脚本":{开始":节点 app.js"},

这为我解决了.

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?

解决方案

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.

这篇关于npm start Microsoft JScript 运行时错误 800A138F 预期对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆