nodejs install through anaconda causing cross machine compatibility issues on linux - node.js

This problem may be hard to reproducibly describe but hopefully this works. I'm using two different machines (laptop and desktop), and following the steps below on both.
I am creating a conda environment like this:
conda create --name webdev --no-default-packages
Then I am only installing nodejs at the moment, like this:
conda install -c conda-forge nodejs
The resulting environment has only three things in it:
# Name Version Build Channel
libgcc-ng 7.2.0 hdf63c60_3 conda-forge
libstdcxx-ng 7.2.0 hdf63c60_3 conda-forge
nodejs 10.8.0 hfc679d8_1 conda-forge
Just to illustrate, I can then create a new react project like this:
create-react-app my-app
cd my-app
npm start
And the web server starts just fine and everything functions as expected. The problem I then have is that if I use my laptop to navigate into the project folder I created on my desktop and try npm start (or vice versa) I get the following error:
internal/modules/cjs/loader.js:583
throw err;
^
Error: Cannot find module '../scripts/start'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.resolve (internal/modules/cjs/helpers.js:30:19)
at Object.<anonymous> (/home/me/my-app/node_modules/.bin/react-scripts:35:25)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
at startup (internal/bootstrap/node.js:266:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-app#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-app#0.1.0 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! /home/me/.npm/_logs/2018-11-21T01_24_45_031Z-debug.log
Strangely enough I can export the conda environment I created on my desktop, use it to create a new environment on my laptop, and will still get the error when I try to run the project I created on my desktop (and vice versa).

Related

Creating a Strapi project failing with error: Cannot find module './fp/_baseConvert'

I'm creating a Strapi project using the recommended commands:
npx create-strapi-app my-project quickstart
But after the creation and installation of all the dependencies, the application fails to start up. It is throwing this error (Cannot find module './fp/_baseConvert'):
Is there any dependency missing or something wrong with my development environment?
I thought it was there was missing the lodash library... but I installed it, yet the problem still persists.
Here is the complete error message:
λ npx create-strapi-app test-again
npx: installed 103 in 70.941s
? Choose your installation type Quickstart (recommended)
Creating a quickstart project.
Creating a new Strapi application at C:\Users\user\MERNProjects\test-again.
Creating files.
Dependencies installed successfully.
Your application was created at C:\Users\user\MERNProjects\test-again.
Available commands in your project:
yarn develop
Start Strapi in watch mode. (Changes in Strapi project files will trigger a server restart)
yarn start
Start Strapi without watch mode.
yarn build
Build Strapi admin panel.
yarn strapi
Display all available commands.
You can start by doing:
cd C:\Users\user\MERNProjects\test-again
yarn develop
Running your Strapi application.
test-again#0.1.0 develop C:\Users\user\MERNProjects\test-again
strapi develop
internal/modules/cjs/loader.js:1017
throw err;
^
Error: Cannot find module './fp/_baseConvert'
Require stack:
C:\Users\user\MERNProjects\test-again\node_modules\lodash\fp.js
C:\Users\user\MERNProjects\test-again\node_modules#strapi\generate-new\lib\utils\merge-template.js
C:\Users\user\MERNProjects\test-again\node_modules#strapi\generate-new\lib\create-project.js
C:\Users\user\MERNProjects\test-again\node_modules#strapi\generate-new\lib\create-cli-db-project.js
C:\Users\user\MERNProjects\test-again\node_modules#strapi\generate-new\lib\generate-new.js
C:\Users\user\MERNProjects\test-again\node_modules#strapi\generate-new\lib\index.js
C:\Users\user\MERNProjects\test-again\node_modules#strapi\strapi\lib\commands\new.js
C:\Users\user\MERNProjects\test-again\node_modules#strapi\strapi\bin\strapi.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1014:15)
at Function.Module._load (internal/modules/cjs/loader.js:884:27)
at Module.require (internal/modules/cjs/loader.js:1074:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object. (C:\Users\user\MERNProjects\test-again\node_modules\lodash\fp.js:2:18)
at Module._compile (internal/modules/cjs/loader.js:1185:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1205:10)
at Module.load (internal/modules/cjs/loader.js:1034:32)
at Function.Module._load (internal/modules/cjs/loader.js:923:14)
at Module.require (internal/modules/cjs/loader.js:1074:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\Users\user\MERNProjects\test-again\node_modules\lodash\fp.js',
'C:\Users\user\MERNProjects\test-again\node_modules\#strapi\generate-new\lib\utils\merge-template.js',
'C:\Users\user\MERNProjects\test-again\node_modules\#strapi\generate-new\lib\create-project.js',
'C:\Users\user\MERNProjects\test-again\node_modules\#strapi\generate-new\lib\create-cli-db-project.js',
'C:\Users\user\MERNProjects\test-again\node_modules\#strapi\generate-new\lib\generate-new.js',
'C:\Users\user\MERNProjects\test-again\node_modules\#strapi\generate-new\lib\index.js',
'C:\Users\user\MERNProjects\test-again\node_modules\#strapi\strapi\lib\commands\new.js',
'C:\Users\user\MERNProjects\test-again\node_modules\#strapi\strapi\bin\strapi.js'
]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! test-again#0.1.0 develop: strapi develop
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the test-again#0.1.0 develop 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\user\AppData\Roaming\npm-cache_logs\2022-03-25T02_37_31_207Z-debug.log
C:\Users\user\MERNProjects
λ

JS-libp2p Tutorial Doc "Error: Cannot find module 'libp2p'"

I wanted to start learning to use libp2p and so started up the tutorial documentation and have hit a problem right away.
The Docs: https://docs.libp2p.io/tutorials/getting-started/javascript/
Following along I got to the "Run Libp2p" header. Running the script I get the error message Error: Cannot find module 'libp2p'
When install the module with sudo npm install libp2p there was an error reading:
ursaNative bindings compilation fail. This is not an issue. Modules that depend on it will use fallbacks.
fs.js:115
throw err;
^
Error: EACCES: permission denied, open './stdout.log'
at Object.openSync (fs.js:439:3)
at Object.writeFileSync (fs.js:1190:35)
at Object.<anonymous> (/home/foss/hello-libp2p/node_modules/ursa-optional/rebuild.js:13:10)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
at startup (internal/bootstrap/node.js:283:19)
npm WARN hello-libp2p#1.0.0 No description
npm WARN hello-libp2p#1.0.0 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ursa-optional#0.10.1 install: `node rebuild.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ursa-optional#0.10.1 install 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! /root/.npm/_logs/2020-03-29T11_05_48_715Z-debug.log
`
I'm not really sure why there's a permission denied portion of the error as this was run as sudo.The problem seems to revolve around that ursa script. Although it might be optional I'm not sure. Does anyone who has worked with libp2p seen this before?
I'm using node12.16.1 and npm6.13.4 on ubuntu 19.10
Figured it out. Needed to, instead of running sudo npm i libp2p after manually installing the binaries, I had to just skip the sudo and it all works fine. This cause a problem though because I can't install modules globally now because using sudo throws the no npm command found.... I'm not too sure how to add the npm path back into the commands for sudo, or why npm is not present in sudo but is regularly.... This is strange. Will likely be resolved with other distros that natively support node v12 instead of v10. Hopefully 20.04lts will fix this.

NPM Module triggering a "SyntaxError: Unexpected token ..."! How do I fix it?

My app was working just a short while ago until I merged the master branch. Then all of a sudden I started to get the following errors:
> #COMPANY/MY_APP#1.0.5 storybook /Users/THINKBONOBO/Workspace/MY_APP
> start-storybook -p 9001 -c .storybook
/Users/THINKBONOBO/Workspace/MY_APP/node_modules/generate-page-webpack-plugin/index.js:39
...acc,
^^^
SyntaxError: Unexpected token ...
at createScript (vm.js:74:10)
at Object.runInThisContext (vm.js:116:10)
at Module._compile (module.js:533:28)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/THINKBONOBO/Workspace/MY_APP/node_modules/#storybook/core/dist/server/config/webpack.config.prod.js:18:57)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! #COMPANY/MY_APP#1.0.5 storybook: `start-storybook -p 9999 -c .storybook`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the #COMPANY/MY_APP#1.0.5 storybook script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
The error is from some imported public package and it seems it's written in ES6 and all of a sudden my app can't read it.
I tried clearing the cache, node_modules folder, restarting my computer, cloning to a different folder... All to no avail.
What's going on?
The way I fixed this issue was that I updated my node version.
I was running 8.1.1 and updated it with brew (I originally installed node using brew)
brew update ; brew upgrade node
it upgraded to node v 10.10.0 and I was all set.
here's an article on how to update node js on a mac:
https://bytearcher.com/articles/ways-to-get-the-latest-node.js-version-on-a-mac/

Unable to install "merged-pooler" module nodeJs

So I've leased a VPS from Amazon running Ubuntu Server & I'm trying to setup a Litecoin mining pool so I can point my miners to it. (This is meant to be a private pool)
So far I've installed Litecoin packages, updated, and got Litecoind up and running, all blocks downloaded and up to date. I've installed UNOMP and setup the configuration files as directed in the guide I'm using. (Found Here: https://blockgen.net/setup-your-own-mining-pool)
I'm on the very last step which is to run the init.js file and launch the pool.
Unfortunately instead of working, it throws out the following error message. Any help with this would be greatly appreciated--I've been working at this all week long and have exhausted every possible resource on Google that I can find and nothing seems to work. I'm ripping my hair out as we speak ;)
Here is the error that is being thrown out:
ubuntu#ip-172-26-4-125:/home/nick/unomp$ sudo node init.js
module.js:328
throw err;
^
Error: Cannot find module 'merged-pooler'
at Function.Module._resolveFilename (module.js:326:15)
at Function.Module._load (module.js:277:25)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/nick/unomp/libs/poolWorker.js:1:77)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
**********UPDATE*********
Latest version of NodeJs installed
Latest version of npm install
-This has fixed the "node-gyp" error I was receiving.
The only thing left to do is get 'sudo npm install merged-pooler' to work. It is now kicking out a much smaller different error that I've tried to research but can't find anything on, posted below:
ubuntu#ip-172-26-4-125:/home/nick/unomp$ sudo npm install merged-pooler
npm ERR! code 1
npm ERR! Command failed: /usr/bin/git clone --depth=1 -q -b master
git://github.com/UNOMP/node-merged-pool.git
/home/ubuntu/.npm/_cacache/tmp/git-clone-a85b3ede
npm ERR! /home/ubuntu/.npm/_cacache/tmp/git-clone-a85b3ede/.git: Permission
denied
npm ERR!
npm ERR! A complete log of this run can be found in:
npm ERR! /home/ubuntu/.npm/_logs/2017-07-31T23_29_34_792Z-debug.log
ubuntu#ip-172-26-4-125:/home/nick/unomp$
You're missing an npm package merged-pooler, which you can install with
npm install merged-pooler
I was having the exact same problem. I managed to solve it by running the following commands. Note: Execute as root:
source ~/.profile
nvm install 0.10.25
nvm use 0.10.25
apt install redis
npm update
npm install bignum
npm install stratum-pool
npm install merged-pooler
And then, finally try running your pool node:
node init.js
Good luck!

node-sass install failing on Jenkins

I'm trying to set up Jenkins to run Gulp but it keeps failing while attempting to install node-sass (a dependency of the gulp-sass plugin).
The issue seems to be that node is not finding a script file during install. I verified that script does actually exist in the project repository. When I pull my repo locally on the server and install it, it installs without a problem. That makes me think it's a Jenkins related environment issue.
Here's the error output:
> node-sass#2.1.1 install /root/.jenkins/jobs/odyssey-frontend/workspace/node_modules/gulp-sass/node_modules/node-sass
> node scripts/install.js
module.js:338
throw err;
^
Error: Cannot find module '/root/.jenkins/jobs/odyssey-frontend/workspace/node_modules/gulp-sass/node_modules/node-sass/scripts/install.js'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
npm ERR! Linux 3.14.35-28.38.amzn1.x86_64
npm ERR! argv "node" "/home/ec2-user/.linuxbrew/bin/npm" "install" "--production"
npm ERR! node v0.12.2
npm ERR! npm v2.7.6
npm ERR! code ELIFECYCLE
npm ERR! node-sass#2.1.1 install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass#2.1.1 install script 'node scripts/install.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 scripts/install.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! /root/.jenkins/jobs/odyssey-frontend/workspace/npm-debug.log
module.js:338
throw err;
^
Error: Cannot find module 'gulp-sass'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/root/.jenkins/jobs/odyssey-frontend/workspace/gulpfile.js:11:12)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
Build step 'Execute shell' marked build as failure
Finished: FAILURE
The Linux distribution is Amazon Linux AMI, Fedora-like. Trying to install node-sass ^2.0.1 via gulp-sass ^1.3.3.
I just tried the updated gulp-sass 2.0.0 with node-sass 3.0.0 and still have the same issue.
I removed all node-sass dependencies and it builds successfully now. So its really just that package; all other node packages install successfully.
I posted this on the Github project where it was answered: https://github.com/sass/node-sass/issues/941#issuecomment-100414516
Jenkins seems to run everything as sudo when building. NPM, as a security feature, won't run install scripts as sudo, hence the error. Adding a --unsafe-perm flag to the install script gets by this issue.

Resources