Node.js
Install Packages
Install by npm install <PACKAGE>
Packages that installed by
npm install <PACKAGE> will automatically choose the latest avaliable versionInstall by npm install
There are two situations:
- If
package-lock.jsonexists, and current installed package version has satisfied the version insidepackage.json, then that package is not going to be installed again;
- If
package-lock.jsonnot exists, or not satisfy the version insidepackage.json, then it will install the package again and update the package version based on~and^.
Install by npm ci
Installed by
npm ci is similiar with npm install, except it will throw an excception when the version inside package-lock.json is not satisfied with the version inside package.json.Get the verion of package
npm ls <PACKAGE> can get the package version. However, the version may not correct. Let’s assume the data inside package-lock.json is correct, rather than, for example, version and resolved doesn’t mathch.package is not installed, has
package.json, no package-lock.json it will show UNMET DEPENDENCY <PACKAGE>@<PACKAGE_JSON_VERSION>package is not installed, has
package.json, has package-lock.json it will show UNMET DEPENDENCY <PACKAGE>@<PACKAGE_LOCK_JSON_VERSION>package is not installed, no
package.json it will go up and search parent folder’s version.package installed, no
package.json, no package-lock.json will show <PACKAGE>@<PACKAGE_VERSION>.package installed, has
package.json, no package-lock.json if version match will show <PACKAGE>@<PACKAGE_VERSION>, else will show <PACKAGE>@<PACKAGE_VERSION> invalid.package installed, no
package.json, has package-lock.json will show <PACKAGE>@<PACKAGE_VERSION>.package installed, has
package.json, has package-lock.json if all version didn’t match, will show <PACKAGE>@<PACKAGE_VERSION> invalid. if package, package.json match, package-lock.json doesn’t match, will show <PACKAGE>@<PACKAGE_VERSION>. if package, package-lock.json match, package.json doesn’t match, will show <PACKAGE>@<PACKAGE_VERSION> invalid. if package.json, package-lock.json match, package doesn’t match, will show <PACKAGE>@<PACKAGE_VERSION> invalid.Others
update Node.js
link global packages to local
find node module
using node-sass
Node Registry
puppeteer
Publish package
wsl npm install ENOENT: no such file or directory
Webpack
Terser webpack plugin support ios10
cache-loader 坑
问题: 在升级或降级
@fe/common 包时, 打包的时候并不会加载最新的包, 所以会导致构建或者逻辑有问题 解决方法: 删除 .cache-loaderTypescript
tslint -p . --type-check 可以改为 tsc --project ./tsconfig.json --noEmit && tslint -p ./tsconfig.jsonLink
安装包 @sentry/cli 出现问题


NPM 7 的 peerDependency 表现不一致

