简体   繁体   中英

npm run watch gives errors after update to Mac OS X Mojave

After upgrading the system I get the error as shown below while trying to run npm run watch.

Npm version is 6.4.1 Node v. 11.0.0

ERROR in ./node_modules/css-loader??ref--5-2!./node_modules/postcss-loader/lib??postcss!./node_modules/resolve-url-loader??ref--5-4!./node_modules/sass-loader/lib/loader.js??ref--5-5!./resources/sass/app.scss
Module build failed: Error: Node Sass does not yet support your current environment: OS X 64-bit with Unsupported runtime (67)

Anyone knows how to fix this? I googled for solutions and find eg. this one https://github.com/sass/node-sass/issues/1764 but nothing helps.

I had to use

npm rebuild node-saas --force

and that worked for me on Mojave, Node 11.4.0

So I found the solution. It turned out that I had to install newer version of node by executing:

sudo n latest

At the time I write this the newest version of node is 11.1.0. When the newest node is installed I could rebuild node-saas by:

npm rebuild node-saas

it takes a while to compile all of this, but after that all works just fine.

Edit: I just try this solution with other project and rebuilding node-saas didn't want to start. What helped was remove the node_modules category and executing npm install.

The Problem is with Node version. the latest Node-Sass supports node version below 9. https://github.com/sass/node-sass/releases/tag/v4.7.2

So try downgrading node to lower versions like below

npm install -gn <-- will install n, which is used to install the required node version

n 9 <-- will install node version 9.xx

now delete node modules and package.json.lock file and npm install

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM