Возникли после буквального «ничего» такие ошибки при вводе «npm i»
npm ERR! code 1
npm ERR! path C:UsersZakFiOneDriveDesktopvue-practice-youtube-masternode_modulesgrpc
npm ERR! command failed
npm ERR! command C:Windowssystem32cmd.exe /d /s /c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@16.3.0 | win32 | x64
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Command failed: C:Python39python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack File "<string>", 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 (node:child_process:326:12)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:394:28)
npm ERR! gyp ERR! stack at maybeClose (node:internal/child_process:1067:16)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
npm ERR! gyp ERR! System Windows_NT 10.0.19043
npm ERR! gyp ERR! command "D:\npmm\node.exe" "C:\Users\ZakFi\OneDrive\Desktop\vue-practice-youtube-master\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:UsersZakFiOneDriveDesktopvue-practice-youtube-masternode_modulesgrpc
npm ERR! gyp ERR! node -v v16.3.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! C:UsersZakFiAppDataLocalnpm-cache_logs2021-06-23T12_55_50_339Z-debug.log
PS C:UsersZakFiOneDriveDesktopvue-practice-youtube-master>
В чем проблема и как её решить?
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.
C:Windowssystem32>npm install caress-server
npm http GET https://registry.npmjs.org/caress-server
npm http 304 https://registry.npmjs.org/caress-server
npm http GET https://registry.npmjs.org/jspack/0.0.1
npm http GET https://registry.npmjs.org/buffertools
npm http 304 https://registry.npmjs.org/jspack/0.0.1
npm http 304 https://registry.npmjs.org/buffertools
> buffertools@2.0.1 install C:Windowssystem32node_modulescaress-servernode_
modulesbuffertools
> node-gyp rebuild
C:Windowssystem32node_modulescaress-servernode_modulesbuffertools>node "G:
nodejsnode_modulesnpmbinnode-gyp-bin\....node_modulesnode-gypbinnode-
gyp.js" rebuild
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYT
HON env variable.
gyp ERR! stack at failNoPython (G:nodejsnode_modulesnpmnode_modulesnode
-gyplibconfigure.js:101:14)
gyp ERR! stack at G:nodejsnode_modulesnpmnode_modulesnode-gyplibconfi
gure.js:64:11
gyp ERR! stack at Object.oncomplete (fs.js:107:15)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command "node" "G:\nodejs\node_modules\npm\node_modules\node-gyp\
bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:Windowssystem32node_modulescaress-servernode_modulesbuffert
ools
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
npm ERR! buffertools@2.0.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the buffertools@2.0.1 install script.
npm ERR! This is most likely a problem with the buffertools package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls buffertools
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "G:\nodejs\\node.exe" "G:\nodejs\node_modules\npm\bin\n
pm-cli.js" "install" "caress-server"
npm ERR! cwd C:Windowssystem32
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:Windowssystem32npm-debug.log
npm ERR! not ok code 0
C:Windowssystem32>
I am installing a certain NodeJS script — Caress. But i am not unable to. I am using Windows 8.1, can anyone tell me what is the problem i am facing, and why is this installation not working. There seems to be a problem with the buffertools dependency, thats far as i can think. Dont know how maybe fix this?
If i download the build from github and place it in node-modules, nothing seems to work. when i try to start, using npm start, or during implementation either.
G:nodejsnode_modulescaress-server>npm install
G:nodejsnode_modulescaress-server>npm start
> caress-server@0.1.1 start G:nodejsnode_modulescaress-server
> node examples/server.js
info - socket.io started
module.js:340
throw err;
^
Error: Cannot find module './build/Release/buffertools.node'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (G:nodejsnode_modulescaress-servernode_modulesbuf
fertoolsbuffertools.js:16:19)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
npm ERR! caress-server@0.1.1 start: `node examples/server.js`
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the caress-server@0.1.1 start script.
npm ERR! This is most likely a problem with the caress-server package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node examples/server.js
npm ERR! You can get their info via:
npm ERR! npm owner ls caress-server
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "G:\nodejs\\node.exe" "G:\nodejs\node_modules\npm\bin\n
pm-cli.js" "start"
npm ERR! cwd G:nodejsnode_modulescaress-server
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! G:nodejsnode_modulescaress-servernpm-debug.log
npm ERR! not ok code 0
G:nodejsnode_modulescaress-server>
asked Jan 26, 2014 at 16:00
2
NOTE: This is an old answer that applied to earlier versions of NodeJS. My sincere gratitude to these open source projects that responded to this issue and resolved this former pain.
Make sure you have all the required software to run node-gyp
:
- https://github.com/TooTallNate/node-gyp
You can configure version of Visual Studio used by node-gyp
via an environment variable so you can avoid having to set the --msvs_version=2012
property every time you do an npm install.
Examples:
- set
GYP_MSVS_VERSION=2012
for Visual Studio 2012 - set
GYP_MSVS_VERSION=2013e
(the ‘e’ stands for FREE ‘express edition’)
For the full list see
- https://github.com/joyent/node/blob/v0.10.29/tools/gyp/pylib/gyp/MSVSVersion.py#L209-294
This is still painful for Windows users of NodeJS as it assumes you have a copy of Visual Studio installed and many end users will never have this. So I’m lobbying Joyent to the encourage them to include web sockets as part of CORE node and also to possible ship a GNU gcc compiler as part of NodeJS install so we can permanently fix this problem.
Feel free to add your vote at:
- https://github.com/joyent/node/issues/8005#issuecomment-50545326
answered Aug 1, 2014 at 1:49
Tony O’HaganTony O’Hagan
21.5k3 gold badges65 silver badges77 bronze badges
1
I encountered the issue with the error:
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
Here is what I was doing and what finally worked.
Disclaimer: I am just getting my hands into Node, Angular after many years in the Java, Linux world among others…
Environment Description: Windows 8.1 64-bit; Cygwin; cygwin bash shell
Command used that led to error: npm install -g karma
Error:
gyp ERR! configure error
gyp ERR! stack Error: Can’t find Python executable «python», you can set the PYT
HON env variable.
Discovery: ‘which python’ on bash shell clearly shows ‘/usr/bin/python’. Now that is annoying!
Solution: This is only applicable to those using the environment similar to what I have, i.e. using cygwin and bash shell. Hope it helps in other environments as well but keep in mind that your kettle of tea may look a little different than mine.
- Firstly, need to set the $PYTHON shell env variable in .bashrc using the explicit windows path to the python executable and not the unix like root path (/usr/bin) used by cygwin.
- Secondly, and this one took a lot of trial/error and here’s the gotcha! Cygwin installs python under /usr/bin (which is really a mirror of /bin on windows) with the version, i.e. (in my system) /usr/bin/python2.7.exe and then adds a link /usr/bin/python —> python2.7.exe. The problem is that gyp cannot follow this link and keeps giving the annoying error that it cannot find python even though you can find it just fine from the shell command line.
- With the above background now add the following line to your .bashrc
export PYTHON=»C:/cygwin64/bin/python2.7.exe (or whatever is the version on your system)»
- Now source your .bashrc from your home directory (on cygwin)—> ‘source .bashrc’
You should be fine now and gyp will find the python executable.
I hope this helps someone stumbling on the same or similar issue.
Preview
35.2k10 gold badges91 silver badges112 bronze badges
answered Aug 4, 2015 at 22:23
AndyAndy
1191 silver badge5 bronze badges
1
should be able get all node-gyp dependencies with chocolatey for Windows
choco install python2
choco install visualstudioexpress2013windowsdesktop
answered Mar 15, 2016 at 20:54
tarikakyoltarikakyol
5137 silver badges13 bronze badges
Setup JavaScript Environment
1. Install Node.js
Download installer at NodeJs website. You can download the latest V6
2. Update Npm
Npm is installed together with Node.js. So don’t worry.
3. Install Anaconda
Anaconda is the leading open data science platform powered by Python. The open source version of Anaconda is a high performance distribution of Python. It can help you to manage your python dependency. You can use it to create different python environment in the futher if you want to touch with it.
Node-gyp only support >= Python 2.7 and < Python 3.0
So just install the 2.7 version
4. Install Node-gyp
You can install with npm
:
$ npm install -g node-gyp
You will also need to install:
-
On Windows:
-
Option 1: Install all the required tools and configurations using Microsoft’s windows-build-tools using
npm install --global --production windows-build-tools
from an elevated PowerShell or CMD.exe (run as Administrator). -
Option 2: Install tools and configuration manually:
-
Visual C++ Build Environment:
- Option 1: Install Visual C++ Build Tools using the Default Install option.
- Option 2: Install Visual Studio 2015 (or modify an existing installation) and select Common Tools for Visual C++ during setup. This also works with the free Community and Express for Desktop editions.
💡 [Windows Vista / 7 only] requires .NET Framework 4.5.1
-
Launch cmd,
npm config set msvs_version 2015
If the above steps didn’t work for you, please visit Microsoft’s Node.js Guidelines for Windows for additional tips.
-
If you have multiple Python versions installed, you can identify which Python version node-gyp
uses by setting the ‘—python’ variable:
$ node-gyp --python C:/Anaconda2/python.exe
If node-gyp
is called by way of npm
and you have multiple versions of Python installed, then you can set npm
‘s ‘python’ config key to the appropriate value:
$ npm config set python C:/Anaconda2/python.exe
Future update for Node.js and npm
Download installer from their official website and direct install it. The installer will automatic help you to remove old files.
npm update npm
Future update for Python
conda update --all
answered Sep 22, 2016 at 9:10
Fixed with downgrading Node from v12.8.1 to v11.15.0 and everything installed successfully
answered Aug 21, 2019 at 16:35
MakMak
19.8k5 gold badges25 silver badges32 bronze badges
gyp ERR! configure error gyp ERR! stack Error: Can’t find Python
executable «python», you can set the PYT HON env variable.
This means the Python env. variable should point to the executable python file, in my case:
SET PYTHON=C:work_envPython27python.exe
answered Aug 16, 2016 at 15:07
For Cygwin users:
The python issue with using npm
on an out-of-the-box Cygwin installation, is that node-gyp
is giving a misleading error due to incomplete checking in the ../npm/node_modules/node-gyp/lib/configure.js
code.
It’s due to how Cygwin treats symbolic links. It doesn’t do that properly in an out-of-the box installation. So the error messages from the above code become misleading, as it complains about the PYTHON
path and not the existence of python.exe
(or link of) file itself.
There are (at least) 2 ways to resolve this.
- Installing the Cygwin package
cygutils-extra
and usewinln
. - Use native Windows CMD in Admin mode.
For (1) you can create a proper symlink from within Cygwin shell by doing these steps:
# To make the Cygwin environment treat Windows links properly:
# Alternatively add this to your `.bashrc` for permanent use.
export CYGWIN=winsymlinks:nativestrict
# Install Cygwin package containing "winln"
apt-cyg install cygutils-extra
# Make a proper Windows sym-link:
cd /cygdrive/c/cygwin64/bin/
winln.exe -s python2.7.exe python.exe
# Add PYTHON as a native Windows system wide variable (HKLM)
setx /M PYTHON "C:cygwin64binpython"
(Also assuming you are running the Cygwin shell as Admin.)
Using apt-cyg
is recommended and can be found in various forms on github.
For (2) the resolution for out-of-the-box Cygwin users is this:
# Open a native Windows CMD in Administrator mode and:
cd C:cygwin64bin
mklink python.exe python2.7.exe
The result should look like this:
C:cygwin64bin>ls -al python*
lrwxrwxrwx 1 xxx xxx 13 Jun 2 2015 python -> python2.7.exe
lrwxrwxrwx 1 Administrators xxx 13 Aug 24 17:28 python.exe -> python2.7.exe
lrwxrwxrwx 1 xxx xxx 13 Jun 2 2015 python2 -> python2.7.exe
-rwxr-xr-x 1 xxx xxx 9235 Jun 2 2015 python2.7.exe
answered Aug 24, 2016 at 16:05
emigenixemigenix
1011 silver badge4 bronze badges
For windows
Check python path in system variable.
npm plugins need node-gyp to be installed.
open command prompt with admin rights, and run following command.
npm install —global —production windows-build-tools
npm install —global node-gyp
answered Nov 17, 2017 at 9:07
0
I was working on an old Vue 2.x project, at least 2 years old and deps were never updated. Reverting to Node v10.16.3 worked for me. Versions 14 and 12 did not work.
answered Jul 13, 2021 at 19:10
for me the solution was:
rm -rf ~/.node_gyp and
sudo npm install -g node-gyp@3.4.0
cd /usr/local/lib sudo ln -s ../../lib/libSystem.B.dylib libgcc_s.10.5.dylib
brew install gcc
npm install
answered Jan 4, 2017 at 8:02
OrrOrr
4,7003 gold badges27 silver badges31 bronze badges
The question is already answered but these were not working in my case which is alpine Linux based OS so maybe this helps someone else.
I was also getting same error
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
So fix by single line just add this if you are working in Dockerfile or install it in OS
apk add --no-cache python nodejs
in ubuntu
sudo apt-get install python3.6
Note: Node version:8
answered Jan 3, 2018 at 8:54
AdiiiAdiii
53.3k7 gold badges143 silver badges148 bronze badges
install node-gyp and c++ compiler (gcc-c++).
answered Mar 27, 2018 at 0:24
2
npm install —global —production windows-build-tools
answered Feb 25, 2021 at 19:13
I’m getting this error when I run npm i or install, I tried updating, I ran npm install node-sass, and npm update. Basically trying to get this environment running so I can do some work, lead dev isn’t in so I have no one to ask.
Randolph-Wiafes-MacBook-Pro:plbg randy$ npm i
npm WARN engine email-templates@0.1.8: wanted: {"node":"0.8.x | 0.10.x"} (current: {"node":"0.12.2","npm":"2.7.4"})
> contextify@0.1.13 install /Users/randy/Desktop/plbg/node_modules/email-templates/node_modules/juice/node_modules/jsdom/node_modules/contextify
> node-gyp rebuild
CXX(target) Release/obj.target/contextify/src/contextify.o
SOLINK_MODULE(target) Release/contextify.node
SOLINK_MODULE(target) Release/contextify.node: Finished
> node-sass@0.8.6 install /Users/randy/Desktop/plbg/node_modules/email-templates/node_modules/node-sass
> node build.js
child_process: customFds option is deprecated, use stdio instead.
CXX(target) Release/obj.target/binding/binding.o
In file included from ../binding.cpp:1:
../node_modules/nan/nan.h:339:13: error: no member named 'New' in 'v8::String'
return _NAN_ERROR(v8::Exception::Error, errmsg);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:319:50: note: expanded from macro '_NAN_ERROR'
# define _NAN_ERROR(fun, errmsg) fun(v8::String::New(errmsg))
~~~~~~~~~~~~^
../node_modules/nan/nan.h:343:5: error: no member named 'ThrowException' in
namespace 'v8'
_NAN_THROW_ERROR(v8::Exception::Error, errmsg);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:324:11: note: expanded from macro '_NAN_THROW_ERROR'
v8::ThrowException(_NAN_ERROR(fun, errmsg));
~~~~^
../node_modules/nan/nan.h:343:5: error: no member named 'New' in 'v8::String'
_NAN_THROW_ERROR(v8::Exception::Error, errmsg);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:324:26: note: expanded from macro '_NAN_THROW_ERROR'
v8::ThrowException(_NAN_ERROR(fun, errmsg));
^~~~~~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:319:50: note: expanded from macro '_NAN_ERROR'
# define _NAN_ERROR(fun, errmsg) fun(v8::String::New(errmsg))
~~~~~~~~~~~~^
../node_modules/nan/nan.h:348:9: error: no type named 'ThrowException' in
namespace 'v8'
v8::ThrowException(error);
~~~~^
../node_modules/nan/nan.h:355:65: error: no member named 'New' in 'v8::String'
v8::Local<v8::Value> err = v8::Exception::Error(v8::String::New(msg));
~~~~~~~~~~~~^
../node_modules/nan/nan.h:357:26: error: no member named 'New' in 'v8::String'
obj->Set(v8::String::New("code"), v8::Int32::New(errorNumber));
~~~~~~~~~~~~^
../node_modules/nan/nan.h:357:65: error: too few arguments to function call,
expected 2, have 1
obj->Set(v8::String::New("code"), v8::Int32::New(errorNumber));
~~~~~~~~~~~~~~ ^
/Users/randy/.node-gyp/0.12.2/deps/v8/include/v8.h:2012:3: note: 'New' declared
here
static Local<Integer> New(Isolate* isolate, int32_t value);
^
In file included from ../binding.cpp:1:
../node_modules/nan/nan.h:369:12: error: no member named 'New' in 'v8::String'
return _NAN_ERROR(v8::Exception::TypeError, errmsg);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:319:50: note: expanded from macro '_NAN_ERROR'
# define _NAN_ERROR(fun, errmsg) fun(v8::String::New(errmsg))
~~~~~~~~~~~~^
../node_modules/nan/nan.h:373:5: error: no member named 'ThrowException' in
namespace 'v8'
_NAN_THROW_ERROR(v8::Exception::TypeError, errmsg);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:324:11: note: expanded from macro '_NAN_THROW_ERROR'
v8::ThrowException(_NAN_ERROR(fun, errmsg));
~~~~^
../node_modules/nan/nan.h:373:5: error: no member named 'New' in 'v8::String'
_NAN_THROW_ERROR(v8::Exception::TypeError, errmsg);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:324:26: note: expanded from macro '_NAN_THROW_ERROR'
v8::ThrowException(_NAN_ERROR(fun, errmsg));
^~~~~~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:319:50: note: expanded from macro '_NAN_ERROR'
# define _NAN_ERROR(fun, errmsg) fun(v8::String::New(errmsg))
~~~~~~~~~~~~^
../node_modules/nan/nan.h:377:12: error: no member named 'New' in 'v8::String'
return _NAN_ERROR(v8::Exception::RangeError, errmsg);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:319:50: note: expanded from macro '_NAN_ERROR'
# define _NAN_ERROR(fun, errmsg) fun(v8::String::New(errmsg))
~~~~~~~~~~~~^
../node_modules/nan/nan.h:381:5: error: no member named 'ThrowException' in
namespace 'v8'
_NAN_THROW_ERROR(v8::Exception::RangeError, errmsg);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:324:11: note: expanded from macro '_NAN_THROW_ERROR'
v8::ThrowException(_NAN_ERROR(fun, errmsg));
~~~~^
../node_modules/nan/nan.h:381:5: error: no member named 'New' in 'v8::String'
_NAN_THROW_ERROR(v8::Exception::RangeError, errmsg);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:324:26: note: expanded from macro '_NAN_THROW_ERROR'
v8::ThrowException(_NAN_ERROR(fun, errmsg));
^~~~~~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:319:50: note: expanded from macro '_NAN_ERROR'
# define _NAN_ERROR(fun, errmsg) fun(v8::String::New(errmsg))
~~~~~~~~~~~~^
../node_modules/nan/nan.h:727:49: error: too few arguments to function call,
single argument 'isolate' was not specified
v8::Local<v8::Object> obj = v8::Object::New();
~~~~~~~~~~~~~~~ ^
/Users/randy/.node-gyp/0.12.2/deps/v8/include/v8.h:2388:3: note: 'New' declared
here
static Local<Object> New(Isolate* isolate);
^
In file included from ../binding.cpp:1:
../node_modules/nan/nan.h:733:49: error: too few arguments to function call,
single argument 'isolate' was not specified
v8::Local<v8::Object> obj = v8::Object::New();
~~~~~~~~~~~~~~~ ^
/Users/randy/.node-gyp/0.12.2/deps/v8/include/v8.h:2388:3: note: 'New' declared
here
static Local<Object> New(Isolate* isolate);
^
In file included from ../binding.cpp:1:
../node_modules/nan/nan.h:740:12: error: no member named 'Dispose' in
'v8::Persistent<v8::Object, v8::NonCopyablePersistentTraits<v8::Object> >'
handle.Dispose();
~~~~~~ ^
../node_modules/nan/nan.h:741:12: error: no member named 'Clear' in
'v8::Persistent<v8::Object, v8::NonCopyablePersistentTraits<v8::Object> >'
handle.Clear();
~~~~~~ ^
../node_modules/nan/nan.h:746:39: error: no member named 'NewSymbol' in
'v8::String'; did you mean 'IsSymbol'?
NanPersistentToLocal(handle)->Set(NanSymbol("callback"), fn);
^~~~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:181:38: note: expanded from macro 'NanSymbol'
#define NanSymbol(value) v8::String::NewSymbol(value)
~~~~~~~~~~~~^
/Users/randy/.node-gyp/0.12.2/deps/v8/include/v8.h:1379:8: note: 'IsSymbol'
declared here
bool IsSymbol() const;
^
In file included from ../binding.cpp:1:
../node_modules/nan/nan.h:746:39: error: call to non-static member function
without an object argument
NanPersistentToLocal(handle)->Set(NanSymbol("callback"), fn);
^~~~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:181:38: note: expanded from macro 'NanSymbol'
#define NanSymbol(value) v8::String::NewSymbol(value)
~~~~~~~~~~~~^~~~~~~~~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [Release/obj.target/binding/binding.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:269:23)
gyp ERR! stack at ChildProcess.emit (events.js:110:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Darwin 14.3.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/randy/Desktop/plbg/node_modules/email-templates/node_modules/node-sass
gyp ERR! node -v v0.12.2
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok
Build failed
npm ERR! Darwin 14.3.0
npm ERR! argv "node" "/usr/local/bin/npm" "i"
npm ERR! node v0.12.2
npm ERR! npm v2.7.4
npm ERR! code ELIFECYCLE
npm ERR! node-sass@0.8.6 install: `node build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@0.8.6 install script 'node build.js'.
npm ERR! This is most likely a problem with the node-sass package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node build.js
npm ERR! You can get their info via:
npm ERR! npm owner ls node-sass
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/randy/Desktop/plbg/npm-debug.log
Here is the link if you would like to visit the gist instead. Thank you guys for the help! https://gist.githubusercontent.com/wiafe/158589ec560cc051ca02/raw/45ec1ab53bf86f5b0289dc7098a7f317581d248e/gistfile1.txt
This is my node-debug.log file https://gist.github.com/wiafe/fb10d0e576e3a3e73b02
Photo from Unsplash
The npm install
command is used for installing JavaScript packages on your local computer.
When developing web projects, you may see issues that cause the npm install
command to fail.
You need to see the error message generated in the terminal for clues to resolve the error.
Some of the most common issues for npm install
not working are as follows:
- npm command not found
- No
package.json
file describing thedependencies
- Integrity check failed error
- For Windows: Python not found
Let’s see how you can resolve these errors next.
The npm command not found error
To run the npm install
command, you need to have npm installed on your computer
$ npm install
sh: command not found: npm
The error above happens when npm can’t be found under the PATH environment variable.
First, you need to make sure that npm is installed on your computer.
npm is bundled with Node.js server, which you can download from the nodejs.org website.
Once you downloaded and installed Node.js, open the terminal and run the npm -v
command.
You should see the version of npm installed on your computer as follows:
Once you see the npm version, you should be able to run the npm install
command again.
For more details, visit the fixing npm command not found error article I’ve written previously.
ENOENT: No package.json file
The npm install
command looks for a package.json
file in order to find the packages it needs to install.
You need to make sure you have a package.json
file right in the current directory where you run the command.
You can run the ls -1
command as follows:
$ ls -1
index.js
package-lock.json
package.json
Once you see there’s a package.json
file in the output as shown above, then you can run the npm install
command.
For this reason, you should always run the npm install
command from the root directory of your project.
By the way, npm install
will install packages already listed under the dependencies
object of your package.json
file.
Suppose you have a package.json
file as shown below:
{
"name": "n-app",
"version": "1.0.0",
"description": "A Node application",
"dependencies": {
"jest": "^28.1.1",
"typescript": "^4.5.5",
"webpack": "^2.7.0"
}
}
Then npm install
will install jest, typescript, and webpack to the generated node_modules/
folder.
If you need to install a new package, then you need to specify the name like these examples:
# 👇 install react package
npm install react
# 👇 install react, react-dom, and axios packages
npm install react react-dom axios
You can install one or many packages with the npm install
command.
Integrity check failed error
When you have a package-lock.json
file in your project, then npm will check the integrity of the package you downloaded with the one specified in the lock file.
When the checksum of the package is different, then npm will stop the installation and throw the integrity check failed error.
The following is an example of the error:
npm ERR! code EINTEGRITY
npm ERR! Verification failed while extracting @my-package@^1.2.0:
npm ERR! Verification failed while extracting @my-package@^1.2.0:
npm ERR! Integrity check failed:
npm ERR! Wanted: sha512-lQ...HA==
npm ERR! Found: sha512-Mj...vg==
When this happens, you can fix the issue by verifying the cache:
When the command is finished, run npm install
again.
If you still see the error, then delete your lock file and clean the npm cache.
Run the following commands from your project’s root directory:
# 👇 remove the lock file
rm package-lock.json
# 👇 remove the node_modules folder
rm -rf node_modules
# 👇 Clear the npm cache
npm cache clean --force
# 👇 run npm install again
npm install
That should fix the issue with the integrity check.
For Windows only: Python not found
When running npm install
on Windows, you may see an error that says Can’t find Python executable as shown below:
> node-gyp rebuild
/n-app>node "..node_modulesnode-gypbinnode-gyp.js" rebuild
npm http 304 https://registry.npmjs.org/bcrypt
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python",
you can set the PYTHON env variable.
The node-gyp
module is a Node.js tool for compiling native modules written in C and C++. It requires Python to run properly.
Instead of installing Python by yourself, you can install the Windows Build Tools which has Python included.
This is because Windows also requires Visual Studio build tools to make node-gyp
run successfully.
If you install only Python, then you may find that you need the build tools later.
Please note that the latest version of Node.js for Windows installer already includes the build tools by default.
But if you can’t update your Node.js version yet, then installing the build tools manually should help you fix this error.
Conclusion
The npm install
command may fail to work because of many reasons.
When the command doesn’t work, you need to check the output first and see what specific error you have.
Try a Google search to fix the issue. When you don’t see a solution, try posting a new question at Stack Overflow mentioning the things you have tried to fix the issue.
Good luck resolving the issue! 👍
-
Partition Wizard
-
Partition Manager
- 5 Ways to Fix the Npm Install Not Working Issue
5 Ways to Fix the Npm Install Not Working Issue [Partition Manager]
By Linda | Follow |
Last Updated November 10, 2022
Npm is a package manager for Node.js. You can use it to download and install third-party packages and command-line programs written by others for local use. This post from MiniTool Partition Wizard shows you how to solve the npm install not working issue.
Npm, short for Node Package Manager, is the default package manager for Node.js, which is used to build scalable network applications. With npm, you can download and install third-party packages and command-line programs written by others from the NPM server for local use.
To install a module, you just need to run the “npm install <Module Name>” command. However, you may encounter npm install errors sometimes. For example:
- Npm command not found.
- Npm err code 1.
- Can’t find Python executable «python».
- Integrity check failed.
- Couldn’t read dependencies. No such file or directory ‘c:nodexxpackage.json’.
Why is the npm install not working? Possible reasons are as follows:
- Npm is not installed.
- There is no package.json file in the directory where you trying to run npm install.
- The package name or the version is incorrect.
- You are trying to install a package which has a dependency on system libraries, which is not being satisfied.
How to Fix the Npm Install Not Working Issue
To fix the npm install not working issue, you can use the following methods. But before proceeding, you should make sure you have typed the correct package name.
Way 1. Make Sure Npm Is Installed
The main cause of the npm command not found error is that npm is not installed. You can run the command “npm -v” to check whether npm is installed. If not, I recommend you uninstall Node.js and then reinstall node.js and npm. Please refer to this post: How to Install NPM and Node.js on Windows & Mac & Ubuntu.
Way 2. Make Sure There Is a Package.json File
When installing a package, npm needs to find the package.json file first. This file will list information about this package including name, version, description, keywords, dependencies, etc. If there is no package.json file, the npm install not working issue will occur. You can run the “ls -1” command to check whether there is a package.json file.
Way 3. Delete Lock File or Cache
The main reason for the integrity check failed error is usually the package-lock.json. When your project has this file, npm will check the integrity of the package you downloaded with the one specified in the lock file.
When the checksum of the package is different, then npm will stop the installation and throw the integrity check failed error. In this case, you can run the command “npm cache verify” to solve the problem.
If this command doesn’t work, you can run the command “rm package-lock.json” to delete the lock file, or run the command “npm cache clean —force” to clean the npm cache.
Way 4. Update Dependencies
One main reason for the npm err code 1 is that a dependency in the installed module is not compatible with the current node.js version. In this case, updating dependencies is a good solution. You can do that by running the command “npm update <packagename>”.
Way 5. Install the Latest Node.js
If you install the node-gyp module, you may get the “Can’t find Python” error. The node-gyp module is a Node.js tool for compiling native modules written in C and C++. It requires Python and Visual Studio build tools to run properly.
Fortunately, the latest version of Node.js for Windows installer already includes the build tools by default. Therefore, you just need to install the latest node.js and Python.
Bottom Line
Are you interested in MiniTool Partition Wizard? This software can help you clone the system, manage disks better, and recover data. If you have this need, you can download it from the official website.
About The Author
Position: Columnist
Author Linda has been working as an editor at MiniTool for 1 year. As a fresh man in IT field, she is curious about computer knowledge and learns it crazily. Maybe due to this point, her articles are simple and easy to understand. Even people who do not understand computer can gain something.
By the way, her special focuses are data recovery, partition management, disk clone, and OS migration.