[英]“not listed in package.json” , node.js while installing NTVS
在以下狀態顯示模塊的紅色框中..任何人都可以幫助我..謝謝提前
打開命令提示符並進入項目目錄(您可以在解決方案資源管理器中右鍵單擊該項目,然后Open command prompt from here...
選擇Open command prompt from here...
)。
鍵入npm init
並在提示時填寫字段(或Enter
以采用默認值)。 輸出應該看起來像這樣......
C:\Anthony\Demo\ExpressApp1\ExpressApp1>npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sane defaults.
See `npm help json` for definitive documentation on these fields
and exactly what they do.
Use `npm install <pkg> --save` afterwards to install a package and
save it as a dependency in the package.json file.
Press ^C at any time to quit.
name: (ExpressApp1)
version: (0.0.0)
description:
entry point: (app.js)
test command:
git repository:
keywords:
author:
license: (ISC)
About to write to C:\Anthony\Demo\ExpressApp1\ExpressApp1\package.json:
{
"name": "ExpressApp1",
"version": "0.0.0",
"description": "",
"main": "app.js",
"dependencies": {
"express": "~3.4.4",
"jade": "~1.1.5",
"stylus": "~0.42.2"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
Is this ok? (yes)
如果由於某種原因npm init
不起作用,您可以將以下文本保存到項目根目錄中名為package.json
的文件中,並更新值以匹配項目中的包。
{
"name": "ExpressApp1",
"version": "0.0.0",
"description": "",
"main": "app.js",
"dependencies": {
"express": "~3.4.4",
"jade": "~1.1.5",
"stylus": "~0.42.2"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
第三個選項是刪除項目中的npm_modules
文件夾。 然后,您可以在解決方案資源Manage npm modules...
器中右鍵單擊npm
“文件夾”,選擇“ Manage npm modules...
,然后重新安裝軟件包。 以這種方式安裝它們應該為您創建一個package.json
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.