-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
npm init egg --type=simple初始化失败(提示:安装 create-egg@latest 失败,错误代码:1),想问下这个问题怎么解决? #3916
Comments
感觉是你的 npm 的问题,试着删除 node_cache_npx 目录,然后升级下 npm 版本看看吧 |
有试过完全卸载nodejs和npm,之后重装,不过好像没有作用 |
这里来看是 Files 前面被截断了,这一块是 npm 的内部逻辑了,不确定是不是npm 在 win 的 bug。 你可以先用: npm install egg-init -g
egg-init --type=simple |
嗯嗯,目前用的是这种方式,谢谢解答 |
同样的问题,使用 yarn 可以成功:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What happens?
按照官方文档初始化egg项目失败
$ npm init egg --type=simple bug
npm ERR! code ENOLOCAL
npm ERR! Could not install from "Files\nodejs\node_cache_npx\14516" as it does not contain a package.json file.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Program Files\nodejs\node_cache_logs\2019-08-29T06_34_38_294Z-debug.log
安装 create-egg@latest 失败,错误代码:1
最小可复现仓库
复现步骤,错误日志以及相关配置
错误日志
0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'install',
1 verbose cli 'create-egg@latest',
1 verbose cli '--global',
1 verbose cli '--prefix',
1 verbose cli 'C:\Program',
1 verbose cli 'Files\nodejs\node_cache\_npx\14516',
1 verbose cli '--loglevel',
1 verbose cli 'error',
1 verbose cli '--json' ]
2 info using npm@6.9.0
3 info using node@v10.16.3
4 verbose npm-session e3854aec37858c34
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 silly fetchPackageMetaData error for file:Files\nodejs\node_cache_npx\14516 Could not install from "Files\nodejs\node_cache_npx\14516" as it does not contain a package.json file.
8 http fetch GET 304 https://registry.npmjs.org/create-egg 1527ms (from cache)
9 silly pacote tag manifest for create-egg@latest fetched in 1548ms
10 timing stage:rollbackFailedOptional Completed in 1ms
11 timing stage:runTopLevelLifecycles Completed in 1559ms
12 verbose stack Error: ENOENT: no such file or directory, open 'D:\mosc\30days\MyProject\egg-example1\Files\nodejs\node_cache_npx\14516\package.json'
13 verbose cwd D:\mosc\30days\MyProject\egg-example1
14 verbose Windows_NT 10.0.17134
15 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "create-egg@latest" "--global" "--prefix" "C:\Program" "Files\nodejs\node_cache\_npx\14516" "--loglevel" "error" "--json"
16 verbose node v10.16.3
17 verbose npm v6.9.0
18 error code ENOLOCAL
19 error Could not install from "Files\nodejs\node_cache_npx\14516" as it does not contain a package.json file.
20 verbose exit [ 1, true ]
相关环境信息
-** Npm版本:6.9.0
The text was updated successfully, but these errors were encountered: