我试图重新安装cordova并重新安装系统,但它没有用 . 我的cordova版本是7.0.1,节点版本是v6.10.3,npm版本是3.10.10 . 新项目错误的代码如下 .
- E:\cordovaProject>cordova create myapp com.mu myapp -d Using
detached cordova-create Creating a new cordova project. Copying
assets." Using cordova-fetch for
C:\Users\Administrator\AppData\Roaming\npm\node_modules\
cordova\node_modules\_cordova-app-hello-world@3.12.0@cordova-app-hello-world\ind
ex.js Running command: cmd "/s /c ""C:\Program Files\nodejs\npm.cmd"
install C:\Users\
Administrator\AppData\Roaming\npm\node_modules\cordova\node_modules\_cordova-app
-hello-world@3.12.0@cordova-app-hello-world\index.js"" Command finished with error code 4294963238: cmd /s /c ""C:\Program
Files\nodejs \npm.cmd" install
C:\Users\Administrator\AppData\Roaming\npm\node_modules\cordov
a\node_modules\_cordova-app-hello-world@3.12.0@cordova-app-hello-world\index.js"
Error: Uncaught, unspecified "error" event. ( Error from Cordova
Fetch: Error: cmd: Command failed with exit code 4294963238 Error
output: npm ERR! not a package
C:\Users\Administrator\AppData\Roaming\npm\node_modules\c
ordova\node_modules\_cordova-app-hello-world@3.12.0@cordova-app-hello-world\inde x.js npm ERR! addLocal Could not install
C:\Users\Administrator\AppData\Roaming\npm\n
ode_modules\cordova\node_modules\_cordova-app-hello-world@3.12.0@cordova-app-hel
lo-world\index.js npm ERR! path
C:\Users\Administrator\AppData\Local\Temp\npm-8056-980eaa3d\unpack
-8e52606f\package.json npm ERR! code ENOENT npm ERR! errno -4058 npm ERR! syscall open npm ERR! enoent ENOENT: no such file or directory,
open 'C:\Users\Administrator\
AppData\Local\Temp\npm-8056-980eaa3d\unpack-8e52606f\package.json'
npm ERR! enoent This is most likely not a problem with npm itself npm
ERR! enoent and 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\Administrator\AppData\Roaming\npm-cache\_logs\2017-05-18T0
2_13_23_845Z-debug.log)
3 回答
嘿,我有与你上面描述的相同的问题 . 我用答案here解决了这个问题 .
当我尝试添加插件时,我在Windows中遇到了同样的问题 . 要解决此问题,请删除node_modules并重试该命令以添加插件 . 这解决了我的问题 .
打开文件
C:\Users\YOUR-PC-USERNAME\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\cordova-create\node_modules\cordova-fetch\index.js
查找文本
fetchArgs.push(target);
,然后在此行之前插入以下代码:包版本清单:
cordova:8.1.2
cordova-app-hello-world:3.12.0
cordova-create:1.1.2
cordova-fetch:1.3.1
这适合我 .