Some node issues
Create Date: March 11, 2020 at 02:11 PM         | Tag: NODE.JS         | Author Name: Sun, Charles |
Update node and angular/cli to latest version. The issue is gone.
npm Use 2 Versions of Python
Whenever I install certain node
packages, there are errors involving the Python
version. This is because I have both Python 2.7
and Python 3.3
(those were the latest versions last time I updated, but now there is 3.4
), but obviously I can only source one version in my PATH
(any later folders are overridden). I have Python 3.3
in my PATH
because it's newer, but there are still so many programs, including npm
modules, which use Python 2
, over 5 years later.
Is there any way to include a "fallback" Python
version, for modules which can not use version 3 yet? A general solution would be amazing, but I would at least like a solution for when installing npm
modules. Keep in mind that some modules may be perfectly fine with Python 3
, though I'm not sure if there are any which can not use Python 2
. With that said, a solution which allows both, using the newest version when compatible and some older version when not, would be best.
For reference, my Python 2.7
is installed in the C:\Python27\python
folder and Python 3.3
is in the C:\Python33\python
folder. The npm
error I am getting is:
contextify@0.1.8 install c:\repos\konneka\node_modules\buster\node_modules\bus ter-syntax\node_modules\jsdom\node_modules\contextify node-gyp rebuild
|
c:\repos\konneka\node_modules\buster\node_modules\buster-syntax\node_modules\jsd
om\node_modules\contextify>node "c:\Program Files\nodejs\node_modules\npm\bin\no
de-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
when@1.3.0 node_modules\buster\node_modules\buster-server-cli\node_modules\buste
r-cli\node_modules\buster-configuration\node_modules\when
lodash@0.5.2 node_modules\buster\node_modules\buster-test-cli\node_modules\ramp\
node_modules\ramp-resources\node_modules\lodash
gyp ERR! configure error
gyp ERR! stack Error: Python executable "python" is v3.3.2, which is not support
ed by gyp.
gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & <
3.0.0.
gyp ERR! stack at failPythonVersion (c:\Program Files\nodejs\node_modules\np
m\node_modules\node-gyp\lib\configure.js:108:14)
gyp ERR! stack at c:\Program Files\nodejs\node_modules\npm\node_modules\node
-gyp\lib\configure.js:97:9
gyp ERR! stack at ChildProcess.exithandler (child_process.js:645:7)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at maybeClose (child_process.js:755:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:822:
5)
ERR! System Windows_NT 6.2.9200
command "node" "c:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\nod
e-gyp\\bin\\node-gyp.js" "rebuild"
esprima-fb@3001.1.0-dev-harmony-fb node_modules\browserify\node_modules\syntax-e
rror\node_modules\esprima-fb
http-proxy@0.10.4 node_modules\karma\node_modules\http-proxy
├── pkginfo@0.3.0
└── utile@0.2.1 (deep-equal@0.2.1, async@0.2.10, ncp@0.4.2, i@0.3.2, mkdirp@0.5.
0)
cwd c:\repos\konneka\node_modules\buster\node_modules\buster-syntax\node_module
s\jsdom\node_modules\contextify
gyp ERR! node -v v0.10.29
gyp ERR! node-gyp -v v0.13.1
gyp ERR! not ok
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
I also had this problem, And finally I didn't realize what was going on.
but
my problem was solved that way
I uninstall node 12.14.1 and install 10.18.1 It's working now.
How can I update npm on Windows?
This is the new best way to upgrade npm on Windows.
Run PowerShell as Administrator
Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
npm install -g npm-windows-upgrade
npm-windows-upgrade
Note: Do not run npm i -g npm
. Instead use npm-windows-upgrade
to update npm going forward. Also if you run the NodeJS installer, it will replace the node version.
- Upgrades npm in-place, where node installed it.
- Easy updating, update to the latest by running
npm-windows-upgrade -p -v latest
. - Does not modify the default path.
- Does not change the default global package location.
- Allows easy upgrades and downgrades.
- Officially recommended by the NPM team.
- A list of versions matched between NPM and NODE (https://nodejs.org/en/download/releases/) - but you will need to download NODE INSTALLER and run that to update node (https://nodejs.org/en/)
How do I update each dependency in package.json to the latest version?
Create Date: February 25, 2020 at 04:59 AM         | Tag: ANGULAR         | Author Name: Sun, Charles |
How do I update each dependency in package.json to the latest version?
Looks like npm-check-updates is the only way to make this happen now.
npm i -g npm-check-updates
ncu -u
npm install
On npm <3.11:
Simply change every dependency's version to *
, then run npm update --save
. (Note: broken in recent (3.11) versions of npm).
Before:
"dependencies": {
"express": "*",
"mongodb": "*",
"underscore": "*",
"rjs": "*",
"jade": "*",
"async": "*"
}
After:
"dependencies": {
"express": "~3.2.0",
"mongodb": "~1.2.14",
"underscore": "~1.4.4",
"rjs": "~2.10.0",
"jade": "~0.29.0",
"async": "~0.2.7"
}
Of course, this is the blunt hammer of updating dependencies. It's fine if—as you said—the project is empty and nothing can break.
On the other hand, if you're working in a more mature project, you probably want to verify that there are no breaking changes in your dependencies before upgrading.
To see which modules are outdated, just run npm outdated
. It will list any installed dependencies that have newer versions available.
Your cache folder contains root-owned files, due to a bug in previous versions of npm which has since been addressed.
To permanently fix this problem, please run:
sudo chown -R 1000:1000 "/home/charles/.npm"
New Comment
ERROR in Cannot find module 'node-sass'
Create Date: December 20, 2019 at 12:36 PM         | Tag: ANGULAR         | Author Name: Sun, Charles |
ERROR in Cannot find module 'node-sass'
Here's the solution:
sudo npm install --save-dev --unsafe-perm node-sass
Enjoy!
If thist doesn't work try to install from a mirror
npm install -g mirror-config-china --registry=http://registry.npm.taobao.org
npm install node-sass
Errors: Data path “.builders['app-shell']” should have required property 'class'
Following worked for me
npm uninstall @angular-devkit/build-angular
npm install @angular-devkit/build-angular@0.13.0
New Comment