hey guys i new to parcel and i am trying to use parcel to build my website on it. i installed parcel using
npm install --save-dev parcel
but didnt work. then i ran parcel index.html and it returns
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.
i tried uninstalling parcel and reinstalling but didnt work. Any ideas why this happens? thank you in advance. below is my 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"
}
}
When you run npm install --save-dev parcel
, you are installing local packages that are only intended to be used in this particular project, not everywhere on your computer (see docs). So commands associated with those packages aren't added to your CLI's global path by default. One way to run locally installed commands is to put them your package.json
's "scripts"
field:
{
...
"scripts": {
"build": "parcel index.html"
}
}
When they are run in that context, they'll have access to the locally installed packages.
I noticed another problem with your package.json
- you have both parcel-bundler
and parcel
packages installed. parcel-bundler
is the deprecated v1 version of parcel, and when it's installed side-by-side with the parcel
(v2) package, it will override the parcel command in your scripts
, so you'll be getting v1 instead of v2, which is probably not what you want. I'd recommend running npm uninstall parcel-bundler
.