[英]missing start script in NPM
First, sorry for my bad english. 首先,对不起我的英语不好。 I'm trying to deploy an app to Heroku using the command
heroku local web
in terminal, but I'm getting ERR! missing script: start
我正在尝试在终端中使用命令
heroku local web
将应用程序部署到Heroku,但是我得到了ERR! missing script: start
ERR! missing script: start
, even though I have the script in my json file. ERR! missing script: start
,即使我的json文件中有脚本。 And if I try to run npm start
in terminal the same error appears. 如果我尝试在终端中运行
npm start
,则会出现相同的错误。 I searched for similar problems in Stack Overflow but I couldn't solve. 我在堆栈溢出中搜索了类似的问题,但无法解决。 My .json is:
我的.json是:
{
"name": "server",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
.
.
My dependencies here
.
.
},
"scripts": {
"start": "node index.js",
"test": "echo \"Error: nko test specified\" && exit 1"
}
}
PS.: When I run npm install
in terminal, the json file just erases the script and everything I wrote, for example I added "config" : { "port" : "3000" }
, but after running npm install
it just disappeared. PS .:当我在终端中运行
npm install
时,json文件只是擦除了脚本和我编写的所有内容,例如,我添加了"config" : { "port" : "3000" }
,但是在运行npm install
,它就消失了。
I think you confused yarn
and npm
我认为您混淆了
yarn
和npm
If you want to use yarn
and if you package.json
contain a key like start
you can call yarn start
如果要使用
yarn
并且package.json
包含类似start
的键,则可以调用yarn start
But, if you want to work with npm
you need to use npm run start
the run
it's important because npm
can't understand. 但是,如果要使用
npm
,则需要使用npm run start
run
这很重要,因为npm
无法理解。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.