Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

KostaK's avatar

npm run build giving some sort of Alpine error?

Hi,

So I tried to do an npm run build (which I use to compile my Tailwind CSS) - and got this weird error that came up.. which may be due to me stupidly trying to install Breeze on an all ready existing application.. who knows.. anyway long story short here is the error message I get:

`forge@big-stem:~/rrdevours.monster$ npm run build

build vite build

vite v2.9.15 building for production... ✓ 1 modules transformed. [vite]: Rollup failed to resolve import "alpinejs" from "resources/js/app.js". This is most likely unintended because it can break your application at runtime. If you do want to externalize this module explicitly add it to build.rollupOptions.external error during build: Error: [vite]: Rollup failed to resolve import "alpinejs" from "resources/js/app.js". This is most likely unintended because it can break your application at runtime. If you do want to externalize this module explicitly add it to build.rollupOptions.external at onRollupWarning (/home/forge/rrdevours.monster/node_modules/vite/dist/node/chunks/dep-689425f3.js:41797:19) at onwarn (/home/forge/rrdevours.monster/node_modules/vite/dist/node/chunks/dep-689425f3.js:41613:13) at Object.onwarn (/home/forge/rrdevours.monster/node_modules/rollup/dist/shared/rollup.js:23216:13) at ModuleLoader.handleResolveId (/home/forge/rrdevours.monster/node_modules/rollup/dist/shared/rollup.js:22466:26) at /home/forge/rrdevours.monster/node_modules/rollup/dist/shared/rollup.js:22427:26`

If anyone has experience of this error I can revert to where vite is working beautifully it would be much appreciated (or to check anything).

Thanks

0 likes
3 replies
Nihir's avatar

You should try

1> remove node_mdoules folder or deleted this folder.

2> Try to new installation of ``npm installation```

3>Run command npm run dev.

4>if this all are successfull. then run ``npm run build ornpm run watch``` as per your requirenments.

2 likes
KostaK's avatar

@Nihir Hey thanks, I ended up solving this by going to alpine.js and just commenting the stuff out as I only needed Tailwind compile, thank you :)

Nihir's avatar
Nihir
Best Answer
Level 50

@KostaK Glad to see your query has been solved.

1 like

Please or to participate in this conversation.