嘿,伙计们,我刚来包裹,我正试着用包裹在上面建立我的网站。我用
npm install --save-dev parcel但没起作用。然后我跑了包裹index.html,它回来了
parcel : The term 'parcel' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name,
or if a path was included, verify that the path is correct and try again. 我试着卸载包裹并重新安装,但没有工作。知道为什么会这样吗?提前谢谢你。下面是我的package.json
package.json
{
"dependencies": {
"dat.gui": "^0.7.7",
"gsap": "^3.6.0",
"load-asset": "^1.2.0",
"nice-color-palettes": "^3.0.0",
"three": "^0.126.1",
"vec2": "^1.6.1"
},
"devDependencies": {
"glslify-bundle": "^5.1.1",
"glslify-deps": "^1.3.2",
"parcel": "^2.0.1",
"parcel-bundler": "^1.12.5"
}
}发布于 2021-11-18 15:03:15
当您运行npm install --save-dev parcel时,您正在安装只用于此特定项目的本地包,而不是计算机上的任何地方(请参见文档)。因此,默认情况下,与这些包相关的命令不会添加到CLI的全局路径中。运行本地安装命令的一种方法是将它们放在package.json的"scripts"字段中:
{
...
"scripts": {
"build": "parcel index.html"
}
}当它们在这个上下文中运行时,它们将可以访问本地安装的包。
我注意到了package.json的另一个问题--您同时安装了parcel-bundler和parcel包。parcel-bundler是废弃的v1版本的包裹,当它与parcel (v2)包并排安装时,它将覆盖scripts中的package命令,所以您将得到v1而不是v2,这可能不是您想要的。我建议运行npm uninstall parcel-bundler。
https://stackoverflow.com/questions/70014481
复制相似问题