Partage
  • Partager sur Facebook
  • Partager sur Twitter

SASS - NPM Run Sass

Sujet résolu
    20 janvier 2020 à 6:23:30

    Bonjour, 

    Je travaille actuellement sur le cours "https://openclassrooms.com/fr/courses/6106181-simplifiez-vous-le-css-avec-sass/6599386-installez-sass-sur-votre-machine".

    J'avais déjà travaillé sur du SCSS et du CSS avec la commande watch et ça marchait bien mais il fallait systèmatiquement faire un watch à chaque fois que je voulais modifier le fichier SCSS. 

    Je voudrais utiliser la technique de ce cours avec npm et le terminal comme expliqué. Cependant, ça ne fonctionne pas de mon côté, pourtant si je fais l'exercice, ça marche et jusqu'ici je pouvais très bien compiler mon scss en css et voir un résultat fonctionnel.

    Lorsque je saisis la commande "npm run sass", j'obtiens d'abord un message confirmant que Sass is watching for changes puis j'obtiens l'erreur suivante : 

    PS C:\wamp64\www\SASS3> sass --version
    Ruby Sass 3.7.4
    PS C:\wamp64\www\SASS3> npm run sass
    
    > raslebol@1.0.0 sass C:\wamp64\www\SASS3
    > sass --watch ./sass/main.scss:./css/style.css
    
    >>> Sass is watching for changes. Press Ctrl-C to stop.
    Errno::ENOENT: No such file or directory @ rb_sysopen - ./css/style.css
      Use --trace for backtrace.
    
    npm ERR! Windows_NT 10.0.18362
    npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\laure\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "sass"
    npm ERR! node v12.13.1
    npm ERR! npm  v4.0.5
    npm ERR! code ELIFECYCLE
    npm ERR! raslebol@1.0.0 sass: `sass --watch ./sass/main.scss:./css/style.css`
    npm ERR! Exit status 1
    npm ERR! 
    npm ERR! Failed at the raslebol@1.0.0 sass script 'sass --watch ./sass/main.scss:./css/style.css'.
    npm ERR! Make sure you have the latest version of node.js and npm installed.
    npm ERR! If you do, this is most likely a problem with the raslebol package,
    npm ERR! not with npm itself.
    npm ERR! Tell the author that this fails on your system:
    npm ERR!     sass --watch ./sass/main.scss:./css/style.css
    npm ERR! You can get information on how to open an issue for this project with:
    npm ERR!     npm bugs raslebol
    npm ERR! Or if that isn't available, you can get their info via:
    npm ERR!     npm owner ls raslebol
    npm ERR! There is likely additional logging output above.
    npm WARN Local package.json exists, but node_modules missing, did you mean to install?
    
    npm ERR! Please include the following file with any support request:
    npm ERR!     C:\wamp64\www\SASS3\npm-debug.log
    PS C:\wamp64\www\SASS3> 

    Le logfile en question est le suivant : 

    0 info it worked if it ends with ok
    1 verbose cli [
    1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
    1 verbose cli   'C:\\Users\\laure\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
    1 verbose cli   'run',
    1 verbose cli   'sass'
    1 verbose cli ]
    2 info using npm@4.0.5
    3 info using node@v12.13.1
    4 verbose run-script [ 'presass', 'sass', 'postsass' ]
    5 info lifecycle raslebol@1.0.0~presass: raslebol@1.0.0
    6 silly lifecycle raslebol@1.0.0~presass: no script for presass, continuing
    7 info lifecycle raslebol@1.0.0~sass: raslebol@1.0.0
    8 verbose lifecycle raslebol@1.0.0~sass: unsafe-perm in lifecycle true
    9 verbose lifecycle raslebol@1.0.0~sass: PATH: C:\Users\laure\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin;C:\wamp64\www\SASS3\node_modules\.bin;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\wamp64\bin\php\php5.6.40;C:\ProgramData\ComposerSetup\bin;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Ruby26-x64\bin;C:\Users\laure\AppData\Local\Microsoft\WindowsApps;C:\Users\laure\AppData\Local\atom\bin;C:\Users\laure\AppData\Roaming\Composer\vendor\bin;C:\Users\laure\AppData\Local\GitHubDesktop\bin;C:\Users\laure\AppData\Roaming\npm
    10 verbose lifecycle raslebol@1.0.0~sass: CWD: C:\wamp64\www\SASS3
    11 silly lifecycle raslebol@1.0.0~sass: Args: [ '/d /s /c', 'sass --watch ./sass/main.scss:./css/style.css' ]
    12 silly lifecycle raslebol@1.0.0~sass: Returned: code: 1  signal: null
    13 info lifecycle raslebol@1.0.0~sass: Failed to exec sass script
    14 verbose stack Error: raslebol@1.0.0 sass: `sass --watch ./sass/main.scss:./css/style.css`
    14 verbose stack Exit status 1
    14 verbose stack     at EventEmitter.<anonymous> (C:\Users\laure\AppData\Roaming\npm\node_modules\npm\lib\utils\lifecycle.js:279:16)
    14 verbose stack     at EventEmitter.emit (events.js:210:5)
    14 verbose stack     at ChildProcess.<anonymous> (C:\Users\laure\AppData\Roaming\npm\node_modules\npm\lib\utils\spawn.js:40:14)
    14 verbose stack     at ChildProcess.emit (events.js:210:5)
    14 verbose stack     at maybeClose (internal/child_process.js:1021:16)
    14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
    15 verbose pkgid raslebol@1.0.0
    16 verbose cwd C:\wamp64\www\SASS3
    17 error Windows_NT 10.0.18362
    18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\laure\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "sass"
    19 error node v12.13.1
    20 error npm  v4.0.5
    21 error code ELIFECYCLE
    22 error raslebol@1.0.0 sass: `sass --watch ./sass/main.scss:./css/style.css`
    22 error Exit status 1
    23 error Failed at the raslebol@1.0.0 sass script 'sass --watch ./sass/main.scss:./css/style.css'.
    23 error Make sure you have the latest version of node.js and npm installed.
    23 error If you do, this is most likely a problem with the raslebol package,
    23 error not with npm itself.
    23 error Tell the author that this fails on your system:
    23 error     sass --watch ./sass/main.scss:./css/style.css
    23 error You can get information on how to open an issue for this project with:
    23 error     npm bugs raslebol
    23 error Or if that isn't available, you can get their info via:
    23 error     npm owner ls raslebol
    23 error There is likely additional logging output above.
    24 verbose exit [ 1, true ]
    

    Et voici mon package json : 

    {
      "name": "raslebol",
      "version": "1.0.0",
      "description": "Joe Blow's portfolio",
      "main": "index.js",
      "scripts": {
        "sass": "sass --watch ./sass/main.scss:./css/style.css"
      },
      "repository": {
        "type": "git",
        "url": "git+https://github.com/gerkx/maintainable-css-with-sass.git"
      },
      "author": "néant",
      "license": "ISC",
      "bugs": {
        "url": "https://github.com/gerkx/maintainable-css-with-sass/issues"
      },
      "homepage": "https://github.com/gerkx/maintainable-css-with-sass#readme"
    }
    

    J'ai cherché depuis deux jours des solutions sur le web, j'ai installé vs code pour utiliser le même outils, j'ai réinstallé et même essayer de changer de version mais rien n'y fait. Auriez-vous des solutions s'il vous plait ? Je suis coincée. Merci beaucoup.



    • Partager sur Facebook
    • Partager sur Twitter
      20 janvier 2020 à 10:22:34

      Bonjour,

      je suis désolé d'avance pour le HS... ^^

      Je t'encourage à te tourner vers une distribution Linux type Ubuntu ou autre pour développer.

      Tu trouvera plus facilement de la documentation sur internet quand tu rencontreras des problèmes et quoi qu'il arrive, tu croisera forcement la route des serveurs Linux dans ton métier, donc autant s'y mettre le plus tôt possible.

      Ça ne veut pas dire que tu dois abandonner Windows, mais ça peut te faciliter la tâche de travailler dans un environnement Linux.

      Après, ce n'est que mon avis.

      Bon courage pour ton dev !

      • Partager sur Facebook
      • Partager sur Twitter
        20 janvier 2020 à 10:34:27

        Bonjour,

        L'erreur est basique et le message d'erreur est tout aussi clair :

        No such file or directory @ rb_sysopen - ./css/style.css

        C'est même réécrit plus bas :

        npm ERR! Tell the author that this fails on your system: sass --watch ./sass/main.scss:./css/style.css

        Ce sont les chemins vers les fichiers qui sont faux.


        • Partager sur Facebook
        • Partager sur Twitter
        Je ne réponds pas aux messages privés.
          20 janvier 2020 à 11:21:43

          Bonjour Mewen_bzh et RR, 

          Merci beaucoup, c'est résolu, l'erreur venait bien du chemin, bonne journée.

          • Partager sur Facebook
          • Partager sur Twitter

          SASS - NPM Run Sass

          × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
          × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
          • Editeur
          • Markdown