So, I make a Meteor project that uses my MongoDB and other environment variables. Therefore, I create .sh file and write these down.
MONGO_URL="mongodb:<MY DATABASE>" meteor --settings settings.json
However, Meteor cannot realize the current OS is Windows, so it keeps trying to look for meteor modules using Linux's path. Here is the error log.
Runing Meteor with configured db instance in Windows
/mnt/c/Users/mq003/AppData/Local/.meteor/packages/meteor-tool/2.2.0/mt-os.windows.x86_64/meteor: line 137: /mnt/c/Users/mq003/AppData/Local/.meteor/packages/meteor-tool/2.2.0/mt-os.windows.x86_64/dev_bundle/bin/node: No such file or directory
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file C:\Windows\system32\cmd.exe
npm ERR! errno ENOENT
npm ERR! simple-todos-react# w-start: `cd build\bin && bash w-run.sh`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the simple-todos-react# w-start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\mq003\AppData\Roaming\npm-cache\_logs\2022-12-06T17_29_40_599Z-debug.log
Does anybody know how to do this in Windows? Thank you in advance.
An easy way to address this is to use crossenv https://www.npmjs.com/package/cross-env
cross-env makes it so you can have a single command without worrying about setting or using the environment variable properly for the platform. Just set it like you would if it's running on a POSIX system, and cross-env will take care of setting it properly.
That way if you have team members using Macs and Windows, it's the same commands, and if you get an upgrade to a Mac yourself, it's seamless.
From what I see you have is likely with your PATH variable.
The error explicitly states it can find the Node.js in you executable directory.
Check to see if any of these identifies the problem. Or I could try to further debug .
Related
The problem I am currently having is that we have a script in our package.json set to run single test files using the following syntax:
"singleTest": "mocha tests/$MATCH"
However, when I attempt to run this in Windows 10 with Powershell I use the following command and get the error shown:
$env:MATCH="01HOME-01FC-T01.js" && npm run singleTest
Error: No test files found: "tests/$MATCH"
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! selenium-js-example#2.0.0 singleTest: `mocha tests/$MATCH`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the selenium-js-example#2.0.0 singleTest script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
It seems as if it is not setting the file name to the variable MATCH at all. I would really appreciate if someone can shed some light on what am I doing wrong or what would be the proper way to run this using Powershell 7.1.
You can chain commands in Powershell by using semicolon. You cannot use && like in bash.
$env:MATCH="01HOME-01FC-T01.js"; npm run singleTest
os: window 10
when I create meteor project, it shows following error. So I can not learn Meteor.
C:\test>meteor create asd
C:\Users\msm08\AppData\Local\.meteor\packages\meteor-tool\1.6.1\mt-os.windows.x86_64\dev_bundle\lib\node_modules\meteor-promise\promise_server.js:218
throw error;
^
Error: Error: Could not install npm dependencies for test-packages: Command failed: C:\WINDOWS\system32\cmd.exe /c C:\Users\msm08\AppData\Local\.meteor\packages\meteor-tool\1.6.1\mt-os.windows.x86_64\dev_bundle\bin\npm.cmd install --production=false
npm ERR! code ENOGIT
npm ERR! No git binary found in $PATH
npm ERR!
npm ERR! Failed using git.
npm ERR! Please check if you have git installed and in your PATH.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\msm08\AppData\Roaming\npm-cache\_logs\2018-04-01T17_24_26_459Z-debug.log
npm ERR! code ENOGIT
npm ERR! No git binary found in $PATH
npm ERR!
npm ERR! Failed using git.
npm ERR! Please check if you have git installed and in your PATH.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\msm08\AppData\Roaming\npm-cache\_logs\2018-04-01T17_24_26_459Z-debug.log
at Object.error (C:\tools\utils\buildmessage.js:430:11)
at C:\tools\cli\default-npm-deps.js:36:20
at C:\tools\utils\buildmessage.js:334:18
at exports.EnvironmentVariable.withValue (C:\tools\utils\fiber-helpers.js:89:14)
at C:\tools\utils\buildmessage.js:333:36
at exports.EnvironmentVariable.withValue (C:\tools\utils\fiber-helpers.js:89:14)
at Object.enterJob (C:\tools\utils\buildmessage.js:324:26)
at Object.install (C:\tools\cli\default-npm-deps.js:27:27)
at Command.func (C:\tools\cli\commands.js:801:36)
at C:\tools\cli\main.js:1523:15
Check the $path if it contains a Git:
go to this pc -> advanced System Setting -> Environmental Variables
check the Path if it contains GIT.
you can also check it via command prompt and type "Path"
You simply have to install the GIT for windows version from this LINK
It will automatically set the environment variable for GIT on your windows 10 machine. You do not have to do anything else.
I am developing a piece of software and realised that a part of it should be a separate package. Before splitting the code, I decided to try the npm link command. I followed the npm documentation to create a dummy package (exactly what the documentation describes - exports.printMsg = function(){} ...) to link to and followed the documentation about npm link. The first part (symlink to /lib/node_modules) worked perfectly. The second part failed with following error message :
npm WARN deprecated node-uuid#1.4.1: Use uuid module instead
npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t http://stash.grupa.onet/scm/oacc/node04-iconv.git
npm ERR!
npm ERR! fatal: unable to access 'http://stash.grupa.onet/scm/oacc/node04-iconv.git/': Could not resolve host: stash.grupa.onet
npm ERR!
npm ERR! exited with error code: 128
npm ERR! A complete log of this run can be found in:
npm ERR! /home/lisa/.npm/_logs/2017-08-02T16_29_12_731Z-debug.log
Could you help me out, please? All I found about similar errors suggest to reboot my PC (what I did) or to upgrade npm (I am running 5.3.0).
What I don't understand is why a command that should symlink a package is trying to resolve something...
I had ionic installed and running properly.
Accidentally I installed beta version
npm install ionic#beta
I did that without having CMD run with administrator, after that ionic command wasn't being recognized anymore, so I tried installing ionic again, but no luck, I tried uninstalling it and then installing it again but also no luck, the error I get when I install it:
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Users\\{user}\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "ionic"
npm ERR! node v6.9.4
npm ERR! npm v4.1.1
npm ERR! path C:\Users\{user}\AppData\Roaming\npm\node_modules\.staging\ansi-313f575d
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\{user}\AppData\Roaming\npm\node_modules\.staging\ansi-313f575d' -> 'C:\Users\{user}\AppData\Roaming\npm\node_modules\ionic\node_modules\cordova-lib\node_modules\ansi'
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\{user}\AppData\Roaming\npm\node_modules\.staging\ansi-313f575d' -> 'C:\Users\{user}\AppData\Roaming\npm\node_modules\ionic\node_modules\cordova-lib\node_modules\ansi'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
The issue was because when installed beta version without administrator privilege it created PATH variable in user scope which points only to npm directory, and this variable overrides the system PATH variable so CMD uses the user scope one, which causes ionic installation to fail.
Deleting the user's scope PATH variable and re-installing ionic fixed the issue.
I'm trying to install packages using NPM. For example I'm trying to get install mongodb on ubuntu 14.04 by the usual
Sudo npm install mongodb
I get this error
npm ERR! tar.unpack untar error /home/cougs/.npm/mongodb/2.0.45/package.tgz
npm ERR! Linux 3.13.0-61-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "mongodb"
npm ERR! node v4.1.2
npm ERR! npm v2.14.4
npm ERR! path /mnt/nfs_data/byucougars.com/RebelFleet/app/node_modules/mongodb/package.json
npm ERR! code EINVAL
npm ERR! errno -22
npm ERR! syscall chown
npm ERR! EINVAL: invalid argument, chown '/mnt/nfs_data/byucougars.com/RebelFleet/app/node_modules/mongodb/package.json'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /mnt/nfs_data/byucougars.com/RebelFleet/app/npm-debug.log
I'm pretty sure it's a permission issue with my user. probably when I copied stuff to the server via FTP, it screwed things up stuff. I just have no idea how to fix this.
One way to fix this would be to override chown() by LD_PRELOAD to interpose a function which always returns zero ("success"). So instead of
#npm install
you would do
#echo "int chown() { return 0; }" > preload.c && gcc -shared -o preload.so preload.c
#LD_PRELOAD=$PWD/preload.so npm install
I figured out that my code was running on a MNT nfs server using version 4.0. Which changes all permissions to nobody and it was causing the issue to repeat every time I try to fix it. So I just migrated the code back to the original server and it worked fine after that.