Individual package-lock.json for npm workspaces - npm

I have two packages inside my npm workspace api & cdk. I would like to create an individual package-lock.json inside api & cdk as both of those projects will get deployed individually. Is this currently possible with npm workspaces? What are other alternatives or strategies?
├── api
│ ├── package.json
├── cdk
│ ├── package.json
├── node_modules
├── package.json
├── package-lock.json

Related

npm cant change Jasmine package version

if I run npm view jasmine version or npm view jasmine version -g from ~ the version returned is 3.3.1
I need the version to be 2.8.0 so i try to downgrade with npm install jasmine#2.8.0 -g but npm view jasmine version is still 3.3.1
Now if i do npm list -g i see the correct version for jasmine (2.8.0)... So where is the 3.3.1 coming from?
├─┬ jasmine#2.8.0
│ ├── exit#0.1.2
│ ├─┬ glob#7.1.3
│ │ ├── fs.realpath#1.0.0
│ │ ├─┬ inflight#1.0.6
│ │ │ ├── once#1.4.0 deduped
│ │ │ └── wrappy#1.0.2
│ │ ├── inherits#2.0.3
│ │ ├─┬ minimatch#3.0.4
│ │ │ └─┬ brace-expansion#1.1.11
│ │ │ ├── balanced-match#1.0.0
│ │ │ └── concat-map#0.0.1
│ │ ├─┬ once#1.4.0
│ │ │ └── wrappy#1.0.2 deduped
│ │ └── path-is-absolute#1.0.1
│ └── jasmine-core#2.8.0
Understanding the npm view command:
When you run either of the following npm view commands:
npm view jasmine version
or
npm view jasmine version -g
you are sending a GET request to the npm registry. More specifically you are sending a request to the following endpoint:
https://registry.npmjs.org/jasmine
You can verify this by appending the -d option to your command for additional logging information. For instance, if you run;
npm view jasmine version -d
you'll see additional information in your log which includes something like the following:
npm http request GET https://registry.npmjs.org/jasmine
Note: This line above indicates the endpoint which your view command is making the request to.
So where is the 3.3.1 coming from?
3.3.1 is the latest version of the jasmine package available in the npm registry. The result of any view command does not indicate information about packages installed on your system, instead it returns information (metadata) about packages held in the npm registry.
You'll continue to see version 3.3.1 logged to your console when running;
npm view jasmine version
(from any directory location on your system), until a newer version of jasmine is published to the npm registry.
Additional Notes:
The two npm commands that you are running, namely:
npm view jasmine version
and
npm view jasmine version -g
are effectively the same command. The view command does not provide a -g option. The -g option is simply being ignored.
The npm list command, (as you've already discovered), should be utilized for retrieving information about packages that are installed on your system. Hence that why its indicating your expected result(s).

npm uninstall -g not working

I tried to npm uninstall -g is not working.
First I had tried npm ls -g --depth=0 it produced the following results
/usr/local/lib
├── UNMET PEER DEPENDENCY #babel/core#7.0.0-beta.4
├── #babel/node#7.0.0-beta.44
├── aws-cli#0.0.2
├── babel-core#6.26.0
├── babel-loader#7.1.4
├── babel-plugin-transform-decorators-legacy#1.3.4
├── babel-plugin-transform-object-rest-spread#6.26.0
├── babel-plugin-transform-optional-chaining#7.0.0-beta.3
├── babel-preset-react#6.24.1
├── babel-preset-stage-3#6.24.1
├── babel-register#7.0.0-beta.3
├── coffeescript#2.2.4
├── graceful-fs#4.1.11
├── minimatch#3.0.4
├── n#2.1.8
├── npm#5.8.0
├── ntdl#1.0.2
├── pdf-compress#1.0.0 -> /home/ubuntu/workarea/sourcecode/pdf-optimise
├── virtualenv#0.3.1
├── UNMET PEER DEPENDENCY webpack#2 || 3 || 4
└── yarn#1.5.1
npm ERR! peer dep missing: #babel/core#7.0.0-beta.44, required by
#babel/node#7.0.0-beta.44
npm ERR! peer dep missing: webpack#2 || 3 || 4, required by babel-
loader#7.1.4
npm ERR! peer dep missing: #babel/core#7.0.0-beta.44, required by
#babel/register#7.0.0-beta.44
npm ERR! peer dep missing: webpack#>=0.9 <2 || ^2.1.0-beta || ^2.2.0,
required by worker-loader#0.8.1
}
Then I had tried uninstalling it didn't succeeded
root#ip-10-252-14-11:/home/ubuntu/workarea/sourcecode/ntdl# sudo npm
uninstall -g #babel/node#7.0.0-beta.44
up to date in 0.063s
root#ip-10-252-14-11:/home/ubuntu/workarea/sourcecode/ntdl# babel-node --
version
7.0.0-beta.44
Then I tried
root#ip-10-252-14-11:/home/ubuntu/workarea/sourcecode/ntdl# npm uninstall
-g *
npm ERR! code ENOLOCAL
npm ERR! Could not install from
"../../home/ubuntu/workarea/sourcecode/ntdl" as it does not contain a
package.json file.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-04-10T01_33_46_993Z-debug.log
Please help me in resolving this issue.
With Many Thanks,
Bharath AK
Did you try this? npm uninstall npm -g
see here

undefined is not an object(ecaluating 'ReactInternals.ReactCurrentOwner')

I want to run my react-native project, but an error occurred.
Please give me advise.
Environment
$ npm list --depth=0
nav#0.0.1 /Dev/lrn/rn/nav
├── babel-jest#20.0.3
├── babel-preset-react-native#1.9.2
├── jest#20.0.4
├── UNMET PEER DEPENDENCY react#16.0.0-alpha.6
├── react-native#0.45.1
├── react-navigation#1.0.0-beta.11
└── react-test-renderer#16.0.0-alpha.12
Project Directory
$ls
__tests__ index.android.js node_modules yarn.lock
android index.ios.js package-lock.json
app.json ios package.json
What I Do
$ rm -rf node_modules
$ npm cache clean --force
$ npm install
$ react-native run-ios
Error
Red Screen iPhone Simulator
I think environment was wrong, but what I do cannot correct it.
Thank you for seeing and any advice is welcome. thank you.
I ran into the same problem, after doing some reading on their Github Issues
yarn add react#16.0.0-alpha.12
or
npm i react#16.0.0-alpha.12 --save
did the trick for me.

why doesn't gulp run when installed globally?

I install gulp using npm install -g gulp
[npm WARN deprecation warnings redacted]
/usr/local/bin/gulp -> /usr/local/lib/node_modules/gulp/bin/gulp.js
/usr/local/lib
└── gulp#3.9.1
When I try to run the gulp command I get:
gulp
[19:42:23] Local gulp not found in ~/javascript
[19:42:23] Try running: npm install gulp
But when I install another npm package globally, it works. For instance when I install create-react-app like so:
npm install -g create-react-app
/usr/local/bin/create-react-app -> /usr/local/lib/node_modules/create-react-app/index.js
/usr/local/lib
└─┬ create-react-app#0.2.0
├─┬ chalk#1.1.3
│ ├── ansi-styles#2.2.1
│ ├── escape-string-regexp#1.0.5
│ ├─┬ has-ansi#2.0.0
│ │ └── ansi-regex#2.0.0
│ ├── strip-ansi#3.0.1
│ └── supports-color#2.0.0
├─┬ cross-spawn#4.0.0
│ ├─┬ lru-cache#4.0.1
│ │ ├── pseudomap#1.0.2
│ │ └── yallist#2.0.0
│ └─┬ which#1.2.10
│ └── isexe#1.1.2
├── minimist#1.2.0
└── semver#5.3.0
When I run the command after installation it works:
create-react-app
Usage: create-react-app <project-directory> [--verbose]
Is there any reason why gulp would screw out?
You have to install the Gulp CLI to get the command line to work npm install -g gulp-cli

react-native init error file not found?

I try to get into the tutorial of React Native but I am stuck at init a new project. A npm error occurs npm ERR! enoent ENOENT: no such file or directory, open '/Users/vikti/dev/AwesomeProject/node_modules/.staging/xtend-ea557a9c3da42553dd204c5fe8fb762c/package.json'
Here is the log:
MacBook-Pro-de-vikti:dev vikti$ react-native init AwesomeProject
This will walk you through creating a new React Native project in /Users/vikti/dev/AwesomeProject
AwesomeProject#0.0.1 /Users/vikti/dev/AwesomeProject
├── absolute-path#0.0.0 extraneous
├── archive-type#3.0.1 extraneous
├── babel-core#5.8.21 extraneous
├── beeper#1.1.0 extraneous
├── bl#1.0.0 extraneous
├── bser#1.0.0 extraneous
├── buffer-to-vinyl#1.0.1 extraneous
├── caw#1.1.0 extraneous
├── chokidar#1.2.0 extraneous
├── cli-table#0.3.1 extraneous
├── commondir#1.0.1 extraneous
├── connect#2.8.3 extraneous
├── cross-spawn#2.0.0 extraneous
├── dargs#4.0.1 extraneous
├── dateformat#1.0.11 extraneous
├── detect-conflict#1.0.0 extraneous
├── diff#1.4.0 extraneous
├── each-async#1.1.1 extraneous
├── ejs#2.3.4 extraneous
├── errno#0.1.4 extraneous
├── filenamify#1.2.0 extraneous
├── findup-sync#0.2.1 extraneous
├── github-username#2.0.0 extraneous
├── glob-watcher#0.0.8 extraneous
├── glob2base#0.0.12 extraneous
├── globby#2.1.0 extraneous
├── got#4.2.0 extraneous
├── grouped-queue#0.3.0 extraneous
├── gruntfile-editor#1.0.0 extraneous
├── gulp-rename#1.2.2 extraneous
├── html-wiring#1.2.0 extraneous
├── image-size#0.3.5 extraneous
├── immutable#3.7.5 extraneous
├── inquirer#0.8.5 extraneous
├── is-bzip2#1.0.0 extraneous
├── is-gzip#1.0.0 extraneous
├── is-tar#1.0.0 extraneous
├── is-url#1.2.1 extraneous
├── is-zip#1.0.0 extraneous
├── istextorbinary#1.0.2 extraneous
├── joi#5.1.0 extraneous
├── lodash._reescape#3.0.0 extraneous
├── lodash._reevaluate#3.0.0 extraneous
├── lodash.template#3.6.2 extraneous
├── log-symbols#1.0.2 extraneous
├── module-deps#3.5.6 extraneous
├── multimatch#2.0.0 extraneous
├── multipipe#0.1.2 extraneous
├── nopt#3.0.4 extraneous
├── optimist#0.6.1 extraneous
├── ordered-read-streams#0.1.0 extraneous
├── pretty-bytes#2.0.1 extraneous
├── progress#1.1.8 extraneous
├── promise#7.0.4 extraneous
├── react-timer-mixin#0.13.3 extraneous
├── react-tools#0.14.0-beta1 extraneous (git://github.com/facebook/react.git#b4e74e38e43ac53af8acd62c78c9213be0194245)
├── rebound#0.0.12 extraneous
├── regenerator#0.8.36 extraneous
├── rimraf#2.4.3 extraneous
├── run-async#0.1.0 extraneous
├── sane#1.3.0 extraneous
├── seek-bzip#1.0.5 extraneous
├── shelljs#0.5.3 extraneous
├── sinon#1.17.1 extraneous
├── stacktrace-parser#0.1.3 extraneous
├── stat-mode#0.2.1 extraneous
├── strip-dirs#1.1.1 extraneous
├── text-table#0.2.0 extraneous
├── uglify-js#2.4.16 extraneous
├── underscore#1.7.0 extraneous
├── underscore.string#3.2.2 extraneous
├── untildify#2.1.0 extraneous
├── vinyl#0.4.6 extraneous
├── vinyl-assign#1.2.1 extraneous
├── vinyl-file#1.2.1 extraneous
├── ware#1.3.0 extraneous
├── wordwrap#1.0.0 extraneous
├── ws#0.8.0 extraneous
├── xdg-basedir#2.0.0 extraneous
├── yauzl#2.3.1 extraneous
├── yeoman-assert#2.1.0 extraneous
└── yeoman-welcome#1.0.1 extraneous
npm ERR! Darwin 14.4.0
npm ERR! argv "/Users/vikti/.nvm/versions/node/v4.1.1/bin/node" "/Users/vikti/.nvm/versions/node/v4.1.1/bin/npm" "install" "--save" "react-native"
npm ERR! node v4.1.1
npm ERR! npm v3.3.5
npm ERR! path /Users/vikti/dev/AwesomeProject/node_modules/.staging/xtend-ea557a9c3da42553dd204c5fe8fb762c/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '/Users/vikti/dev/AwesomeProject/node_modules/.staging/xtend-ea557a9c3da42553dd204c5fe8fb762c/package.json'
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.
npm ERR! enoent
npm ERR! Please include the following file with any support request:
npm ERR! /Users/vikti/dev/AwesomeProject/npm-debug.log
Any idea on what is wrong?