我從github克隆了一個全堆疊MERN(Typescript)專案,當我檢查VS代碼上的代碼時,我注意到packeges到處都有錯誤,因為它們沒有安裝,當我想安裝它們時,我就是不能并且會得到例如使用 (npm install express) 或任何其他軟體包安裝 express 時出現以下錯誤:
npm WARN IdealTree 洗掉依賴項。@types/node 支持 devDependencies.@types/node
npm 錯誤!代碼 E404
npm 錯誤!404 未找到 - 獲取https://registry.npmjs.org/@design-and-develop/eslint-config-prettier-typescript-react - 未找到
npm 錯誤!404
npm 錯誤!404 '@design-and-develop/eslint-config-prettier-typescript-react@^1.0.9' 不在此注冊表中。
npm 錯誤!404 你應該讓作者發布它(或自己使用名稱!)
npm 錯誤!404 請注意,您也可以從
npm 錯誤!404 tarball、檔案夾、http url 或 git url。
npm 錯誤!可以在以下位置找到此運行的完整日志:
當我搜索它時,我發現它與擁有一個 npm 帳戶并登錄它有關,但我不想要任何這些,我只想能夠在本地運行該網站,同時避免我出現的錯誤一直在了解已卸載的軟體包。我怎樣才能做到這一點?.
這是我的 package.json:
{
"name": "lofi-env",
"version": "1.0.0",
"main": "index.js",
"repository": "https://github.com/ni-xon/lofi-env.git",
"author": "ni-xon <[email protected]>",
"license": "MIT",
"scripts": {
"server": "nodemon --config nodemon.json backend/server.ts",
"client": "yarn --cwd frontend start",
"start": "yarn server",
"dev": "concurrently \"yarn server\" \"yarn client\"",
"heroku-postbuild": "cd frontend && npm install && npm run build"
},
"devDependencies": {
"@designed-and-developed/eslint-config-prettier-typescript-react": "^1.0.9",
"eslint": "^8.10.0",
"prettier": "^2.5.1"
},
"dependencies": {
"@types/bcrypt": "^5.0.0",
"@types/express": "^4.17.13",
"@types/jsonwebtoken": "^8.5.8",
"@types/mongoose": "^5.11.97",
"@types/node": "^17.0.21",
"bcrypt": "^5.0.1",
"concurrently": "^7.0.0",
"dotenv": "^16.0.0",
"express": "^4.17.3",
"express-async-handler": "^1.2.0",
"jsonwebtoken": "^8.5.1",
"mongoose": "^6.2.4",
"nodemon": "^2.0.15",
"ts-node": "^10.7.0",
"typescript": "^4.6.2"
}
}
事實上,每當我呼叫 npm 時,我都會收到此錯誤(即使我執行 npm install!)
謝謝你。
uj5u.com熱心網友回復:
看看你的 .npmrc :
registry=https://registry.yarnpkg.com/
@designed-and-developed:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${NPM_TOKEN}
always-auth=true
沒有 NPM 令牌,因此您無法向 Github 包進行身份驗證以獲取您的包。得到一個,把它放在大括號里,然后再試一次:)
干杯
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/498285.html
