Enyak Stew
Enyak Stew

Reputation: 176

unable to correctly install parcel using npm

I'm using the command 'npm -g install parcel-bundler', to install parcel globally and get no error, but then it doesn't seem to be installed. When i run the command 'parcel --version' i get 'command not found', same for any other 'parcel' commands. I've tried running the 'install' command again and I get a '[email protected] updated 2 packages in 20.003s'. i have several 'deprecated' warnings, could the problem come from that ? here they are :

npm WARN deprecated [email protected]: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3. npm WARN deprecated [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies. npm WARN deprecated [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2. npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142 npm WARN deprecated [email protected]: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142 npm WARN deprecated [email protected]: this library is no longer supported /Users/user.npm-packages/bin/parcel -> /Users/user/.npm-packages/lib/node_modules/parcel-bundler/bin/cli.js

Thanks

EDIT : I have tried updating all the deprecated items manually and re-installing Parcel, it didin't fix the problem.

Upvotes: 1

Views: 4753

Answers (1)

iamkirill
iamkirill

Reputation: 379

Recently I encountered the same problem and while I don't fully understand why this happens, I manage to find some workarounds to run parcel:

  • After installation using npm, run the same commands but adding npx before them, for example, I create a server through npx parcel index.html;
  • Install it using yarn (yarn add parcel-bundler) and then, for example, run a server (yarn parcel index.html). Same deprecated warnings here but they don't prevent the package from running;

Update: if install the package locally there are even more ways.

  • You can do what npx does under the hood: ./node_modules/.bin/parcel --version;
  • Create custom shorthand command in package.json. Under scripts object add "server": "parcel index.html". The part before colon can be named anything you like. After that run npm run server and this would work.

Upvotes: 1

Related Questions