我正试图在Windows 10 Pro上使用Yeoman启动一个简单的VS代码扩展。
我正面临着这里所描述的同样的问题";错误代码"试图从不存在的源进行复制";,然而,我的配置完全不同(一切都是便携的),我怀疑即使症状相同,我的问题也有完全不同的根源。
我正在从Cmder启动我的Yeoman命令,这是一个便携式控制台模拟器(https://cmder.net/)已经有Git了。
在Cmder I中,首先安装了Yeoman和VS代码扩展生成器,这就是我得到的:
D:ProgsCmder (portable)
λ npm install -g yo generator-code
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
added 898 packages, and audited 899 packages in 1m
64 packages are looking for funding
run `npm fund` for details
7 vulnerabilities (5 moderate, 2 high)
To address issues that do not require attention, run:
npm audit fix
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
npm notice
npm notice New minor version of npm available! 8.9.0 -> 8.10.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.10.0
npm notice Run npm install -g npm@8.10.0 to update!
npm notice
然后我试着和约曼一起创建我的项目,这就是我得到的:
D:ProgsVS Code (portable)dataextensions
λ yo code
? ==========================================================================
We're constantly looking for ways to make yo better!
May we anonymously report usage statistics to improve the tool over time?
More info: https://github.com/yeoman/insight & http://yeoman.io
========================================================================== No
_-----_ ╭──────────────────────────╮
| | │ Welcome to the Visual │
|--(o)--| │ Studio Code Extension │
`---------´ │ generator! │
( _´U`_ ) ╰──────────────────────────╯
/___A___ /
| ~ |
__'.___.'__
´ ` |° ´ Y `
? What type of extension do you want to create? New Extension (JavaScript)
? What's the name of your extension? axel.generique
? What's the identifier of your extension? axel-generique
? What's the description of your extension?
? Enable JavaScript type checking in 'jsconfig.json'? No
? Initialize a git repository? No
? Which package manager to use? npm
Writing in D:ProgsVS Code (portable)dataextensionsaxel-generique...
Error code
Trying to copy from a source that does not exist: D:ProgsNode.js (portable)node_modulesgenerator-codegeneratorsapptemplatesext-command-jsvscode
值得一提的是,我正在使用Node.js(和npm)的可移植版本,位于";D: \Progs\Node.js(可移植)";,当然,我把这个目录添加到了我的Path环境变量中。
谢谢。
我收到了类似的错误消息:
尝试从不存在的源进行复制:C: \Users\dorwi\AppData\Roaming\nvm\v16.16.0\node_modules\generator code\generators\app\templates\ext命令ts\.gitignore
在我的例子中,只需在指定的路径中创建一个空的.gitignore文件就可以解决这个问题
我还使用了可移植的Node版本。如果你去源代码,那里没有.gitignore文件!您可以从下载.gitignore文件https://github.com/microsoft/vscode-generator-code/tree/main/generators/app/templates/ext-command-ts例如用于Typescript模板。