我想使用grunt-contrib-jasmine
NPM包.它有各种依赖.依赖图的一部分如下所示:
?? grunt-contrib-jasmine@0.4.1
? ??? grunt-lib-phantomjs@0.2.0
? ? ??? phantomjs@1.8.2-2
Run Code Online (Sandbox Code Playgroud)
不幸的是,这个版本中存在一个错误phantomjs
,导致它无法在Mac OS X上正确安装.这在最新版本中已得到修复.
我怎样才能grunt-lib-phantomjs
使用更新的版本phantomjs
?
一些额外的背景:
grunt-contrib-jasmine
明确要求版本"~0.2.0"
的grunt-lib-phantomjs
,其中明确要求版本"~1.8.1"
的phantomjs
.phantomjs
到我的包的依赖项没有任何效果; 两个版本都已安装并grunt-contrib-jasmine
仍然使用旧版本(请参阅:使用NPM安装软件包时,是否可以告诉它使用其中一个依赖项的不同版本?).我的package.json(react-native@0.55.4需要react@16.3.1)
"dependencies": {
"expo": "^27.0.1",
"react": "16.3.1",
"react-native": "~0.55.2",
"react-navigation": "^2.0.1"
}
Run Code Online (Sandbox Code Playgroud)
我的yarn.lock 文件中收到重复的包。
react@16.3.1:
version "16.3.1"
resolved "https://registry.yarnpkg.com/react/-/react-16.3.1.tgz#4a2da433d471251c69b6033ada30e2ed1202cfd8"
dependencies:
fbjs "^0.8.16"
loose-envify "^1.1.0"
object-assign "^4.1.1"
prop-types "^15.6.0"
react@^16.0.0:
version "16.3.2"
resolved "https://registry.yarnpkg.com/react/-/react-16.3.2.tgz#fdc8420398533a1e58872f59091b272ce2f91ea9"
dependencies:
fbjs "^0.8.16"
loose-envify "^1.1.0"
object-assign "^4.1.1"
prop-types "^15.6.0"
Run Code Online (Sandbox Code Playgroud)
运行$ yarn remove react
, 结果为.
react@^16.0.0:
version "16.3.2"
resolved "https://registry.yarnpkg.com/react/-/react-16.3.2.tgz#fdc8420398533a1e58872f59091b272ce2f91ea9"
dependencies:
fbjs "^0.8.16"
loose-envify "^1.1.0"
object-assign "^4.1.1"
prop-types "^15.6.0"
Run Code Online (Sandbox Code Playgroud)
如果我尝试再次运行它,我会得到error This module isn't specified in a manifest.
如何强制yarn删除所有react版本,以便我可以手动安装我需要的版本?
纱线安装只需添加两个包即可。
会yarn install --pure-lockfile
或yarn …
我有一个的package.json是给出安全警告的负载。查看第一个关键项目,我看到它的open@0.0.5已经五年没有更新了。查看npm ll
它包含在npm@6.5.0 中,我使用的是大约两周前更新的最新版本。
我想删除不安全的依赖项。在 Java 世界中,maven 包管理器允许您排除某些传递依赖项。理想情况下,使用npm
或另一个节点包管理器,我应该能够排除具有漏洞的依赖项。然后我可以重新测试我的应用程序是否正常工作并且没有看到任何安全错误。有没有办法从我的 package.json 中快速排除任何有安全漏洞的东西?如果没有办法做到这一点,可以采取哪些方法来确保我的应用程序不使用不安全的包?
更新:虽然"npm": "^6.5.0"
在 package.json 中有指定,但我是用旧的 npm 构建它的,该 npm 解决了上面提到的关键问题。我解决了所有问题./node_modules/.bin/npm audit fix --force
我正在尝试使用 Expo 和 TypeScript 来设置一个简单的 React Native 应用程序,以显示 WebView。我的App.tsx
文件包含以下内容:
import Constants from 'expo-constants';
import { StyleSheet } from 'react-native';
import { WebView } from 'react-native-webview';
export default function App() {
return (
<WebView
style={styles.container}
source={{ uri: 'https://example.com/' }}
/>
);
}
const styles = StyleSheet.create({
container: {
marginTop: Constants.statusBarHeight,
},
});
Run Code Online (Sandbox Code Playgroud)
此代码可以正常工作,但 TypeScript 编译器会在 WebView 组件中引发错误。
App.tsx:7:4 - error TS2786: 'WebView' cannot be used as a JSX component.
Its instance type 'WebView<{ style: { marginTop: number; }; source: …
Run Code Online (Sandbox Code Playgroud) typeerror typescript reactjs react-native react-native-webview
node.js ×2
npm ×2
package.json ×2
react-native ×1
reactjs ×1
typeerror ×1
typescript ×1
yarnpkg ×1