当我尝试为我的软件包安装依赖项时,我收到了以下错误
npm WARN package@1.0.0 No description
npm WARN package@1.0.0 No repository field.
npm ERR! path C:\Users\user_name\Desktop\typeScript_react_webpack_app_template\node_modules\typescript
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\user_name\Desktop\typeScript_react_webpack_app_template\node_modules\typescript' -> 'C:\Users\user_name\Desktop\typeScript_react_webpack_app_template\node_modules\.typescript.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\user_name\AppData\Roaming\npm-cache\_logs\2017-07-07T08_55_48_803Z-debug.log
我的package.json
{
"name": "package",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"babel-core": "^6.25.0",
"babel-loader": "^7.1.1",
"babel-preset-es2017": "^6.24.1",
"babel-preset-react": "^6.24.1",
"ts-loader": "^2.2.2",
"typescript": "^2.4.1",
"webpack": "^3.0.0"
},
"dependencies": {
"react": "^15.6.1",
"react-dom": "^15.6.1"
}
}
如果我安装包作为npm安装typescript一切正常。 什么可以解决这个问题?
答案 0 :(得分:0)
删除package-lock.json并再次运行npm
检查节点和npm是否正确安装
用于检查类型
npm -v
如果没有电话号码,请正确安装。
如果安装了任何数字凸轮,则安装了npm,然后继续
快速修复:删除package-lock.json,然后重试
如果以上操作无效,请执行以下步骤
1)删除package-lock.json
2)打开任务管理器并关闭所有nodejs进程
3)运行npm init或npm install
4)如果不起作用,请重新启动系统