node.js - npm install 不会创建 node_modules 文件夹
问题描述
我正在尝试使用 Typescript 遵循 Protractor 的官方教程。
这是我的package.json
:
{
"name": "typescript-exercise",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"@types/jasmine": "~3.5.7",
"@types/jasminewd2": "~2.0.8",
"jasmine": "~3.5.0",
"protractor": "~5.4.3",
"typescript": "~3.8.3",
"ts-node": "~8.6.2",
"@types/node":"~13.7.7"
}
}
当我运行 npm install 我得到以下结果:
npm WARN typescript-exercise@1.0.0 No description
npm WARN typescript-exercise@1.0.0 No repository field.
up to date in 0.527s
found 0 vulnerabilities
但是,我的根目录中没有node_mdules
文件夹。
为什么 npm install
不能建 node_modules
?
解决方案
出现错误时,请尝试从您的 : 中删除空标签package.json
:
{
"name": "typescript-exercise",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"license": "ISC",
"dependencies": {
"@types/jasmine": "~3.5.7",
"@types/jasminewd2": "~2.0.8",
"jasmine": "~3.5.0",
"protractor": "~5.4.3",
"typescript": "~3.8.3",
"ts-node": "~8.6.2",
"@types/node":"~13.7.7"
}
}
如果您package-lock.json
尝试删除它然后运行npm i
. 希望这对你有用。
推荐阅读
- jpeg - 如何为 JEPG 霍夫曼值建立查找表
- unit-testing - 未执行任何测试(Play Framework)
- python - 有没有办法在字节正则表达式中使用 \b ?(Python)
- python - 如何提高拆分列表的速度?
- java - keytool 要求输入密码以读取 java 证书 ubuntu 18.04
- mongodb - 遍历 MongoDB 集合并删除每两个连续 id 的文档
- sql - SQL Schema - 单一产品/产品变化和库存水平
- python - Pandas groupby 将组中的一行的值添加到组的所有行
- javascript - 如何在版本 ^3 上使用 gremlin 开始与 CosmoDB 图形数据库的新连接
- javascript - HTML+Javascript 读取本地文件系统