This page looks best with JavaScript enabled

npm run does nothing at Svelte startup

 ·   ·  ☕ 2 min read

I was getting back to Svelte for a small project and ran into a strange issue. npm run dev did not run the svelte app as expected - no output or errors.

First I create a new project.

1
2
3
4
npx degit sveltejs/template awesome-project-1
cd awesome-project-1
npm i
npm run dev

And, I get greeted with nothing. I did not have any errors or output to debug.

tldr;

Set config ignore-scripts to false and retry.

1
npm config set ignore-scripts false

That’s it!

More information that no one asked for

The commands executed by run dev did not help as well.

node node_modules\rollup\dist\rollup -c -w

But, npm start worked without issues (but that does not have hot reloading).That gave me an idea but I do not understand rollup to dig further into the issue.

I first tried using webpack bundler instead of rollup.

1
2
3
npx degit sveltejs/template-webpack svelte-webpack
npm i
npm run dev

This worked just fine.

After trying a bit to change rollup configuration to output anything at all, it came back to me - I had set ignore-scripts to true after listening to a security expert talk on node security. The configuration will ignore post install scripts and I was fine with that.

Apparently, this has a different effect on rollup.

Set the config back to false ran everything as expected.

1
npm config set ignore-scripts false

I don’t understand rollup enough and do not know what the issue is. But I will stick to webpack for now and retain ignore-scripts config with npm.

Stay in touch!
Share on

Prashanth Krishnamurthy
WRITTEN BY
Prashanth Krishnamurthy
Technologist | Creator of Things