I am trying out gatsby
Here is how I install gatsby-cli:
$ npm install --global gatsby-cli
/Users/antkong/.nvm/versions/node/v4.8.6/bin/gatsby -> /Users/antkong/.nvm/versions/node/v4.8.6/lib/node_modules/gatsby-cli/lib/index.js
gatsby-cli#1.1.20 /Users/antkong/.nvm/versions/node/v4.8.6/lib/node_modules/gatsby-cli
├── convert-hrtime#2.0.0
├── hosted-git-info#2.5.0
├── stack-trace#0.0.10
├── resolve-cwd#2.0.0 (resolve-from#3.0.0)
├── source-map#0.5.7
├── bluebird#3.5.1
├── babel-code-frame#6.26.0 (js-tokens#3.0.2, esutils#2.0.2, chalk#1.1.3)
├── execa#0.8.0 (p-finally#1.0.0, strip-eof#1.0.0, is-stream#1.1.0, get-stream#3.0.0, signal-exit#3.0.2, npm-run-path#2.0.2, cross-spawn#5.1.0)
├── fs-extra#4.0.2 (universalify#0.1.1, jsonfile#4.0.0, graceful-fs#4.1.11)
├── common-tags#1.4.0
├── yargs#8.0.2 (decamelize#1.2.0, get-caller-file#1.0.2, camelcase#4.1.0, y18n#3.2.1, which-module#2.0.0, set-blocking#2.0.0, yargs-parser#7.0.0, require-main-filename#1.0.1, require-directory#2.1.1, string-width#2.1.1, cliui#3.2.0, os-locale#2.1.0, read-pkg-up#2.0.0)
├── yurnalist#0.2.1 (strip-bom#3.0.0, detect-indent#5.0.0, leven#2.1.0, semver#5.4.1, object-path#0.11.4, death#1.1.0, is-builtin-module#1.0.0, is-ci#1.0.10, chalk#1.1.3, debug#2.6.9, node-emoji#1.8.1, read#1.0.7, loud-rejection#1.6.0, invariant#2.2.2, rimraf#2.6.2, inquirer#3.3.0)
├── pretty-error#2.1.1 (utila#0.4.0, renderkid#2.0.1)
├── babel-runtime#6.26.0 (regenerator-runtime#0.11.0)
├── lodash#4.17.4
└── core-js#2.5.1
Then when I tried to print out the version to see if the installation is successful, I got this:
$ gatsby --version
module.js:327
throw err;
^
Error: Cannot find module 'regenerator-runtime/runtime'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/Users/antkong/.nvm/versions/node/v4.8.6/lib/node_modules/gatsby-cli/lib/index.js:88:1)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
My version of npm and node
$ node --version
v4.8.6
$ npm --version
2.15.11
OS platform is macOS High Sierra
What did I miss during the installation?
We're not supporting Node 4 anymore — try upgrading to Node 8 & NPM 5 and it should be smooth sailing!
Related
Im looking to install a custom package on heroku. I have the following folder structure.
├─ src
│ ├─ packagename
│ │ ├─ __init__.py
│ │ └─ ...
│ └─ setup.py
├─ tests
│ └─ ...
└─ Procfile
Locally I run the following to make the package structure importable.
$ cd src
$ pip install -e .
How do I add that step to build process in heroku?
The trick is to add it to the requirements.txt file with the -e flag. Found it out from looking at the docs on how to handle local file-backed distributions.
I am following this installation guide and got error cannot find module - https://yarnpkg.com/getting-started/install
Here is repo - https://github.com/worldpwn/yarn-3-cannot-find-module-error
Step 1 Install Corepack
$ node -v
v16.13.0
$ corepack enable
Step 2 Initializing your project
$ yarn -v
1.22.15
$ yarn set version stable
➤ YN0000: Retrieving https://repo.yarnpkg.com/3.1.1/packages/yarnpkg-cli/bin/yarn.js
➤ YN0000: Saving the new release in .yarn/releases/yarn-3.1.1.cjs
➤ YN0000: Done in 0s 508ms
$ yarn -v
3.1.1
$ yarn init -2
{
name: 'yarn-3-cannot-find-module-error',
packageManager: 'yarn#3.1.1'
}
Step 3 Install Lodash
$ yarn add lodash
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0013: │ lodash#npm:4.17.21 can't be found in the cache and will be fetched from the remote registry
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ YN0000: └ Completed
➤ YN0000: Done in 0s 165ms
Step 4 Run hello world
index.js
console.log('hello world')
$ node index.js
hello world
Step 5 Use lodash - ERROR
index.js
var multiply = require('lodash/multiply');
console.log(multiply(3, 5))
$ node index.js
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'lodash/multiply'
Require stack:
- C:\Users\a.kniazev\Documents\GitHub\yarn-3-cannot-find-module-error\index.js
←[90m at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)←[39m
←[90m at Function.Module._load (node:internal/modules/cjs/loader:778:27)←[39m
←[90m at Module.require (node:internal/modules/cjs/loader:1005:19)←[39m
←[90m at require (node:internal/modules/cjs/helpers:102:18)←[39m
at Object.<anonymous> (C:\Users\a.kniazev\Documents\GitHub\yarn-3-cannot-find-module-error\index.js:1:16)
←[90m at Module._compile (node:internal/modules/cjs/loader:1101:14)←[39m
←[90m at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)←[39m
←[90m at Module.load (node:internal/modules/cjs/loader:981:32)←[39m
←[90m at Function.Module._load (node:internal/modules/cjs/loader:822:12)←[39m
←[90m at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)←[39m {
code: ←[32m'MODULE_NOT_FOUND'←[39m,
requireStack: [
←[32m'C:\\Users\\a.kniazev\\Documents\\GitHub\\yarn-3-cannot-find-module-error\\index.js'←[39m
]
}
P.S. npm is working fine in other projects
If i will do npm i:
$ npm i
added 1 package, and audited 2 packages in 934ms
found 0 vulnerabilities
Everything works:
$ node index.js
15
I figure out that the problem is that I have to run index.js using this command:
$ yarn node index.js
15
As I understand it uses PnP to resolve dependencies:
https://yarnpkg.com/features/pnp
https://yarnpkg.com/features/pnp#initializing-pnp
Building on Andrei's answer (this is from https://yarnpkg.com/features/pnp#initializing-pnp):
As a quick tip, all yarn node typically does is set the NODE_OPTIONS environment variable to use the --require option from Node, associated with the path of the .pnp.cjs file. You can easily apply this operation yourself if you prefer:
node -r ./.pnp.cjs ./server.js
NODE_OPTIONS="--require $(pwd)/.pnp.cjs" node ./server.js
I have just updated the npm packages of my Laravel project right at my MacOS system (I have been developing on Laravel Homestead since so long but npm didn't work for me),
% npm list
% npm update -D
% npm list to compare the versions differences
% npm install
also brew update and brew upgrade (on MacOS).
So I got now the following versions:
% npm -v: 8.1.0
├── #fortawesome/fontawesome-free#5.15.4
├── #tailwindcss/forms#0.3.4
├── #tailwindcss/typography#0.4.1
├── alpinejs#3.4.2
├── axios#0.21.4
├── laravel-mix#6.0.35
├── lodash#4.17.21
├── postcss-import#14.0.2
├── postcss#8.3.11
├── resolve-url-loader#4.0.0
├── sass-loader#12.3.0
├── sass#1.43.4
├── sweetalert2#11.1.9
└── tailwindcss#2.2.17
When I run $ npm run dev nothing happens and I get the following message:
% npm run dev
> dev
> npm run development
> development
> mix
node: --openssl-legacy-provider is not allowed in NODE_OPTIONS
What do I do to fix it?
Workaround
I ran $ npm run dev right inside the Ubuntu Laravel Homestead and it worked! At the end I got the following messages:
webpack compiled successfully
npm notice
npm notice New major version of npm available! 7.12.1 -> 8.1.2
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.1.2
npm notice Run npm install -g npm#8.1.2 to update!
npm notice
But I won't update, since I'm afraid I'll get the same error.
Notice:
% => I am running on MacOS.
$ => I am running on Ubuntu.
Update
I have just updated again everything with
% brew update
% brew upgrade
Then I ran again
% npm run dev even if I still got npm -v => 8.1.0, but my packages have been updated:
├── #fortawesome/fontawesome-free#5.15.4
├── #tailwindcss/forms#0.3.4
├── #tailwindcss/typography#0.4.1
├── alpinejs#3.5.0
├── axios#0.21.4
├── laravel-mix#6.0.39
├── lodash#4.17.21
├── postcss-import#14.0.2
├── postcss#8.3.11
├── resolve-url-loader#4.0.0
├── sass-loader#12.3.0
├── sass#1.43.4
└── tailwindcss#2.2.19
and it's working normally again!
For me the cause was node version 17.
I downgraded node to version 16 (LTS) and it worked.
See also the answer here https://stackoverflow.com/a/70286141/936284
unset NODE_OPTIONS
worked for me
When using the command, npx create-react-app tconnect it fails with the following error:
Error: Cannot find module 'rxjs'
I have the latest stable version of node. I also tried reinstalling npm and yarn.
Below is the output from my terminal:
///////////////////////////////////////////////////////////////////////////
➜ Projects git:(master) ✗ npx create-react-app tconnect
npx: installed 91 in 3.968s
Creating a new React app in /Users/punchcode/Projects/tconnect.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
yarn add v1.17.3
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
warning "react-scripts > #typescript-eslint/eslint-plugin > tsutils#3.17.1" has unmet peer dependency "typescript#>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
[4/4] 🔨 Building fresh packages...
success Saved lockfile.
success Saved 36 new dependencies.
info Direct dependencies
├─ cra-template#1.0.0
├─ react-dom#16.12.0
├─ react-scripts#3.3.0
└─ react#16.12.0
info All dependencies
├─ #babel/plugin-proposal-class-properties#7.7.4
├─ #babel/plugin-proposal-decorators#7.7.4
├─ #babel/plugin-proposal-nullish-coalescing-operator#7.7.4
├─ #babel/plugin-proposal-numeric-separator#7.7.4
├─ #babel/plugin-proposal-optional-chaining#7.7.4
├─ #babel/plugin-syntax-decorators#7.8.3
├─ #babel/plugin-syntax-flow#7.8.3
├─ #babel/plugin-syntax-nullish-coalescing-operator#7.8.3
├─ #babel/plugin-syntax-numeric-separator#7.8.3
├─ #babel/plugin-syntax-optional-chaining#7.8.3
├─ #babel/plugin-syntax-typescript#7.8.3
├─ #babel/plugin-transform-flow-strip-types#7.7.4
├─ #babel/plugin-transform-runtime#7.7.4
├─ #babel/plugin-transform-typescript#7.8.3
├─ #babel/preset-typescript#7.7.4
├─ #types/parse-json#4.0.0
├─ babel-plugin-macros#2.7.1
├─ babel-plugin-named-asset-import#0.3.5
├─ babel-preset-react-app#9.1.0
├─ core-js#3.6.4
├─ cra-template#1.0.0
├─ eslint-config-react-app#5.1.0
├─ fork-ts-checker-webpack-plugin#3.1.0
├─ lines-and-columns#1.1.6
├─ open#7.0.0
├─ promise#8.0.3
├─ raf#3.4.1
├─ react-app-polyfill#1.0.5
├─ react-dev-utils#10.0.0
├─ react-dom#16.12.0
├─ react-error-overlay#6.0.4
├─ react-scripts#3.3.0
├─ react#16.12.0
├─ scheduler#0.18.0
├─ whatwg-fetch#3.0.0
└─ yaml#1.7.2
✨ Done in 9.23s.
internal/modules/cjs/loader.js:796
throw err;
^
Error: Cannot find module 'rxjs'
Require stack:
- /Users/punchcode/Projects/tconnect/node_modules/inquirer/lib/ui/prompt.js
- /Users/punchcode/Projects/tconnect/node_modules/inquirer/lib/inquirer.js
- /Users/punchcode/Projects/tconnect/node_modules/react-dev-utils/browsersHelper.js
- /Users/punchcode/Projects/tconnect/node_modules/react-scripts/scripts/init.js
- /Users/punchcode/Projects/tconnect/[eval]
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17)
at Function.Module._load (internal/modules/cjs/loader.js:686:27)
at Module.require (internal/modules/cjs/loader.js:848:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/Users/punchcode/Projects/tconnect/node_modules/inquirer/lib/ui/prompt.js:3:34)
at Module._compile (internal/modules/cjs/loader.js:955:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
at Module.load (internal/modules/cjs/loader.js:811:32)
at Function.Module._load (internal/modules/cjs/loader.js:723:14)
at Module.require (internal/modules/cjs/loader.js:848:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/punchcode/Projects/tconnect/node_modules/inquirer/lib/ui/prompt.js',
'/Users/punchcode/Projects/tconnect/node_modules/inquirer/lib/inquirer.js',
'/Users/punchcode/Projects/tconnect/node_modules/react-dev-utils/browsersHelper.js',
'/Users/punchcode/Projects/tconnect/node_modules/react-scripts/scripts/init.js',
'/Users/punchcode/Projects/tconnect/[eval]'
]
}
Aborting installation.
node has failed.
Deleting generated file... node_modules
Deleting generated file... package.json
Deleting generated file... yarn.lock
Deleting tconnect/ from /Users/punchcode/Projects
Done.
It could be a number of things. I'd suggest a sanity check, in which case we'll assume that something is broken in your particular case with npx-
So try the alternatives:
npm install create-react-app and then create-react-app
OR install create-react-app via Yarn
If this doesn't work try Facebook's suggestion (in the event you may have installed create-react-app globally):
If you've previously installed create-react-app globally via npm
install -g create-react-app, we recommend you uninstall the package
using npm uninstall -g create-react-app to ensure that npx always uses
the latest version.
source: https://github.com/facebook/create-react-app/blob/master/README.md
brew install i386-elf-gcc
==> Installing i386-elf-gcc from altkatz/gcc_cross_compilers
Error: altkatz/gcc_cross_compilers/i386-elf-gcc contains conflicting version recursive dependencies:
gmp, gmp#4, mpfr, mpfr#2, libmpc, libmpc#0.8
View these with brew deps --tree altkatz/gcc_cross_compilers/i386-elf-gcc.
And the debs tree looks like:
altkatz/gcc_cross_compilers/i386-elf-gcc
├── gmp
├── libmpc
│ ├── gmp
│ └── mpfr
│ └── gmp
├── mpfr
│ └── gmp
└── i386-elf-binutils
After I installed the gmp#4,mpfr#2,libmpc#0.8,gcc49 ,the error doesn't change .
I installed it using MacPorts and it worked for me:
sudo port install i386-elf-binutils
sudo port install i386-elf-gcc
cd /opt/local/bin
sudo ln -s i386-elf-gcc i386-elf-gcc-4.7.2