Closed desairaj414 closed 8 months ago
Hi,
fast-serve
is not a global CLI, meaning that you don't install it globally with npm i -g
. Instead it's installed locally as part of the spfx-fast-serve-helpers
module. That is why, if you want to run cli from command line, you should use npx
. You don't need to install npx
, since it's installed automatically with npm.
In your case it means, that you should run
npx fast-serve config add
And you should alwyas simply have to use npx as a prefix, when running fast-serve from command line. However, npx is not needed inside package.json
npm scripts, because npm resolves everything internally.
Maybe it's not that clear in documentation, this npx things, I will update the docs later to make it more explicit.
Yeah, I had gone through the docs, but it was confusing for me. Really thanks a lot for answering in such short time. Have a nice day :)
``Hello,
I just installed spfx-fast-serve ver 4 in SPFx ver 1.18.2 and node ver 1.16.2. I followed all the steps mentioned in the page. but still cant run fast-serve cli commands like 'fast-serve config add'.
And here is my package.json file.
{ "name": "spfx-testing", "version": "0.0.1", "private": true, "engines": { "node": ">=16.13.0 <17.0.0 || >=18.17.1 <19.0.0" }, "main": "lib/index.js", "scripts": { "build": "gulp bundle", "clean": "gulp clean", "test": "gulp test", "serve": "fast-serve" }, "dependencies": { "tslib": "2.3.1", "react": "17.0.1", "react-dom": "17.0.1", "@fluentui/react": "^8.106.4", "@microsoft/sp-core-library": "1.18.2", "@microsoft/sp-component-base": "1.18.2", "@microsoft/sp-property-pane": "1.18.2", "@microsoft/sp-webpart-base": "1.18.2", "@microsoft/sp-lodash-subset": "1.18.2", "@microsoft/sp-office-ui-fabric-core": "1.18.2" }, "devDependencies": { "@microsoft/rush-stack-compiler-4.7": "0.1.0", "@rushstack/eslint-config": "2.5.1", "@microsoft/eslint-plugin-spfx": "1.18.2", "@microsoft/eslint-config-spfx": "1.18.2", "@microsoft/sp-build-web": "1.18.2", "@types/webpack-env": "~1.15.2", "ajv": "^6.12.5", "eslint": "8.7.0", "gulp": "4.0.2", "typescript": "4.7.4", "@types/react": "17.0.45", "@types/react-dom": "17.0.17", "eslint-plugin-react-hooks": "4.3.0", "@microsoft/sp-module-interfaces": "1.18.2", "spfx-fast-serve-helpers": "~1.18.0" } }
So as I can see fast serve helper is installed but still can't access or run fast-serve cli commands.