3
我剛創建了一個帶有'validator'依賴的node_module。 但是,當我從npm安裝它時,它不會將'validator'模塊安裝在它自己的node_module目錄中。我不明白爲什麼,但這是我第一次創建自己的節點模塊。從npm安裝node_module,但它不會安裝它自己的node_modules - package.json
的package.json:
{
"name": "validator-extended",
"description": "String validation and sanitization based on validator.js",
"version": "1.1.0",
"homepage": "https://github.com/Ayolan/validator-extended",
"keywords": [
"validator",
"validation",
"validate",
"sanitization",
"sanitize",
"sanitisation",
"sanitise",
"assert",
"extend",
"extended"
],
"author": "Vadorequest <https://github.com/Vadorequest>",
"main": "app.js",
"bugs": {
"url": "https://github.com/Ayolan/validator-extended/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/Ayolan/validator-extended.git"
},
"engines": {
"node": ">= 0.8"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/Ayolan/validator-extended/raw/master/LICENSE"
}
],
"dependencies": {
"validator": "~3.1"
}
}
我也有這樣的.npmignore文件:
########################
# node.js/npm
########################
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz
pids
logs
results
node_modules
npm-debug.log
########################
# misc/editors
########################
*~
*#
.DS_STORE
.netbeans
nbproject
.idea
我應該推node_modules /目錄複製到我的git倉庫?
我最初做到了。我還更新了主帖,以顯示npm init之前的舊package.json。 – Vadorequest
我現在工作,謝謝! – Vadorequest
如果之前的package.json是導致問題的原因,則應該在問題中將其還原。這樣,具有相同問題的其他人將會認出它。 – qubyte