installing parcel failed in windows10 - npm-install

while trying to install parcel through npm in VScode, getting the below error.
npm ERR! code 1
npm ERR! path C:\Users\user-id\ws-js-001\node_modules\#parcel\watcher
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-gyp-build
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp#7.1.2
npm ERR! gyp info using node#16.2.0 | win32 | x64
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! find Python checking Python explicitly set from command line or npm configuration
npm ERR! gyp ERR! find Python - "--python=" or "npm config get python" is "python3.10"
npm ERR! gyp ERR! find Python - "python3.10" is not in PATH or produced an error
npm ERR! gyp ERR! find Python checking Python explicitly set from environment variable PYTHON
npm ERR! gyp ERR! find Python - process.env.PYTHON is "C:\Users\user-id\AppData\Local\Programs\Python\Python310\python.exe"
npm ERR! gyp ERR! find Python - "C:\Users\user-id\AppData\Local\Programs\Python\Python310\python.exe" is not in PATH
or produced an error
The config value in config file is
C:\Users\user-id\ws-js-001> npm config get python
python3.10
Also the environment variable python is set to
C:\Windows\system32>set PYTHON
PYTHON=C:\Users\user-id\AppData\Local\Programs\Python\Python310\python.exe
Could you please help me with the changes that are required to fix this issue.

#parcel/watcher is a native C++ package that parcel uses to monitor your project for changes and re-build when it sees them. To create the bindings between native C++ and node under the hood, it uses node-gyp-build. According to node-gyp documentation:
node-gyp requires that you have installed a compatible version of Python, one of: v3.6, v3.7, v3.8, or v3.9.
So I'd recommend upgrading your version of python to one of the supported versions.
(Side note - it looks like #parcel/watcher includes a pre-built binaries for a number of platforms, including windows-x64, so that you don't need to build anything with node-gyp if you are consuming the package on those systems. My guess is that you're using 32-bit windows, because that doesn't seem to be included - is that right?)

Related

Not able to install Saltcorn in Windows 10

I tried to install saltcorn using this wiki page. https://wiki.saltcorn.com/view/ShowPage/install-on-windows-10
It is failing due to vips error
npm 8.1.0
node 16.13.0
C:\Users\varsha\AppData\Roaming\npm\node_modules\#saltcorn\cli\node_modules\sharp
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
npm ERR! nothing.c
npm ERR! win_delay_load_hook.cc
npm ERR! nothing.vcxproj -> C:\Users\varsha\AppData\Roaming\npm\node_modules\#saltcorn\cli\node_modules\sharp\build\Release\\nothing.lib
npm ERR! VError.cpp
npm ERR! C:\Users\varsha\AppData\Roaming\npm\node_modules\#saltcorn\cli\node_modules\sharp\src\libvips\cplusplus\VError.cpp(33,10): fatal error C1083: Cannot open include file: 'vips/intl.h': No such file or directory [C:\Users\varsha\AppData\Roaming\npm\node_modules\#saltcorn\cli\node_modules\sharp\build\libvips-cpp.vcxproj]
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp#8.2.0
npm ERR! gyp info using node#16.13.0 | win32 | x64
npm ERR! gyp info find Python using Python version 3.10.0 found at "C:\Python310\python.exe"
npm ERR! gyp info find VS using VS2019 (16.11.32002.261) found at:
npm ERR! gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
npm ERR! gyp info find VS run with --verbose for detailed information
Your node is too recent, try downgrading to node 15. See:
https://sharp.pixelplumbing.com/install
Background: sharp ships binaries for most platforms, but not yet node16 (as of the time of writing). If it does not have precompiled binaries available, sharp will try to build them for you on your machine using node-gyp. Sadly, especially on windows, this is extremely fragile and can break in 1000s of bizarre ways.
You can spend many hours trying to fix it, or (much more sensibly) you can switch to a supported version of node.

How do you install Firebase tools in a Gitlab CI Runner?

I'm having some trouble configuring Gitlab CI to run firebase emulators. In particular, it's failing to install firebase-tools. This is the relevant part of my config
unit-test-job: # This job runs in the test stage.
image: node:14.14.0
artifacts:
paths:
- "test-results.xml"
reports:
junit: "test-results.xml"
stage: test
script:
- apt-get update && apt-get install -y openjdk-8-jdk
- npm i
- npm i -g firebase-tools
- firebase use $MY_PROJECT
- echo "Running unit tests..."
- npm run test:ci
When trying to install firebase-tools I get this error from the CI
$ npm i -g firebase-tools
npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated uuid#3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated har-validator#5.1.5: this library is no longer supported
/usr/local/bin/firebase -> /usr/local/lib/node_modules/firebase-tools/lib/bin/firebase.js
> re2#1.16.0 install /usr/local/lib/node_modules/firebase-tools/node_modules/re2
> install-from-cache --artifact build/Release/re2.node --host-var RE2_DOWNLOAD_MIRROR || npm run rebuild
Trying https://github.com/uhop/node-re2/releases/download/1.16.0/linux-x64-83.br ...
Writing to build/Release/re2.node ...
Trying https://github.com/uhop/node-re2/releases/download/1.16.0/linux-x64-83.gz ...
Writing to build/Release/re2.node ...
Building locally ...
npm ERR! code EACCES
npm ERR! syscall scandir
npm ERR! path /root/.npm/_logs
npm ERR! errno -13
npm ERR!
npm ERR! Your cache folder contains root-owned files, due to a bug in
npm ERR! previous versions of npm which has since been addressed.
npm ERR!
npm ERR! To permanently fix this problem, please run:
npm ERR! sudo chown -R 65534:0 "/root/.npm"
glob error [Error: EACCES: permission denied, scandir '/root/.npm/_logs'] {
errno: -13,
code: 'EACCES',
syscall: 'scandir',
path: '/root/.npm/_logs'
}
> re2#1.16.0 rebuild /usr/local/lib/node_modules/firebase-tools/node_modules/re2
> node-gyp rebuild
gyp WARN EACCES current user ("nobody") does not have permission to access the dev dir "/root/.cache/node-gyp/14.14.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/firebase-tools/node_modules/re2/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/firebase-tools/node_modules/re2/.node-gyp'
gyp ERR! System Linux 5.4.109+
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/firebase-tools/node_modules/re2
gyp ERR! node -v v14.14.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! re2#1.16.0 rebuild: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the re2#1.16.0 rebuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Any suggestions on how to fix this?
You're actually encountering an issue that isn't necessarily related to gitlab-ci, but it actually related to node 14. Essentially that /root/.npm folder has bad permissions in node 14. You have three ways you can fix this:
Update to Node 15 (just change your image to node:15) which fixes the permission issue
Allow node permissions to scan the folder. This is insinuated by the error message you have in the above error where it tells you the directory can't be scanned. The easiest way to resolve this issue is to remove the -g off the second node install, which will make it deploy to the user folder instead of global. Since you're rebuilding the container every time and using the same user each time, the -g to install globally is redundant in this case.
Install Firebase using the standalone method to get the CLI instead of using NPM to install it. You can do this in a docker container using curl -sL firebase.tools | sed 's/sudo //g' | bash
Hopefully this helps!

Hello, how to fix an error of creating Vue 3 project + Jest?

how to fix an error of creating Vue 3 project + Jest?
I used npm i -g #vue/cli
and
vue create .
Logs:
/*
Microsoft Windows [Version 10.0.17763.1217]
(c) 2018 Microsoft Corporation. All rights reserved.
D:\Projects\FrontEnd\fcrp>vue create .
Vue CLI v4.5.13
? Generate project in current directory? Yes
Vue CLI v4.5.13
? Please pick a preset: Manually select features
? Check the features needed for your project: Choose Vue version, Babel, Router, Vuex, CSS Pre-processors, Linter, Unit, E2E
? Choose a version of Vue.js that you want to start the project with 3.x
? Use history mode for router? (Requires proper server setup for index fallback in production) No
? Pick a CSS pre-processor (PostCSS, Autoprefixer and CSS Modules are supported by default): Sass/SCSS (with dart-sass)
? Pick a linter / formatter config: Prettier
? Pick additional lint features: Lint on save
? Pick a unit testing solution: Jest
? Pick an E2E testing solution: WebdriverIO
? Pick browsers to run end-to-end test on Chrome, Firefox
? Where do you prefer placing config for Babel, ESLint, etc.? In dedicated config files
? Save this as a preset for future projects? No
Vue CLI v4.5.13
✨ Creating project in D:\Projects\FrontEnd\fcrp.
⚙️ Installing CLI plugins. This might take a while...
npm ERR! code 1
npm ERR! path D:\Projects\FrontEnd\fcrp\node_modules\fibers
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
npm ERR! fibers.cc
npm ERR! C:\Users\Vector\AppData\Local\node-gyp\Cache\16.2.0\include\node\node.h(63,10): fatal error C1083: Cannot open include file: 'v8.h': No such file or directory [D:\Projects\FrontEnd\fcrp\node_modules\fibers\build\fibers.vcxproj]
npm ERR! (node:1448) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:365:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Windows_NT 10.0.17763
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd D:\Projects\FrontEnd\fcrp\node_modules\fibers
npm ERR! gyp ERR! node -v v16.2.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Vector\AppData\Local\npm-cache\_logs\2021-06-01T00_11_29_219Z-debug.log
ERROR command failed: npm install --loglevel error --legacy-peer-deps
D:\Projects\FrontEnd\fcrp>
*/
Node is installed and additional files are installed, but the problem is not solved, What is going wrong
npm install --global --production windows-build-tools
npm install --global node-gyp
Didn't help to solve the problem
Mocha + Chai works fine without an errors but Jest get errors
WebdriverIO (WebDriver/DevTools based) also raises an error but Cypress (Chrome only) works fine

npm ERR!: code 127. gyp ERR! stack Error: Command failed

I'm getting the following error while doing npm install:
$ npm install
npm ERR! code 127
npm ERR! path /home/jesusjimenez/projects/project/node_modules/fibers
npm ERR! command failed
npm ERR! command sh -c node build.js || nodejs build.js
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#15.12.0 | linux | x64
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Command failed: /usr/bin/python3 -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:369:20)
npm ERR! gyp ERR! stack at maybeClose (node:internal/child_process:1067:16)
npm ERR! gyp ERR! stack at Socket.<anonymous> (node:internal/child_process:453:11)
npm ERR! gyp ERR! stack at Socket.emit (node:events:369:20)
npm ERR! gyp ERR! stack at Pipe.<anonymous> (node:net:665:12)
npm ERR! gyp ERR! System Linux 5.8.0-48-generic
npm ERR! gyp ERR! command "/usr/bin/node" "/home/jesusjimenez/projects/project/node_modules/.bin/node-gyp" "rebuild" "--release"
npm ERR! gyp ERR! cwd /home/jesusjimenez/projects/project/node_modules/fibers
npm ERR! gyp ERR! node -v v15.12.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! node-gyp exited with code: 1
npm ERR! Please make sure you are using a supported platform and node version. If you
npm ERR! would like to compile fibers on this machine please make sure you have setup your
npm ERR! build environment--
npm ERR! Windows + OS X instructions here: https://github.com/nodejs/node-gyp
npm ERR! Ubuntu users please run: `sudo apt-get install g++ build-essential`
npm ERR! RHEL users please run: `yum install gcc-c++` and `yum groupinstall 'Development Tools'`
npm ERR! Alpine users please run: `sudo apk add python make g++`
npm ERR! sh: 1: nodejs: not found
npm ERR! A complete log of this run can be found in:
npm ERR! /home/jesusjimenez/.npm/_logs/2021-03-30T21_32_02_097Z-debug.log
I'm not completely sure what is breaking the install, if fibers or somehow that python SyntaxError: invalid syntax
However, trying to install fibers individually throws same error. npm i -g fibers doesn't fix, neither changing npm configure set python /path/to/python. Deleting fibers momentarily keeps throwing same Python SyntaxError: invalid syntax error, this time with another node_module.
This is the solution to this issue.
Explanation:
Notice this part of your NPM error log:
npm ERR! gyp ERR! node-gyp -v v3.8.0
This means your code is trying to install node-gyp of the version 3.8.0
What is probably happening (this was in my case) you have a wrong NodeJS version, for node-gyp.
I searched for the right version of NodeJS for node-gyp 3.8.0, and the answer is below.
Solution:
Uninstall current NodeJS version
Install NodeJS Version 6.17.1 (if you need multiple NodeJS versions use NVM tool (Instructions For Windows/Linux/MacOS) https://www.nubo.eu/Install-Multiple-Node-Versions-On-Windows/
Run npm install in your project again
I got this error when I set a PATH variable incorrectly which meant npm and node couldn't be found correctly.
To diagnose this, I ran
npm --version
node --version
It said command not found, so I checked env | grep PATH which showed me that the location of npm and node weren't on PATH as they needed to be. Once I fixed that, everything worked as expected.
I got the same/similar issue without making any changes to version of node. I hate to be that guy, but after a day of struggling with it I decided to restart my machine. That fixed it...
The issue is that node-gyp tries to build with Python 2 syntax: print "%s.%s.%s" % sys.version_info[:3]; which throws an error probably because you have Python 3 on your computer.
This usually occurs when installing an outdated npm module which is not compatible with the current Node version on your system. Try installing Python 2 and set it to the path, or locate the offending module in package.json and then upgrade the version number to the one that is compatible with your current Node version.

Problems deploying to IBM Cloud

I created a web app in NodeJS which uses Tensorflow to get a prediction from a model trained in Python. What I'm trying to do is deploy that through IBM Cloud's Cloud Foundry SDK for NodeJS. The problem I'm running into is when I'm trying to push my project to IBM Cloud. From looking at the logs in the console it seems that TensorflowJS Node when it's installing and runs
node-gyp rebuild
it causes some issues. For some reason it runs into an error when that's running which is
/temp/app/node_modules/#tensorflow/tfjs-node/deps/tensorflow/lib/libtensorflow.so: file not recognized: File format not recognized
and from there it causes a long chain of errors. Anyone know how I can fix this?
Here is are the command line logs.
Downloaded build artifacts cache (484.1K)
Staging...
-----> IBM SDK for Node.js Buildpack v3.21-20180628-1258
Based on Cloud Foundry Node.js Buildpack v1.5.24
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NPM_CONFIG_PRODUCTION=true
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): unspecified
engines.npm (package.json): unspecified (use default)
Resolving node version (latest stable) via 'node-version-resolver'
Installing IBM SDK for Node.js (6.14.3) from cache
Using default npm version: 3.10.10
-----> Restoring cache
Loading 2 from cacheDirectories (default):
- node_modules (exists - skipping)
- bower_components (not cached - skipping)
-----> Checking and configuring service extensions before installing
dependencies
-----> Building dependencies
Prebuild detected (node_modules already exists)
Rebuilding any native modules
> protobufjs#6.8.8 postinstall /tmp/app/node_modules/protobufjs
> node scripts/postinstall
> #tensorflow/tfjs-node#0.1.9 install
/tmp/app/node_modules/#tensorflow/tfjs-node
> node-gyp rebuild
make: Entering directory `/tmp/app/node_modules/#tensorflow/tfjs-
node/build'
ACTION binding_gyp_tfjs_binding_target_download_libtensorflow
Release/libtensorflow.so
CXX(target) Release/obj.target/tfjs_binding/binding/tfe_utils.o
CXX(target) Release/obj.target/tfjs_binding/binding/tfjs_backend.o
CXX(target) Release/obj.target/tfjs_binding/binding/tfjs_binding.o
SOLINK_MODULE(target) Release/obj.target/tfjs_binding.node
/tmp/app/node_modules/#tensorflow/tfjs-
node/deps/tensorflow/lib/libtensorflow.so: file not recognized: File
format
not recognized
collect2: error: ld returned 1 exit status
make: *** [Release/obj.target/tfjs_binding.node] Error 1
make: Leaving directory `/tmp/app/node_modules/#tensorflow/tfjs-
node/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit
(/tmp/app/vendor/node/lib/node_modules/npm/node_modules/node-
gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit
(internal/child_process.js:219:12)
gyp ERR! System Linux 4.4.0-109-generic
gyp ERR! command "/tmp/app/vendor/node/bin/node"
"/tmp/app/vendor/node/lib/node_modules/npm/node_modules/node-
gyp/bin/node- gyp.js" "rebuild"
gyp ERR! cwd /tmp/app/node_modules/#tensorflow/tfjs-node
gyp ERR! node -v v6.14.3
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Failed at the #tensorflow/tfjs-node#0.1.9 install script
'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm
installed.
npm ERR! node-gyp rebuild
npm ERR! Linux 4.4.0-109-generic
npm ERR! argv "/tmp/app/vendor/node/bin/node"
"/tmp/app/vendor/node/bin/npm" "rebuild" "--
nodedir=/tmp/app/vendor/node"
npm ERR! node v6.14.3
npm ERR! npm v3.10.10
npm ERR! #tensorflow/tfjs-node#0.1.9 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! If you do, this is most likely a problem with the
#tensorflow/tfjs-node package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! You can get information on how to open an issue for this
project with:
npm ERR! npm bugs #tensorflow/tfjs-node
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls #tensorflow/tfjs-node
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support
request:
npm ERR! /tmp/app/npm-debug.log
-----> Build failed
Some possible problems:
- node_modules checked into source control
http://docs.cloudfoundry.org/buildpacks/node/node-tips.html
- Node version not specified in package.json
http://docs.cloudfoundry.org/buildpacks/node/node-tips.html
Failed to compile droplet: Failed to compile droplet: exit status 1
Exit status 223
Staging failed: STG: Exited with status 223
Stopping instance 4e1dd2ee-71b4-4f84-95e8-c5f6c7bd24e0
Destroying container
Error staging application: App staging failed in the buildpack compile
phase
FAILED
It is a problem related to the version of NodeJs installed on your cloud environment. The errors shows that the version of NodeJs being used is Node.js (6.14.3) whereas tensorflowJs requires Node V8+
For some reason if I remove the node_modules folder from the working directory and then try to push to IBM Cloud it works. My guess is probably because when Tensorflow installs it installs certain files depending on your operating system and in my case
libtensorflow.so
was one of those files.