Describe the bug
i followed the instructions from the official website https://sapper.svelte.dev/
When i installed Sapper for Webpack everything is worked fine, But for rollup i found this issue when i run the project by npm run dev:
Logs
> [email protected] dev /home/zaki/Documents/MyProjects/sapper/my-sapperVVV
> sapper dev
(node:23874) UnhandledPromiseRejectionWarning: Error: No valid exports main found for '/home/zaki/Documents/MyProjects/sapper/my-sapperVVV/node_modules/@rollup/pluginutils'
at resolveExportsTarget (internal/modules/cjs/loader.js:622:9)
at applyExports (internal/modules/cjs/loader.js:499:14)
at resolveExports (internal/modules/cjs/loader.js:548:12)
at Function.Module._findPath (internal/modules/cjs/loader.js:654:22)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:953:27)
at Function.Module._load (internal/modules/cjs/loader.js:859:27)
at Module.require (internal/modules/cjs/loader.js:1028:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (/home/zaki/Documents/MyProjects/sapper/my-sapperVVV/node_modules/@rollup/plugin-node-resolve/dist/index.js:15:19)
at Module._compile (internal/modules/cjs/loader.js:1139:30)
(node:23874) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:23874) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Information about your Sapper Installation:
Your operating system: Linux - opensuse tumbleweed
Your hosting environment: Local
Sapper version : "^0.27.0"
Rollup template
* my package.json *
{
"name": "TODO",
"description": "TODO",
"version": "0.0.1",
"scripts": {
"dev": "sapper dev",
"build": "sapper build --legacy",
"export": "sapper export --legacy",
"start": "node __sapper__/build",
"cy:run": "cypress run",
"cy:open": "cypress open",
"test": "run-p --race dev cy:run"
},
"dependencies": {
"compression": "^1.7.1",
"polka": "next",
"sirv": "^0.4.0"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/plugin-transform-runtime": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/runtime": "^7.0.0",
"@rollup/plugin-babel": "^5.0.0",
"@rollup/plugin-commonjs": "^12.0.0",
"@rollup/plugin-node-resolve": "^8.0.0",
"@rollup/plugin-replace": "^2.2.0",
"@rollup/pluginutils": "^3.1.0",
"npm-run-all": "^4.1.5",
"rollup": "^2.3.4",
"rollup-plugin-svelte": "^5.0.1",
"rollup-plugin-terser": "^5.3.0",
"sapper": "^0.27.0",
"svelte": "^3.0.0"
}
}
I cannot reproduce this, and this sounds like an environmental issue. Try deleting and reinstalling dependencies, and if that doesn't work, ask in the chat.
i already did that before asking here .. and i already put this problem in Discord no answer
no problem with WebPack
now i deleted the rollup version 2.3.4 and i installed the version 2.13.0 with Yarn
it's work fine but under root privileges!
sudo npm run dev But WHY?
@zakaria-chahboun if you're having to run npm run dev with root privileges your environment is definitely not in a good state.
This is something specific to your machine, it sounds like you have node set up incorrectly and it's causing things to be installed with incorrect permissions. Furthermore when you work around it by writing sudo before things, it's only going to make the problem worse.
I suggest removing node from your machine entirely, and re-installing using nvm or equivalent, and trying again.
@antony Thanks. but this actually not happen with other npm project such as the same project with webpack ! only happen when rollup troubles showed up!
But i will try do reinstall node and install it again.
@antony Thanks it's works fine!
i remove npm and nodejs, and i re installed from my opensuse packages manager
my nodejs version now is 14.3.0 and npm version 6.14.5
Glad it works. I'd still advise running via nvm though - often globally package managed node means that global modules need to be installed as root, which is just bad.
I just ran into this issue on npm v13.6.0. I already use nvm and I installed and used v14.3.0 and now it works! Others will probably run into this since it is likely not an installation issue - it seems to be related to the actual underlying node version.
@parker-codes Yeah that's exactly what i did!
Most helpful comment
I just ran into this issue on npm v13.6.0. I already use nvm and I installed and used v14.3.0 and now it works! Others will probably run into this since it is likely not an installation issue - it seems to be related to the actual underlying node version.