#npm build works locally, package not found on Forge

4 messages · Page 1 of 1 (latest)

wraith pewter
#

I have added the react-facebook-pixel (https://www.npmjs.com/package/react-facebook-pixel) package but it just won't compile using Forge deployments no matter what. Tried to reset the git and deployment states with no success.

resources/js/Pages/Product.tsx(31,24): error TS2307: Cannot find module 'react-facebook-pixel' or its corresponding type declarations.
import ReactPixel from "react-facebook-pixel";
ReactPixel.track("AddToCart", {
            content_ids: [designId],
            content_type: "product",
            value: 34.99,
            currency: "USD",
        });
nimble trench
#

Do you also run something like npm ci? Sounds like the package isn't part of the lock file that's used or you're skipping the install step

wraith pewter
# nimble trench Do you also run something like `npm ci`? Sounds like the package isn't part of t...

Nope, here's my deployment script:

cd /home/forge/domain.com
git pull origin $FORGE_SITE_BRANCH

$FORGE_COMPOSER install --no-dev --no-interaction --prefer-dist --optimize-autoloader

( flock -w 10 9 || exit 1
    echo 'Restarting FPM...'; sudo -S service $FORGE_PHP_FPM reload ) 9>/tmp/fpmlock

if [ -f artisan ]; then
    $FORGE_PHP artisan migrate --force
fi

npm run build
php artisan config:clear

$FORGE_PHP artisan inertia:stop-ssr

I tried to declare the module in a decs.t.ts file with no success either (declare module "react-facebook-pixel")

nimble trench