Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm install fails every time now #115

Open
IntelligentFunction opened this issue Feb 16, 2021 · 14 comments
Open

npm install fails every time now #115

IntelligentFunction opened this issue Feb 16, 2021 · 14 comments

Comments

@IntelligentFunction
Copy link

Hi, I really don't know what's happened, but it was all running fine, I messed up the code and just recloned the repo to do a reset, and now npm fails. I'm completely lost. last time this happened, it was due to node-modules in the wrong folder, I currently have no folders marked "node_modules" anywhere on this computer now I've cleared the cache, but still I can't get any of the lessons to now work as node simply won't do it's job. here is the error message I am getting when I run npm install:
npm ERR! code 1 npm ERR! path /home/rob/Development/vue-getting-started/05-interacting-within-a-component/begin/vue-heroes/node_modules/node-sass npm ERR! command failed npm ERR! command sh -c node scripts/build.js npm ERR! Building: /usr/bin/node /home/rob/Development/vue-getting-started/05-interacting-within-a-component/begin/vue-heroes/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library= npm ERR! gyp info it worked if it ends with ok npm ERR! gyp verb cli [ npm ERR! gyp verb cli '/usr/bin/node', npm ERR! gyp verb cli '/home/rob/Development/vue-getting-started/05-interacting-within-a-component/begin/vue-heroes/node_modules/node-gyp/bin/node-gyp.js', npm ERR! gyp verb cli 'rebuild', npm ERR! gyp verb cli '--verbose', npm ERR! gyp verb cli '--libsass_ext=', npm ERR! gyp verb cli '--libsass_cflags=', npm ERR! gyp verb cli '--libsass_ldflags=', npm ERR! gyp verb cli '--libsass_library=' npm ERR! gyp verb cli ] npm ERR! gyp info using node-gyp@3.8.0 npm ERR! gyp info using node@14.15.5 | linux | x64 npm ERR! gyp verb command rebuild [] npm ERR! gyp verb command clean [] npm ERR! gyp verb clean removing "build" directory npm ERR! gyp verb command configure [] npm ERR! gyp verb check python checking for Python executable "/home/rob/anaconda3/bin/python3" in the PATH npm ERR! gyp verb which` succeeded /home/rob/anaconda3/bin/python3 /home/rob/anaconda3/bin/python3
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Command failed: /home/rob/anaconda3/bin/python3 -c import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack File "", line 1
npm ERR! gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack ^
npm ERR! gyp ERR! stack SyntaxError: invalid syntax
npm ERR! gyp ERR! stack
npm ERR! gyp ERR! stack at ChildProcess.exithandler (child_process.js:308:12)
npm ERR! gyp ERR! stack at ChildProcess.emit (events.js:315:20)
npm ERR! gyp ERR! stack at maybeClose (internal/child_process.js:1048:16)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
npm ERR! gyp ERR! System Linux 5.4.0-65-generic
npm ERR! gyp ERR! command "/usr/bin/node" "/home/rob/Development/vue-getting-started/05-interacting-within-a-component/begin/vue-heroes/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd /home/rob/Development/vue-getting-started/05-interacting-within-a-component/begin/vue-heroes/node_modules/node-sass
npm ERR! gyp ERR! node -v v14.15.5
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1

npm ERR! A complete log of this run can be found in:
npm ERR! /home/rob/.npm/_logs/2021-02-16T00_11_04_924Z-debug.log
❯ node-gyp --version
v7.1.2
❯ npm cache verify
Cache verified and compressed (/.npm/_cacache)
Content verified: 1293 (31071323 bytes)
Index entries: 1293
Finished in 3.128s
❯ npm cache clean --force
npm WARN using --force Recommended protections disabled.
❯ npm cache verify
Cache verified and compressed (
/.npm/_cacache)
Content verified: 0 (0 bytes)
Index entries: 0
Finished in 0.013s
❯ npm install
npm ERR! code 1
npm ERR! path /home/rob/Development/vue-getting-started/05-interacting-within-a-component/begin/vue-heroes/node_modules/node-sass
npm ERR! command failed
npm ERR! command sh -c node scripts/build.js
npm ERR! Building: /usr/bin/node /home/rob/Development/vue-getting-started/05-interacting-within-a-component/begin/vue-heroes/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli '/usr/bin/node',
npm ERR! gyp verb cli '/home/rob/Development/vue-getting-started/05-interacting-within-a-component/begin/vue-heroes/node_modules/node-gyp/bin/node-gyp.js',
npm ERR! gyp verb cli 'rebuild',
npm ERR! gyp verb cli '--verbose',
npm ERR! gyp verb cli '--libsass_ext=',
npm ERR! gyp verb cli '--libsass_cflags=',
npm ERR! gyp verb cli '--libsass_ldflags=',
npm ERR! gyp verb cli '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@14.15.5 | linux | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb check python checking for Python executable "/home/rob/anaconda3/bin/python3" in the PATH
npm ERR! gyp verb which succeeded /home/rob/anaconda3/bin/python3 /home/rob/anaconda3/bin/python3
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Command failed: /home/rob/anaconda3/bin/python3 -c import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack File "", line 1
npm ERR! gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack ^
npm ERR! gyp ERR! stack SyntaxError: invalid syntax
npm ERR! gyp ERR! stack
npm ERR! gyp ERR! stack at ChildProcess.exithandler (child_process.js:308:12)
npm ERR! gyp ERR! stack at ChildProcess.emit (events.js:315:20)
npm ERR! gyp ERR! stack at maybeClose (internal/child_process.js:1048:16)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
npm ERR! gyp ERR! System Linux 5.4.0-65-generic
npm ERR! gyp ERR! command "/usr/bin/node" "/home/rob/Development/vue-getting-started/05-interacting-within-a-component/begin/vue-heroes/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd /home/rob/Development/vue-getting-started/05-interacting-within-a-component/begin/vue-heroes/node_modules/node-sass
npm ERR! gyp ERR! node -v v14.15.5
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1

npm ERR! A complete log of this run can be found in:
npm ERR! /home/rob/.npm/_logs/2021-02-16T00_13_56_833Z-debug.log`

On stack exchange they said I needed to install python 2.7 and node-gyp, because they see it in the error message. I assume this is a config file that is accommodating various types of system, as I have never had either of those on this iteration of Linux Mint 20, as it does no longer ship with python 2.7 and I was able to get up to leve4 of the course without those libraries installed before. please help. I've spent 48 hours currently trying to solve this. My only other option is a full os reinstall as I don't know how node works but it likely leaves some kind of hidden .config file that will perpetuate the issue.

@IntelligentFunction
Copy link
Author

IntelligentFunction commented Feb 16, 2021

It appears that this course is very out of date now as many of the dependencies are failing especially when packages are installed by the student. On this occasion, "date-fns" is problematic and breaks the whole site. Another issue is that node-sass is using an out of date package, but it can't be upgraded to node-sass 5.0.0 due to incompatibility issues. Plurasight should be updating these courses as a paid for platform.

For anyone looking for a workaround, to get to the start of module 05, the library encouraged to install "date-fns" is no longer compatible with the sourcecode due to updates. If you did install date-fns and went through the process of fixing the errors prompted by the install process, this then breaks node-sass 4.9.0 which is 2 years out of date. Current version of node-sass is now 5.0.0, but this is not backward compatible with node-sass 4, so node-sass 4.14.1 will get the node server running. I have not yet gone through the tutorial again to see if there are further issues, but npm install was successful but with deprecation errors.

@mdanieltg
Copy link

I am on module 02, presenting the same issue when using npm install and the only thing that worked out was using Yarn instead. I am on Fedora 33 🚀.
Hope this helps.

@ColemanTO
Copy link

ColemanTO commented Jun 22, 2021

There is also an option to run NPM with legacy dependencies: npm install --legacy-peer-deps.

@riyajawa
Copy link

just install npm install node-sass

@rafaspimenta
Copy link

rafaspimenta commented Jul 5, 2021

just install npm install node-sass

Thanks! in my case this solution worked very well!

@fieldcommandergraeme
Copy link

just install npm install node-sass

Thanks! in my case this solution worked very well!

This doesn't work now, there's a version mismatch between the versions of SASS. Does anyone have an updated fix?

@Kasopej
Copy link

Kasopej commented Sep 17, 2021

just install npm install node-sass

Worked for me, though with lots of warnings. At least I can get through the course. Thanks!

@davilo61
Copy link

davilo61 commented Nov 4, 2021

@Kasopej thanks for the advice above. That worked and allowed me to complete the npm install and serve cmds. Also had a similar issue with another course and I bet that will fix it as well.

@shadyyehia
Copy link

shadyyehia commented Dec 24, 2021

These two commands will do the trick:

  • npm uninstall node-sass

  • npm i -D sass

@receptopalak
Copy link

If you run yarn install after deleting the node_modules folder, the problem will be solved.

@YehiaMahmoud
Copy link

I think this is working now:

In package.json I replaced
"node-sass": "^4.9.0",
with
"sass": "^1.32.5",

Then npm install

I found this solution in the discussion section by Jason Perry

@kafousis
Copy link

kafousis commented Aug 4, 2022

I installed node v10.24.1 which is compatible with node-sass 4.9.0 to fix this.
For anyone interested, I use Node Version Manager (nvm) to install and use different versions of node from the terminal which makes it very easy.

xx-final/vue-heroes is running now without problems.

@noman0511
Copy link

I think this is working now:

In package.json I replaced "node-sass": "^4.9.0", with "sass": "^1.32.5",

Then npm install

I found this solution in the discussion section by Jason Perry

It worked for me, I am on NodeJS V16.

@vediverg
Copy link

These two commands will do the trick:

  • npm uninstall node-sass
  • npm i -D sass

wow its amazing, how did you get it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests