sveltejs / sapper-template

Starter template for Sapper apps
703 stars 215 forks source link

Error: Unexpected character '�' (Note that you need plugins to import files that are not JavaScript) #288

Open SARFEX opened 3 years ago

SARFEX commented 3 years ago

npx degit "sveltejs/sapper-template#rollup" sapper-app cd sapper-app npm install npm run dev

d:\Projects\sapper-app>npm run dev

> TODO@0.0.1 dev d:\Projects\sapper-app
> sapper dev

✗ server
Unexpected character '�' (Note that you need plugins to import files that are not JavaScript)
f2☺☻¶ti�♦☺��7☻¶7☻¶GIMP 2.10.142020:02:08 18:32:30☺☺�♥☺☺♦☺☺☺☺♦☺�☻☺♥♥☺♥☺♥☺♠♠☺♥☺♠§☺♥☺♥☺☻♦☺♠☺☻☻♦����►JFIF☺☺☺☺��♠♠♠♣
   ^
↑2!∟!22222222222222222222222222222222222222222222222222���☺♥☺"☻◄☺♥◄☺��▼☺♣☺☺☺☺☺☺☺☻♥♦♣♠
3: ♂���►☻☺♥♥☻♦♥♣♣♦♦☺}☺☻♥♦◄♣↕!1A♠‼Qa"q¶2��#B��§R��$3br�
✗ client
Unexpected character '�' (Note that you need plugins to import files that are not JavaScript)
f2☺☻¶ti�♦☺��7☻¶7☻¶GIMP 2.10.142020:02:08 18:32:30☺☺�♥☺☺♦☺☺☺☺♦☺�☻☺♥♥☺♥☺♥☺♠♠☺♥☺♠§☺♥☺♥☺☻♦☺♠☺☻☻♦����►JFIF☺☺☺☺��♠♠♠♣
   ^
↑2!∟!22222222222222222222222222222222222222222222222222���☺♥☺"☻◄☺♥◄☺��▼☺♣☺☺☺☺☺☺☺☻♥♦♣♠
3: ♂���►☻☺♥♥☻♦♥♣♣♦♦☺}☺☻♥♦◄♣↕!1A♠‼Qa"q¶2��#B��§R��$3br�
internal/modules/cjs/loader.js:883
  throw err;
  ^

Error: Cannot find module 'd:\Projects\sapper-app\__sapper__\dev\server\server.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
> Server crashed
✔ service worker (68ms)
Conduitry commented 3 years ago

I can't reproduce this either. Similar to in https://github.com/sveltejs/template/issues/193, it sounds like you don't have the proper Rollup plugins installed and configured, in this case the @rollup/plugin-url plugin, which is present in the template in rollup.config.js.

zekecato commented 3 years ago

I got this exact error. I've never used Rollup. If I needed to install that separately, I would like to have that in the tutorial that suggests using this template.

zekecato commented 3 years ago

I tried in Ubuntu 18 and it works fine. Windows 10 is where I have the issue.

NikolayMakhonin commented 3 years ago

Template version: https://github.com/sveltejs/sapper-template/commit/0d7d0209d0012614e1ede39aaa34e3baedc6606c Sapper version: 0.28.0 Svelte version: 3.17.3 NodeJS: v12.17.0 NPM: 6.13.6

I reproduced it. I just followed the instruction: (remove all global dependencies before)

npx degit "sveltejs/sapper-template#rollup" counter-sapper
cd counter-sapper
node scripts/setupTypeScript.js
npm i
npm run dev

Error:

l:\Work\_GIT\GitHub\NodeJs\apps\counter-sapper>npm run dev

> TODO@0.0.1 dev l:\Work\_GIT\GitHub\NodeJs\apps\counter-sapper
> sapper dev

? client
Unexpected character '?' (Note that you need plugins to import files that are not JavaScript)
   f   2☺☻ ¶   t   i?♦ ☺   ?   ?   7☻  ¶   7☻  ¶   GIMP 2.10.14  2020:02:08 18:32:30 ☺ ☺?♥ ☺   ☺       ☺♦ ☺    ☺  ☺☺♦ ☺   ?   ☻☺♥ ♥    ☺  ♥☺♥ ☺   ♠   ♠☺♥ ☺   ♠   §☺♥ ☺   ♥   ☺☻♦ ☺   ♠☺
  ☻☻♦ ☺   ?▬   ???? ►JFIF ☺☺  ☺ ☺  ?? ♠♠♠
   ^
↑2!∟!22222222222222222222222222222222222222222222222222??  ?☺ ♥☺" ☻◄☺♥◄☺?? ▼  ☺♣☺☺☺☺☺☺        ☺☻♥♦
3: ♂?? ?► ☻☺♥♥☻♦♥♣♣♦♦  ☺}☺☻♥ ♦◄♣↕!1A♠‼Qa"q¶2?#B??§R??$3br?
? server
Unexpected character '?' (Note that you need plugins to import files that are not JavaScript)
   f   2☺☻ ¶   t   i?♦ ☺   ?   ?   7☻  ¶   7☻  ¶   GIMP 2.10.14  2020:02:08 18:32:30 ☺ ☺?♥ ☺   ☺       ☺♦ ☺    ☺  ☺☺♦ ☺   ?   ☻☺♥ ♥    ☺  ♥☺♥ ☺   ♠   ♠☺♥ ☺   ♠   §☺♥ ☺   ♥   ☺☻♦ ☺   ♠☺
  ☻☻♦ ☺   ?▬   ???? ►JFIF ☺☺  ☺ ☺  ?? ♠♠♠
   ^
↑2!∟!22222222222222222222222222222222222222222222222222??  ?☺ ♥☺" ☻◄☺♥◄☺?? ▼  ☺♣☺☺☺☺☺☺        ☺☻♥♦
3: ♂?? ?► ☻☺♥♥☻♦♥♣♣♦♦  ☺}☺☻♥ ♦◄♣↕!1A♠‼Qa"q¶2?#B??§R??$3br?
internal/modules/cjs/loader.js:969
  throw err;
  ^

Error: Cannot find module 'l:\Work\_GIT\GitHub\NodeJs\apps\counter-sapper\__sapper__\dev\server\server.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
    at Function.Module._load (internal/modules/cjs/loader.js:842:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
> Server crashed
? service worker (2.2s)

package.json

{
  ...
  "dependencies": {
    "compression": "^1.7.1",
    "polka": "next",
    "sirv": "^1.0.0"
  },
  "devDependencies": {
    "sapper": "^0.28.0",
    "svelte": "^3.17.3",
    "@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": "^14.0.0",
    "@rollup/plugin-node-resolve": "^8.0.0",
    "@rollup/plugin-replace": "^2.2.0",
    "@rollup/plugin-url": "^5.0.0",
    "rollup": "^2.3.4",
    "rollup-plugin-svelte": "^7.0.0",
    "rollup-plugin-terser": "^7.0.0",
    "@rollup/plugin-typescript": "^6.0.0",
    "@tsconfig/svelte": "^1.0.10",
    "@types/compression": "^1.7.0",
    "@types/node": "^14.11.1",
    "@types/polka": "^0.5.1",
    "svelte-check": "^1.0.46",
    "svelte-preprocess": "^4.3.0",
    "tslib": "^2.0.1",
    "typescript": "^4.0.3"
  }
}
benmccann commented 3 years ago

This might be a result of https://github.com/rollup/plugins/issues/287