Error when running yarn first time to install packages

I have an existing project I am setting up on a second computer. When I go to run the “yarn” command to install all the packages I get the error below. It looks to be a node-gyp error when trying to install node-sass. I’m not sure what all that means and my google searches haven’t been fruitful. Any ideas to what might be going on?

Error was too long to post here but here’s what I was seeing: https://pastebin.com/5QjdnEvV

The node-sass install instructions mention that Windows has special requirements for node-gyp: https://github.com/nodejs/node-gyp#on-windows That’s probably a good place to start.

I’ve usually just solved this issue by switching to the sass package, which has the same functionality and a nearly identical API as node-sass but doesn’t require any external dependencies: https://www.npmjs.com/package/sass

Thanks for that, now that you mention that about node-gyp I vaguely remember following those steps previously. I actually have another very similar sage site running on this system without any issues.

I retried those instructions for node-gyp and separately tried replacing node-sass with sass. sass-loader didn’t like that so I removed it as well. I even tried manually copy and pasting my node_modules and packages from my other system.

All of them gave me a similar error which again, didn’t have much luck finding a solution.

yarn run v1.22.0
$ webpack --hide-modules --watch --config resources/assets/build/webpack.config.js
C:\Users\username\Documents\Projects\ProjectName\wp-content\themes\aos\node_modules\webpack-cli\bin\cli.js:93
                                throw err;
                                ^

Error: invalid "instanceof" keyword value Promise
    at getConstructor (C:\Users\username\Documents\Projects\ProjectName\wp-content\themes\aos\node_modules\ajv-keywords\keywords\instanceof.js:52:11)
    at Ajv.compile (C:\Users\username\Documents\Projects\ProjectName\wp-content\themes\aos\node_modules\ajv-keywords\keywords\instanceof.js:21:27)
    at Object.useCustomRule (C:\Users\username\Documents\Projects\ProjectName\wp-content\themes\aos\node_modules\webpack\node_modules\ajv\lib\compile\index.js:275:26)
    at Object.generate_custom [as code] (C:\Users\username\Documents\Projects\ProjectName\wp-content\themes\aos\node_modules\webpack\node_modules\ajv\lib\dotjs\custom.js:32:24)
    at Object.generate_validate [as validate] (C:\Users\username\Documents\Projects\ProjectName\wp-content\themes\aos\node_modules\webpack\node_modules\ajv\lib\dotjs\validate.js:347:35)
    at Object.generate_anyOf [as code] (C:\Users\username\Documents\Projects\ProjectName\wp-content\themes\aos\node_modules\webpack\node_modules\ajv\lib\dotjs\anyOf.js:34:27)
    at generate_validate (C:\Users\username\Documents\Projects\ProjectName\wp-content\themes\aos\node_modules\webpack\node_modules\ajv\lib\dotjs\validate.js:347:35)
    at localCompile (C:\Users\username\Documents\Projects\ProjectName\wp-content\themes\aos\node_modules\webpack\node_modules\ajv\lib\compile\index.js:87:22)
    at Ajv.compile (C:\Users\username\Documents\Projects\ProjectName\wp-content\themes\aos\node_modules\webpack\node_modules\ajv\lib\compile\index.js:56:13)
    at Ajv._compile (C:\Users\username\Documents\Projects\ProjectName\wp-content\themes\aos\node_modules\webpack\node_modules\ajv\lib\ajv.js:358:27)
    at Ajv.compile (C:\Users\username\Documents\Projects\ProjectName\wp-content\themes\aos\node_modules\webpack\node_modules\ajv\lib\ajv.js:118:37)
    at validateObject (C:\Users\username\Documents\Projects\ProjectName\wp-content\themes\aos\node_modules\webpack\lib\validateSchema.js:36:23)
    at validateSchema (C:\Users\username\Documents\Projects\ProjectName\wp-content\themes\aos\node_modules\webpack\lib\validateSchema.js:31:10)
    at processConfiguredOptions (C:\Users\username\Documents\Projects\ProjectName\wp-content\themes\aos\node_modules\webpack-cli\bin\utils\convert-argv.js:140:49)
    at module.exports (C:\Users\username\Documents\Projects\ProjectName\wp-content\themes\aos\node_modules\webpack-cli\bin\utils\convert-argv.js:133:10)
    at C:\Users\username\Documents\Projects\ProjectName\wp-content\themes\aos\node_modules\webpack-cli\bin\cli.js:71:45
    at Object.parse (C:\Users\username\Documents\Projects\ProjectName\wp-content\themes\aos\node_modules\webpack-cli\node_modules\yargs\yargs.js:567:18)
    at C:\Users\username\Documents\Projects\ProjectName\wp-content\themes\aos\node_modules\webpack-cli\bin\cli.js:49:8    at Object.<anonymous> (C:\Users\username\Documents\Projects\ProjectName\wp-content\themes\aos\node_modules\webpack-cli\bin\cli.js:365:3)
    at Module._compile (internal/modules/cjs/loader.js:955:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
    at Module.load (internal/modules/cjs/loader.js:811:32)
    at Function.Module._load (internal/modules/cjs/loader.js:723:14)
    at Module.require (internal/modules/cjs/loader.js:848:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at module.exports (C:\Users\username\AppData\Roaming\npm\node_modules\webpack-cli\node_modules\import-local\index.js:16:66) 
    at C:\Users\username\AppData\Roaming\npm\node_modules\webpack-cli\bin\cli.js:15:6
    at Object.<anonymous> (C:\Users\username\AppData\Roaming\npm\node_modules\webpack-cli\bin\cli.js:366:3)
    at Module._compile (internal/modules/cjs/loader.js:955:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Here is my package.json:

    {
"name": "sage",
"version": "9.0.9",
"author": "Roots <team@roots.io>",
"homepage": "https://roots.io/sage/",
"private": true,
"repository": {
    "type": "git",
    "url": "git://github.com/roots/sage.git"
},
"bugs": {
    "url": "https://github.com/roots/sage/issues"
},
"licenses": [
    {
    "type": "MIT",
    "url": "http://opensource.org/licenses/MIT"
    }
],
"browserslist": [
    "last 2 versions",
    "android 4",
    "opera 12"
],
"scripts": {
    "build": "webpack --progress --config resources/assets/build/webpack.config.js",
    "build:production": "webpack --env.production --progress --config resources/assets/build/webpack.config.js",
    "build:profile": "webpack --progress --profile --json --config resources/assets/build/webpack.config.js",
    "start": "webpack --hide-modules --watch --config resources/assets/build/webpack.config.js",
    "rmdist": "rimraf dist",
    "lint": "npm run -s lint:scripts && npm run -s lint:styles",
    "lint:scripts": "eslint resources/assets/scripts resources/assets/build",
    "lint:styles": "stylelint \"resources/assets/styles/**/*.{css,sass,scss,sss,less}\"",
    "test": "npm run -s lint"
},
"engines": {
    "node": ">= 8.0.0"
},
"devDependencies": {
    "autoprefixer": "~8.2.0",
    "browser-sync": "~2.24.7",
    "browsersync-webpack-plugin": "^0.6.0",
    "bs-html-injector": "~3.0",
    "buble-loader": "^0.4.1",
    "cache-loader": "~1.2.5",
    "clean-webpack-plugin": "^0.1.18",
    "copy-globs-webpack-plugin": "^0.2.0",
    "css-loader": "^0.28.9",
    "cssnano": "~4.0.5",
    "eslint": "~4.19.1",
    "eslint-loader": "~1.9",
    "eslint-plugin-import": "~2.14.0",
    "extract-text-webpack-plugin": "~3.0.2",
    "file-loader": "^1.1.6",
    "friendly-errors-webpack-plugin": "^1.6.1",
    "imagemin-mozjpeg": "~7.0.0",
    "imagemin-webpack-plugin": "~2.2.0",
    "import-glob": "~1.5",
    "node-sass": "~4.9.4",
    "postcss-loader": "~2.1.0",
    "postcss-safe-parser": "~3.0",
    "resolve-url-loader": "~2.3.1",
    "rimraf": "~2.6",
    "sass-loader": "~6.0",
    "style-loader": "^0.22.1",
    "stylelint": "^8.4.0",
    "stylelint-config-standard": "~18.2.0",
    "stylelint-webpack-plugin": "^0.10.5",
    "uglifyjs-webpack-plugin": "^1.3.0",
    "url-loader": "^0.6.2",
    "webpack": "~3.10.0",
    "webpack-assets-manifest": "^1.0.0",
    "webpack-cli": "^3.3.2",
    "webpack-dev-middleware": "~2.0.4",
    "webpack-hot-middleware": "~2.22.3",
    "webpack-merge": "~4.1.4",
    "yargs": "~11.0.0"
},
"dependencies": {
    "bootstrap": "v4.3.1",
    "jquery": "^3.3.1",
    "popper.js": "^1.14.7"
}
}

Ok I got it working now, I was on the right track with your suggestion but when I uninstalled node-sass it removed sass-loader. So I put that back but the newest version was kinda weird so I went down to 7.0.2 and that seemed to do the trick. Thanks again!

This topic was automatically closed after 42 days. New replies are no longer allowed.